I was bored this past sunday, and needed something to ease my racing brain … so I picked an easy project with lots of flash.
The parts list:
Eight Tri-Color or RGB leds … each led package contains three LEDs
Three 74HC595 Shift Registers … serial load, latching. other varieties would probably work too.
One Microcontroller … doesn’t matter what it is, I used a pic18f252 since it was handy.
Twenty-Four Resistors … I used 150 ohm to set my led current at 20mA, but use anything from 56-220 ohms
The tri-color leds I used are wired as common anode LEDs … each led inside the package has its own cathode pin and shares a common anode pin. So, all my anode pins connect to the postive rail on the breadboard. There’s no reason a person couldn’t use twenty-four discrete LEDs, or eight common cathode leds. Since my leds are “active low”, outputting a 0 turns them on, outputting a 1 turns them off… if you used common cathode leds, they would be “active high”, a 1 would turn them on and a 0 off. If you used discrete leds, well, hook ‘em all up one way or the other.
Next comes the connections to the shift registers. Think of each register as a chip containing eight switches you can turn on or off remotely. Each of the 24 LEDs gets connected to an output on the register, and they need to be grouped by color and kept in order. So looking at the picture below, working left to right, I connected all the red leds to the first register, all the blue to the second, all the green to the third. This resulted in the rats nest of wires you see between the chips and the leds. Concerning the registers themselves, they have three connections of up-most importance. Pin seven is the ground connection, pin fourteen is the +5v connection, and pin thirteen is the enable or tri-state pin. The tri-state pin must be tied to ground in order for the outputs on the register to work. Next up is the data connections. The 595 offers a nifty feature of serial pass-through. Using this feature, you can chain a bunch of them together, and treat them as a large number (in the programming). This is done with the QH* and SER pins. QH* connects to SER on the next ic ‘down stream’. On the first IC (the rightmost in my picture), SER connects to the microcontroller. Now in order to ‘load’ the chips with serial data, the microcontroller has generate a ‘clock’ for all the chips to sync to. This clock signal is transmitted on the SCK (serial clock) line. All three SCK lines are wired in parallel to the microcontroller. Last, since we want the data to be retained by the registers, even if the pic stops transmitting, we need to latch the data. This is controlled by the last data line, RCK. When the microcontroller is finished transmitting data, it needs to pulse the latch clock RCK high briefly. Upon receiving this signal, the registers display the data which they just received, and continue to display it until told otherwise. I have some other lines connected, but don’t use them… they are the SCLR line, which clears the data from the buffers, and the enable line. The microcontroller keeps the enable line high (disabling the registers outputs) until it is read to start sending commands… this prevents the registers from powering up with weird random data being displayed.
That’s it for the hardware side … really simple. All the magic happens in software… which I will write about in part two (yes, I’ll post the code too). As a spoiler, all the software does is boolean math, shifting and inverting 8-bit words of 1’s and 0’s around.
Here is the breadboard:

The parts in the grayed out areas are just stuff left over on the breadboard from an earlier project, or support components for the microcontroller.
Here are some videos:
Initial Test Program:
Chasing effect:
UPDATE:
Due to all the connections (24 of them between the registers and the LEDs), drawing a schematic can get messy. I chose to avoid this mess by using Eagle “BUS” feature, which allows a large number of signals to be combined into one wire. The schematic below is drawn using a much less expensive and smaller PIC than the one pictured in the breadboard … however the idea is still the same.
Here is the source code (in BASIC of course) for the “center pulse” effect, it’s pretty much just taking binary patters of 1’s and 0’s and moving them around to create the ‘animation’.
click to download centerpulse.bas
Popularity: 36% [?]

Dear sir,
Its very interesting looking at the display of the RGB display. Wonder if there is any schematics and source code ?
Thank you
albert
Albert
April 15th, 2006
Hi Albert,
I have added the schematic and the source code for one of the effects.
Thanks for looking,
justDIY
justDIY
April 15th, 2006
Dear sir,
This project is very good!
I tried build this projejc,but it isn’t work.I have a 12f675 PIC but this code doesn’t work.
There are many question please help me.
This code (centerpulse.bas) work in the 12F675?
INT OCS I/O yes or no?
WDTE yes or no?
PWRITE yes or no?
MCLRE yes or no?
PIC’s pin3 go to 74LS595N pin 14?
PIC’s pin4 go to 74LS595N pin 11?
PIC’s pin5 go to 74LS595N pin 10?
PIC’s pin6 go to 74LS595N pin 12?
PIC’s pin7 go to 74LS595N pin 13?
Many thanks and best regards,
Peter
Peter
March 9th, 2008
Peter,
The pic fuse settings and pin assignments are at your discretion. Use whatever arrangement you’re comfortable with and knowledgeable about.
There’s actually an easier way to do this, reducing the chip count by one, and making the board layout a lot cleaner.
Use a single ‘595 to source power to eight common anode RGB leds. This takes 3 output pins (data, clk, latch).
The remaining 2 output pins will drive a 2 to 4 decoder which in turn drives some transistors sinking the three cathode lines of the leds (red, green and blue). All eight cathode lines for each color group are wired in parallel.
justDIY
March 20th, 2008
hello sir, I have 2questions
how much is C1 and what is IC1P,IC2P,IC3P ????
and in picture circuit you have 2transistor-you haven“t this in part list
Thank you
Vojtech
Cobra
April 7th, 2008
Cobra,
The transistor in the picture is actually a 20mHz digital clock generator, it’s providing the block for the pic on the breadboard. Use a pic with an internal clock, it’s much easier.
Capacitor C1 should be 0.1 to 1uF. IC1P etc are power connectors for the ‘595 chips.
justDIY
April 7th, 2008
Could you please provide the pin connections between the pic and the shift registers?
Thank You
-Justin
Justin
July 3rd, 2008
Very nice,
I am only starting to learn
electronics and how to use Integrated circuits.
this was great to see
Thanks, tom sawyer
Tom sawyer
July 23rd, 2008