Driving A 10x10x10 RGB Cube

I am still having serious doubts now about these chips being fast enough to drive the cube.

Well it is not the chip but the entire arduino.
Also depending on how you do it the on / off ratio of the LEDs is not going to be very good, meaning the brightness will be compromised dramatically. You would have a 100 to 1 duty cycle. I have used a 4 to 1 duty cycle and found that quite limiting. You need to boos the current to the LEDs to compensate but the TLC5940 won't drive that much current even if yor LEDs can take it.

This was my 8 by 8 RGB LED matrix all be it in a strange layout.
http://www.thebox.myzen.co.uk/Hardware/Hexome.html

Do you know how fast you need to go? Have you done the maths?

Grumpy_Mike:
You would have a 100 to 1 duty cycle.

(You mean 10 to 1...?)

Grumpy_Mike:
Do you know how fast you need to go? Have you done the maths?

Let's do it:

300 LEDs per layer means he'll need 19 driver chips. At 24 bytes of data per chip that makes 456 bytes per layer, 3648 bits total.

The SPI bus can send a byte in 17 clock cycles (see thread a couple of weeks ago). The Arduino runs at 16mHz so he can send that much data over 2000 times per second even with a bit of overhead for processing/sequencing.

He can cut the TLC5940's PWM cycle short at the end of each transmission, latch the PWM data and start on the next layer. With ten layers he can update the cube 200 times/sec. - a perfectly acceptable rate.

Grumpy_Mike:
You need to boos the current to the LEDs to compensate but the TLC5940 won't drive that much current even if yor LEDs can take it.

It can drive 120mA per pin, that ought to be enough to overdrive a LED a little bit. :slight_smile:

(You mean 10 to 1...?)

Well no, I was assuming, and said, that he was going to multiplex so that one column of one plane would be on at any one time. Now if you are going to drive it with 300 LEDs in one plane all on at the same time then yes it is only 10 to 1. However that means he will have to have 300 / 16 = 19 TLC5940 to drive it. While not impossible, there needs to be some signal buffering going on, proper construction and good layout. It is not something you are going to make on bread board.

It can drive 120mA per pin

Yes that is the current, now work out the power dissipation that will cause in the chip and you will find you can't run the chip at that current.

fungus:
300 LEDs per layer means he'll need 19 driver chips. At 24 bytes of data per chip that makes 456 bytes per layer, 3648 bits total.

The SPI bus can send a byte in 17 clock cycles (see thread a couple of weeks ago). The Arduino runs at 16mHz so he can send that much data over 2000 times per second even with a bit of overhead for processing/sequencing.

He can cut the TLC5940's PWM cycle short at the end of each transmission, latch the PWM data and start on the next layer. With ten layers he can update the cube 200 times/sec. - a perfectly acceptable rate.

These calculations look correct, based on the fact that you can send a byte in 17 clock cycles. I'm a bit skeptical though, because adding a delay of more than 10 in the code above causes the lights to flicker/blink. I'd like to see where you found that, could you post a link?

Grumpy_Mike:

(You mean 10 to 1...?)

Well no, I was assuming, and said, that he was going to multiplex so that one column of one plane would be on at any one time. Now if you are going to drive it with 300 LEDs in one plane all on at the same time then yes it is only 10 to 1. However that means he will have to have 300 / 16 = 19 TLC5940 to drive it. While not impossible, there needs to be some signal buffering going on, proper construction and good layout. It is not something you are going to make on bread board.

Maybe not a breadboard...but a perfboard, maybe? Last time I tried to make a large pcb at home using toner transfer it was a real challenge...I'm hoping not to have to resort to that again.

Grumpy_Mike:

It can drive 120mA per pin

Yes that is the current, now work out the power dissipation that will cause in the chip and you will find you can't run the chip at that current.

I only need to drive the LED's at 20mA or less, so this shouldn't be a problem.

Grumpy_Mike:

It can drive 120mA per pin

Yes that is the current, now work out the power dissipation that will cause in the chip and you will find you can't run the chip at that current.

You could if the supply voltages are very close to the LED voltages...:slight_smile:

But realistically, no, you can't do 120mA per LED with a 5V supply.

OTOH if we assume an average 1.8V excess voltage per LED (ie. a 5V supply with R=2.2V, G+B=3.6V) you can do 60mA which is in the right ballpark for a project like this. Total dissipation per chip would be ~1792mW. The chip can do that easily.

Grumpy_Mike:
While not impossible, there needs to be some signal buffering going on, proper construction and good layout. It is not something you are going to make on bread board.

Yep, it's an awful lot of chips+wires. No arguments there.

mnpumar:
I'm a bit skeptical though, because adding a delay of more than 10 in the code above causes the lights to flicker/blink. I'd like to see where you found that, could you post a link?

To simulate the final LED brightness/flicker at 100Hz you need to turn the LED on for 10ms then off for 90ms. Putting "delay(10)" in that code doesn't do that.

nb. Any code which doesn't synchronize to the TLC5940's PWM cycle won't represent the final result.

mnpumar:
I only need to drive the LED's at 20mA or less, so this shouldn't be a problem.

Normally you drive them harder to compensate for the fact that they're only on for 1/10th of the time.

LEDs have a power rating (watts) and a maximum 'pulse' current (mA), see the datasheet for your LED for details. You can go higher then 20mA so long as you don't exceed either of those ratings.

Well in designing my 5x5x5 led cube, I used a 2 millisecond timer interrupt to set-up my scanning of the cube, so five levels at 2 millisec each gives me a 10millisec update cycle time and I detected no flicking at all. As far a ma drive level for the leds Vs scan rate, I simple used shift registers that contain built in constant current (sinking) output pins which made the whole brightness thing a no worry situation. Each 16 bit register (I used 2 series connected) uses a single 'programming' resistor to set the desired constant output current value for all the output pins (I set for 20ma) and the performance is great, led brightness is the same no matter if a single led or all 125 are being lite up.

Lefty

retrolefty:
I simple used shift registers that contain built in constant current (sinking) output pins which made the whole brightness thing a no worry situation.

RGB cubes are more complicated, they need PWM control for setting the colors...

fungus:

retrolefty:
I simple used shift registers that contain built in constant current (sinking) output pins which made the whole brightness thing a no worry situation.

RGB cubes are more complicated, they need PWM control for setting the colors...

Depends on how many colors you want to be able to display. Simple on/off to each RGB led terminals should be able to have 7 colors plus all off. It's kind difficult to obtain near infinite colors outputs as well as near constant brightness in the same scanning algorithm I would think and add a lot of complexity to the sketch for the desired pattern/display coding. I think simple on/off controls to the 3000 led elements is the way to go, certainly for ones first attempt.

Lefty

retrolefty:
Depends on how many colors you want to be able to display. Simple on/off to each RGB led terminals should be able to have 7 colors plus all off. It's kind difficult to obtain near infinite colors outputs as well as near constant brightness in the same scanning algorithm I would think and add a lot of complexity to the sketch for the desired pattern/display coding.

I'm not sure there's a massive difference in complexity between 7 colors and PWM. The wiring is almost identical, the software will be very similar (but with a lot more data).

retrolefty:
I think simple on/off controls to the 3000 led elements is the way to go, certainly for ones first attempt.

Yep. Reading between the lines it seems like he should probably make something smaller to get some practice with electronics, TLC5940s, Arduino programming, etc.

it seems like he should probably make something smaller to get some practice with electronics, TLC5940s, Arduino programming, etc.

Let's face it. The OP is never going to make a 10 X 10 X 10 cube, it is one of those over ambitious things a newcomer wants to do. It is a lot more complex than just getting the right circuit and wiring it up. I wouldn't attempt this myself and I have got a bit of experience. I would say that there is over six months of work here.

Just thought i'd throw this in, im using a HEF4067BP to drive 8 x 7 seg displays, it's a 1 of 16 channel switch

http://www.nxp.com/documents/data_sheet/HEF4067B.pdf

Grumpy_Mike:
I would say that there is over six months of work here.

I don't know if it's that much ... maybe a month of snipping/soldering and another of programming.

What major problems do you see in the electronics? I don't really see any apart from switching 15A of power on/off quickly (Separate 5V PSU with lots of capacitors on the output? Thick wires for all GND connections?)

fungus:

Grumpy_Mike:
I would say that there is over six months of work here.

I don't know if it's that much ... maybe a month of snipping/soldering and another of programming.

What major problems do you see in the electronics? I don't really see any apart from switching 15A of power on/off quickly (Separate 5V PSU with lots of capacitors on the output? Thick wires for all GND connections?)

Having built a 5x5x5 cube, while finding designing, building, debugging the hardware challenging it was at least something I enjoyed and progress was mostly trouble free. The software was another kettle of fish however. The basic scanning of the cube was pretty simple but I found that the 'creative part' of coming up with interesting pattern shows was so very very tedious and very time consuming and I soon lost interest after defining about six basic patterns including a simple random pattern using a RNG. What I really longed for was a PC based GUI pattern editor that I could use to 'visually' build patterns, scan by scan, and then be able to upload the pattern into the arduino driven cube. But of course my PC software skills would never allow me to write such a application. So now when I watch cube being demonstrated on U-tube or wherever, I've really come to appreciate the artistic effort that some have mastered. So in effect the software is the biggest overall factor is the quality of the finished project.

Lefty

What major problems do you see in the electronics?

As you said:-

from switching 15A of power on/off quickly

(Separate 5V PSU with lots of capacitors on the output? Thick wires for all GND connections?)

If it were only that simple.

Grumpy_Mike:

(Separate 5V PSU with lots of capacitors on the output? Thick wires for all GND connections?)

If it were only that simple.

Four power wires to each layer (at the corners...)? Decoupling on each one?

Grumpy_Mike:

it seems like he should probably make something smaller to get some practice with electronics, TLC5940s, Arduino programming, etc.

Let's face it. The OP is never going to make a 10 X 10 X 10 cube, it is one of those over ambitious things a newcomer wants to do. It is a lot more complex than just getting the right circuit and wiring it up. I wouldn't attempt this myself and I have got a bit of experience. I would say that there is over six months of work here.

Excuse me, but you don't know me well enough to make that judgement. First of all, I have a degree in Electrical Engineering and I have a very good work ethic. When I decide to do something, I do whatever it takes to accomplish my goals. I've already made an 8x8x8 cube and fabricated my own PCB at home. The kind of things we are discussing here are not the kind of things that one learns in college, they are specific to a platform I am currently unfamiliar with. I am asking for advice from people who have more experience in areas I do not, that doesn't mean I'm stupid or unwilling to put the work in myself. I've already bought most of the parts, fabricated a jig, and straightened most of the wires. I expect this project to take a few months, and I'm ok with that. I'm here to learn and I'm willing to listen to your advice, but please don't make such unfair assumptions.

Excuse me, but you don't know me well enough to make that judgement.

True I don't but I have answered enough questions to make a guess.

First of all, I have a degree in Electrical Engineering

Fine so do I.

that doesn't mean I'm stupid

I never said, nor implied you were. However some of your responses suggest that you have less experience than you are implying you have by your last post.

I've already bought most of the parts

That is what worries me. You need to make a realistic prototype of a tiny corner of what you plan, run it at the rate the real thing will run before you know if your design is feasible.

I've already made an 8x8x8 cube

Good so you know what is involved with 500 LEDs, now you want to scale it up to 3000. Scaling up is not easy, you don't just make more. There are lots of things to consider with switching so much current so quickly. I would have thought the TLC5940 was not the best choice as you have to synchronise the multiplexing to the refresh rate.

Best of luck with your project. Please post in the exhibition section when you have it working.

Grumpy_Mike:

What major problems do you see in the electronics?

As you said:-

from switching 15A of power on/off quickly

(Separate 5V PSU with lots of capacitors on the output? Thick wires for all GND connections?)

If it were only that simple.

15A!? Please double check your math. Each layer is 10x10, with 3 pins per LED, for a total of 300 pins. Each pin will drive a max of 20mA, 300x20mA = 6A. I'm planning to use this power supply to drive the LED's: 5V 10A switching power supply : ID 658 : $29.95 : Adafruit Industries, Unique & fun DIY electronics and kits. With large enough decoupling caps between Vcc and Gnd on each chip, this shouldn't be an issue. Not really sure what your issue is here. I also bought high power mosfets rated for 100V and 40A to handle the switching. http://www.irf.com/product-info/datasheets/data/irf5210pbf.pdf I probably won't be running the LED's at the full 20mA anyways, since it might be too bright to look at.

That is what worries me. You need to make a realistic prototype of a tiny corner of what you plan, run it at the rate the real thing will run before you know if your design is feasible.

I plan on building a 4x4x4 with a scaled version of the circuit and to practice different techniques of assembling the cube. However, it's hard to tell from a smaller version if something this large will work because I won't be hitting the same limitations.

Good so you know what is involved with 500 LEDs, now you want to scale it up to 3000. Scaling up is not easy, you don't just make more. There are lots of things to consider with switching so much current so quickly. I would have thought the TLC5940 was not the best choice as you have to synchronise the multiplexing to the refresh rate.

I thought they would be a better choice than shift registers because I have to chain together a large amount of IC's. I used shift registers for my 8x8x8. If I use shift registers I would need to drive a much faster clock through the board to manually handle the PWM. What do you think is the best choice and why?

Best of luck with your project. Please post in the exhibition section when you have it working.

Will do, but getting there will not be trivial, and I appreciate the guidance from those who are more experienced in this area than I am. I'm considering making a build thread to document my progress for those who are interested.

Having built a 5x5x5 cube, while finding designing, building, debugging the hardware challenging it was at least something I enjoyed and progress was mostly trouble free. The software was another kettle of fish however. The basic scanning of the cube was pretty simple but I found that the 'creative part' of coming up with interesting pattern shows was so very very tedious and very time consuming and I soon lost interest after defining about six basic patterns including a simple random pattern using a RNG. What I really longed for was a PC based GUI pattern editor that I could use to 'visually' build patterns, scan by scan, and then be able to upload the pattern into the arduino driven cube. But of course my PC software skills would never allow me to write such a application. So now when I watch cube being demonstrated on U-tube or wherever, I've really come to appreciate the artistic effort that some have mastered. So in effect the software is the biggest overall factor is the quality of the finished project.

Lefty

I'm a verification engineer, so my job involves both hardware and software, so I'm not really worried about the software side. I will make a GUI for this, and I have a few other ideas planned as well. That being said, what I am concerned about is the low-level code on the MCU to handle the multiplexing of all the layers. There are libraries available that I can adapt to my needs, but I don't know if they will be fast enough to handle what is essentially a 300x10 matrix.

That being said, what I am concerned about is the low-level code on the MCU to handle the multiplexing of all the layers. There are libraries available that I can adapt to my needs, but I don't know if they will be fast enough to handle what is essentially a 300x10 matrix.

I don't think you have anything to worry about on that issue. I can't prove it with math right now but you only have to be a little faster the human's eye perseverance which is pretty wimpy, and a 16 Mhz 328p can push a lot of bits in the time required, I would have little fear in that. As I said I used the Mstimer2 interrupt library to setup a basic 2 millisecond 'window' to shift out all 25 bits via the shift registers for each level. You will have to shift out 300 bits per heart beat and then switch to the next level, so maybe a 1 millisecond interrupt window to shift 300 bits. You may have to work with direct port manipulation commands for the output data shifting rather then using digitalWrite() commands, but I think you will be OK.

So look up POV timing and do some math on bit shifting. I too certainly would want to have a handle/confidence on that before applying solder to 1,000 RGB leds. :wink:

Lefty