Wednesday, June 25, 2014

Controlling an RGB LED Matrix with Shift Registers

The goal of this project is to control an 8x8 matrix of RGB LEDs. Each dot in the matrix houses a red, green, and blue LED behind a semi-opaque lens. To produce colors we need to dim the LEDs different amounts. For instance to make sky blue we need a lot of blue, some green, and a little red. Unfortunately LEDs don't dim, they are either on or off, but we can produce a similar effect by blinking them very rapidly, controlling the amount of time they are on and off to create different intensities. To do this we need a fast way to control all 192 LEDs in the matrix. The matrix provides 32 pins on it for controlling the LEDs. Eight of the pins control which row is being controlled, and the other 24 control the RGB LEDs in each column (8 columns with 3 LEDs in each). Controlling 32 IOs is a daunting task for an embedded processor which typically have only a handful of GPIOs (General Purpose IOs). The PIC32 family has the needed IOs but using 32 leaves little else for other purposes. To get around this problem I used a serial-load parallel-out shift register. Read after the break to see how it all works.