Idea for controlling an LED cube - Page 1
Forum section: electronics / projects

author: yelneerg
author_rank: Contributor
timestamp: June 18, 2016, 08:21:36 am
content: I've been thinking about ways to control an RGB LED cube using as few ICs as possible. I'd attached a schematic for the control of a 2x2x2 RGB cube (big enough to be representative while not being too arduous to draw) which could be expanded to control up to a 10x10x10 cube just by adding 3 shift registers (for a total of four). The decade counter on the left cycles the horizontal planes of the cube, and then during the time that each level is active the center counter cycles through the vertical planes. Obviously this will have the issue of a pretty small duty cycle for each LED for large cube sizes, but I've put together enough of a prototype that it seems like that won't be a huge issue, especially since I don't really care about maximal brightness.I'd love some feedback about the design! One thing specifically, I see people sometimes add small (bypass?) capacitors around pins going back to the arduino but I'm not entirely sure of their function or how to know when/where to add them.

author: Rerouter
author_rank: Super Contributor
timestamp: June 18, 2016, 09:52:31 am
content: the bypass caps are to ensure stable operation of the silicon devices, so adding say a 1uF and a 100nF next to the shift registers and the arduino chip mean while your switching the higher current LED's the supply wont sag at those chips and you wont have glitches (hopefully),Now if you do away with "digital write" for arduinos and directly toggle pins, you can get much faster output speeds (only take 2 clock cycles to set a pin state), meaning your left with more time to process your animations, and get a higher frame rate, for a 10x10x10 RGB cube, this seriously adds up, considering you will be shifting in (10+10) x 3 bits each step for the colours, double it for the clock pin and add a 2 toggles for the register pin (assuming your using one), or 122 pin state changes per layer, or 1220 for all 10 layers, + your row pulses, which will be about 200uS per frame of writing, meaning you have tonnes of time to process your animations,

author: Fungus
author_rank: Super Contributor
timestamp: June 18, 2016, 10:21:03 am
content: Quote from: yelneerg on June 18, 2016, 08:21:36 amHopefully they're bypass capacitors. Put them all over the place between the 5V rails and GND. They help keep up the voltage when you switch large amounts of current (the PSU takes time to respond to changes in demand, the capacitors fill in the gaps). Without the capacitors you'll get a lot of tiny voltage drops on the 5V rails whenever you switch on a lot of LEDs.nb. They MUST be ceramics, not electrolytics. Electrolytics are very slow to respond. It's not about monster capacity, it's about speed.

author: sirhaggis
author_rank: Regular Contributor
timestamp: June 18, 2016, 10:29:55 am
content: The way I would do it would be with a string of WS2812 (or similar) LEDs which can be be strung together serially (literally thousands long) and controlled with PWM signals from a microcontroller such as an STM32F0 or similar. Once you have the code in place you can literally write your colour values into a buffer for each LED and let the DMA controller + PWM do the business of updating them via the serial bus.The actual circuit would be quite simple, the only IC you would need would be the MCU, LEDs and resistors/caps.

author: Fungus
author_rank: Super Contributor
timestamp: June 18, 2016, 12:36:57 pm
content: PS: I wouldn't worry about the number of ICs, I'd worry about the number of transistors and resistors in that circuit.

author: yelneerg
author_rank: Contributor
timestamp: June 18, 2016, 04:37:15 pm
content: Quote from: Rerouter on June 18, 2016, 09:52:31 amI'm definitely planning on doing this!

author: yelneerg
author_rank: Contributor
timestamp: June 18, 2016, 04:40:01 pm
content: Quote from: Fungus on June 18, 2016, 12:36:57 pmYeah, it would be a shit tonne of transistors, but I'm also trying to build it with only the parts I already have. I don't think I'll actually go larger than 5x5 in this design (which would require only 2 shift registers) because I don't really want to solder that many transistors.

author: yelneerg
author_rank: Contributor
timestamp: June 18, 2016, 04:42:20 pm
content: Quote from: sirhaggis on June 18, 2016, 10:29:55 amThere are definitely simpler ways to do this, but that wouldn't be as much of a learning experience and I don't really want to buy all new LEDs.

author: Fungus
author_rank: Super Contributor
timestamp: June 18, 2016, 06:22:48 pm
content: Quote from: yelneerg on June 18, 2016, 04:40:01 pmI think the easiest way to do it (least number of solder joints) is with enough shift registers to light up a whole layer at once and then just one power transistor per layer.

author: yelneerg
author_rank: Contributor
timestamp: June 19, 2016, 08:22:24 pm
content: Quote from: Fungus on June 18, 2016, 06:22:48 pmAgain, I am aware that there are easier ways to do this but that isn't necessarily what I'm going for. If I did use the shift registers to directly drive the LEDs they would need to be able to support a decent amount of current flow. Say the resistors are set to allow 30mA through each LED (to help make up for the lowered duty cycle) then to run 8 LEDs the shift register would need to be able to source 240mA of current. I'm quite sure the one I have are designed to do that so it seems like I would need to use transistors anyway, no?

author: Fungus
author_rank: Super Contributor
timestamp: June 20, 2016, 12:22:56 am
content: Quote from: yelneerg on June 19, 2016, 08:22:24 pmThere's shift registers out there that can sink 120mA per i/O pin and 960mA total through the ground pin, eg. TLC5916. They're a bit more expensive than a 74HC595, but...not reallythatexpensive (under $2 each in small quantities).The TLC5916 is designed for driving LEDs so you can set the sink current on the pins with a single resistor per chip.Similarly: A TLC5940 will drive 16 LEDs at 120mA each. It's actually cheaper than the TLC5916 but you have to send it a lot more data (12 bits per LED) to update the chip. nb. The extra data probably isn't a problem in reality.There's also high power shift registers like the TPIC6B595 which can do 150mA per pin but I'd go for the constant-current options. Save yourself a load of resistors and PCB space.