Pi controlled circuit for LED's

Thread Starter

scarecrow76

Joined Oct 26, 2016
1
Greetings,

I need to design a circuit to control 36 LEDs individually (5 of which are dual color). Basically just on/off operations; no fading. It needs to be able to be controlled by a Raspberry Pi (I don't care if it's through I2C, UART or GPIO). I presume it would be easiest to achieve as a digital circuit, but I am not very experienced with hard core circuit design. I looked at LED Driver IC's, but they usually can only drive up to 3 or 4 LED channels each. Plus it seemed like overkill since I don't need fading, just on/off. I thought a regular Switch IC might be the best way to go, but I wasn't sure if there was one available that can be triggered any of the Pi outputs. Can anyone put me on the right path?
 

tttapa

Joined Jan 31, 2016
22
You could use shift registers, like the 74HC595. It's an IC that takes an 8-bit serial signal (data+clock) and outputs it as 8 parallel bits, as soon as you drive a third pin (latch) high. It's very easy, and I use it all the time when driving RGB LEDs with an Arduino. The advantage is that you can daisy chain them together, so you could use 5 or 6 shift registers in series to drive your 41 LEDs, using only 3 GPIO pins.

If you use the 74HC595, you'll still need current limiting resistors though, but some chips - like the STP16C596B1R - have constant current LED drivers built-in, so you won't need any external components (apart from your LEDs, a resistor to set the current and maybe some bypass caps).

ShiftPy is a python library to drive shift registers with a Raspberry Pi (didn't try it myself).

Hope this helps
Pieter
 

tttapa

Joined Jan 31, 2016
22
Most of these addressable LEDs require very tight timing. That's not easily done without real-time programming. There seems to be a library for the first generation of Raspberry Pi's, but it's not compatible with the newer models (2&3). You could tweak the code to get it working, but many people just use a second microcontroller (e.g. an ATmega) to drive the Neopixels, and connect it to the Pi using I²C or UART.
A discussion that might be useful: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=151460

Personally, I'd still use the shift register method, the timing here doesn't matter at all: a shift register will accept signals from 1 pulse every 7 years all the way up to 100MHz. Also, you can use as many LEDs as you want, no overflowing buffers etc, since it's all analog. Another bonus is that you can use your own LEDs, instead of the Neopixel packages, and it's way cheaper as well.

Pieter
 
Top