RGB Led cube

Hi :) I am planning to make a RGB LED cube at some point. I'd like to control it from an arduino uno, but since this would limit the size to a 3x3x3 I'll be using shift registers as I'd like to make a 4x4 or 5x5. Unfortunately I've never used shift registers before, and don't know where to start, it would be great to be able to fade from colour to colour, but how does PWM work on shift registers? Also, I'd be very grateful if someone with an RGB cube (any size) would be kind enough to show me the source code, that would be really interesting and helpful. Thanks very much, hope you've all had a great 2013 :)

You may want to get 4 of these 74HC595 it's a shift register that work great when using RGB LEDs. I don't have any sample codes at the moment, but I'm sure the Arduino playground has some you can play around with. If not, just do a quick search in the forum. Many have done the same project as you, so there should be more than enough material to work with.

Here is a link to some info I found about coding an 8x8x8 RGB cube with an arduino and shift registers. hope this helps.

https://www.youtube.com/watch?v=xmScytz9y0M

james

Thanks very much - very helpful. Musicboy

I've decided to not use shift registers and use a MEGA instead, much easier :) I might do another with shift registers after this one. Another question though - how do I control from the code which LED grounds are connected? My rgb cube relies on switching the anodes, controlling the layers, and the cathodes, controlling the columns. So how can I switch on/off the pin each cathode is connected to? Hope this makes sense, thanks very much in advance.

4x4x4 needs 4 layers of anodes, and 4x4x3 = 48 columns of cathode control, at up to 20mA/column = 960mA of current. 5x5x5 needs 5 layers of anodes, 5x5x3 = 75 columns of cathode control, at up to 20mA/column = 1500mA of current.

Atmega2560 can control a max of 800mA of current. Suggest using open drain shift registers such as TPIC6B595 or perhaps something in the TLC5940 family for current sinking. P-channel MOSFET for current source, pull gate low to turn on part for anode current. Board like this has up to 96 outputs of TPIC6B595 for current sinking of cathodes or P-channel mosfet gate sinking. http://www.crossroadsfencing.com/BobuinoRev17/ Bare boards available for purchase, kits/assembled boards as well.

Thanks for your reply. Well I'm planing to use common anode RGBs, and have the anodes going vertically, connected to all the other anodes in the column. Then, have the cathodes go horizontally, connected to every other cathode of the same colour of that layer. So, 3 cathodes per layer, that's 15 cathodes, and 25 anodes for 25 columns. 25 x 20 milliamps is only 500 milliamps, which the MEGA can handle without MOSFETs or shift registers, right? Of course the problem with this design is that there's only 15 PWM pins on the MEGA, and there's 25 anodes... I don't suppose there's any way of having a kindof pwm input for the cathodes? OK that's stupid. Any ideas? Thanks as always.

So you'd select a color per layer to turn on (pulling 16 or 25 cathode low), and then select the appropriate anodes to drive high to turn on specific LEDs.

You can drive 500mA from a Mega, providing you spread the drive signals around per the notes in Section 31.1, which may not line up with your hardware PWM goals: Although each I/O port can source more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed: ATmega640/1280/2560: 1)The sum of all IOH, for ports J0-J7, G2, A0-A7 should not exceed 200mA. 2)The sum of all IOH, for ports C0-C7, G0-G1, D0-D7, L0-L7 should not exceed 200mA. 3)The sum of all IOH, for ports G3-G4, B0-B7, H0-H7 should not exceed 200mA. 4)The sum of all IOH, for ports E0-E7, G5 should not exceed 100mA. 5)The sum of all IOH, for ports F0-F7, K0-K7 should not exceed 100mA. If IOH exceeds the test condition, VOH may exceed the related specification. Pins are not guaranteed to source current greater than the listed test condition.

All the hardware chips I am aware of use current sinks (pulling low) to perform PWM for LEDs. (TLC5490, WS2803, etc). Hence common anode per layer, and common cathode per column.