32x32 RGB LED matrix driver

Discussion in 'The Completed Projects Collection' started by portreathbeach, May 4, 2015.

  1. portreathbeach

    Thread Starter Active Member

    Mar 7, 2010
    143
    5
    I recently bought a 32x32 RGB LED matrix from aliexpress.com for £17. The only problem I found when I received it was that in order to display anything on it, you have to multiplex each row. You select the address of the row, clock in 32 bits for red, green and blue and then toggle the enable pin. The row lights up and then you do the next row.

    The problem is that if your PIC micropocessor has to go off and do some calculations or run some other code, the LED matrix isn't being refreshed so it goes blank.

    I decided to make a driver for the matrix. I used a PIC18F26K22 SOIC chip mounted on a very small PCB that I got made at OSHPark.com. The board attaches to the back of the LED matrix display via the 2x8 pin header.

    The PIC has been set up as an SPI slave device. It keeps refreshing the display until a master PIC drops the chip enable line and starts writing to it. I have got several commands like brightness etc. and it only takes about 3ms to send a complete new display to the chip. 3ms is pretty quick and you cannot notice the display not being refreshed for that small amount of time.

    Currently the colour depth is 1 bit. You can either have the red, the green or the blue in any one pixel either on or off, but that does give you black, white and 6 other colours.

    board.jpg

    board2.jpg

    board3.jpg

    The schematic:
    [​IMG]

    The board:
    [​IMG]

    A zip file with the Eagle files and also the C code for the project.
     
    darrough likes this.
  2. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,674
    2,724
    I would approach this differently. I'd have a timer set a flag (via interrupt) that indicates a refresh is required. A call in the main program loop checks the flag and sends out the next row of data if it is set. If I had lots of intense, time consuming code in the main loop, I'd move the row write code into the ISR itself.

    The low-level SPI communications would be done via interrupt, and data packing/unpacking would be done synchronously with the main program loop.
     
  3. portreathbeach

    Thread Starter Active Member

    Mar 7, 2010
    143
    5
    joeyd999, I understand what you are saying, but the code to keep the display refreshed is fairly large with large arrays etc. I made it so that even an 8 pin PIC with limited memory could be used to 'talk' to the display. I have built in functions like setting individual pixels, columns, rows etc. if you don't want to send a complete screen full of data over SPI to it.

    The schematic:
    32x32_schematic.png

    The board:
    board_layout.png

    A zip file with the Eagle files and also the C code for the project.
     
    Ancel UnfetteredOne likes this.
Loading...