TLC5940 Woes

Some of you might remember. I've been trying for a while to control 48 RGB LEDs with an Arduino. I'm still running into troubles, but I've learned a lot over the past year of tinkering with this stuff. I am having a problem now with a nice clean setup that I have made. I have put a lot of time into this project, and I would really like to see it succeed. :frowning: So, read on if you are interested in helping me out. Thanks.

After completing a smaller sized prototype on perfboard, I bought 3 Brilldea LED painters. Here is a circuit diagram. Here are some pictures of my project. I can take more pictures upon request, feel free to ask.

If anyone cares to help me troubleshoot, this is what I did:

  • I populated the painter boards with one 0.1?F capacitor, one 1.0?F capacitor, and one 2.2k? resistor for each TLC5940 chip. I put two 10?F capacitors across the VLED lines of each painter board. (This is suggested on Brilldea's website)

  • I connected the painters in a chain starting from the Duemilanove, so I had something like this:
    [Duemilanove] => 2ft of cables => [Painter1] => 3.5ft cables => [Painter2] => 3.5ft cables => [Painter3]
    My painter setup is a spitting image of the example on Brilldea's website.

  • I connected 16 RGB LEDs to the first and last painters only. Painter 2 had no LEDs connected. It only passed signal and power through to Painter 3.

  • I connected a 12V 500mA power supply to the Duemilanove via the barrel jack.

  • I connected a 5V 2A power supply to the VLED screw terminal on Painter 1 and continued it down the chain to the other two painter boards. (Again, there is not much to the design, I followed the example on Brilldea to a T)

  • The positive lines from both power supplies were connected to a DPDT switch so that both lines would be switched at the same time when the switch is in the ON position. The grounds from the Arduino, VLED, and the two power supplies were all tied together.

  • I used these RGB LEDs. According to my calculations (page 14), using a 2.2 K resistor, each RGB channel should be sinking about 17mA max. That's about what I read for current draw in my prototype. So, assuming all 48x3 channels are drawing maximum current, that's about 2.4 Amps. :drooling_face: I just realized that my 5v 2A supply is not sufficient if all of the lights are active. But, I only have 32x3 channels sinking current, since Painter 2 has no LEDs plugged in, right? That equals about 1.6 Amps max which is well below the limits of my 2A supply.

  • I couldn't manage to calculate the power dissipation of the TLC5940s because I am not sure what the value of dPWM is. dPWM is defined as the "duty cycle defined by BLANK pin or GS PWM value" (TLC5940 specs, page 15)

If it helps, the TLC5940s are rated to dissipate 2457mW at or below room temp, so I have:

P[sub]D[/sub] =  (V[sub]CC[/sub] * I[sub]CC[/sub]) + (V[sub]OUT[/sub] * I[sub]MAX[/sub] * DC[sub]n[/sub]/63 * d[sub]PWM[/sub] * N)
P[sub]D[/sub] =  (5V * 0.5A) + (5V * 0.017A * 4095/63 * d[sub]PWM[/sub] * 144)

Where N = 16*3 channels per board * 3 boards = 144 (This assumes all painter boards are full of LEDs)

So, maybe there's a power dissipation problem? I'll have to figure out the value of dPWM.

So, after all of this was finished. I ran a simple program to turn each channel on and off, one at a time:

#include "Tlc5940.h"

void setup()
{
  Tlc.init();
}

void loop()
{ 
    Tlc.clear();
    for(int i = 0; i < 143; i++) {
      Tlc.set(i, 4095);
      Tlc.update();
      delay(750);
      Tlc.set(i, 0);
      Tlc.update();
    }
}

Making sure of course, that NUM_TLCS was set to 9 in my tlc_config.h file. Also, testing my Duemilanove with a Blink sketch first to see that it ran okay. I later tested the project using an Arduino Mega, and I noted similar results.

The results were this:

  • I flipped the switch to ON.

  • The lights on the Painter 1 lit up randomly, some channels on, some channels off.

  • The lights on Painter 3 lit up randomly as well, but they were very dim.

This leads me to believe that at the very least there is a power supply issue. That would make sense to me if I had all 3 painter boards populated with LEDs or if I programmed all of the lights to turn on at the same time, but I have done neither of those things.

So, I am stuck. The possibilities I can think of are:

  • VLED power supply is insufficient
  • Too much power is being dissipated
  • TLC5940 chips are bad. (The lights can turn on, but the data is getting garbled somehow)
  • Both of my Arduinos are broken.
  • Signal cables aren't securely connected to the Arduino
  • Something else is going wrong that I don't know how to check for

I've tested all of these to the best of my ability. I will obtain a 5V 3A power supply, but I am doubtful that this will fix anything besides the dim LEDs on Painter 3. If anybody has the slightest clue about what could be going wrong, please let me know. This setup isn't very complicated, and I feel like it really must be a simple error to correct. I am so close! Thanks.

EDIT: I think it would also be good to note that I soldered breakaway header pins to the end of the ribbon cable. I am using those to connect to the pins on the Arduino. The pins feel a bit looser than the wires I normally stick into the Arduino pins, but I don't think that they aren't making a good enough connection.

EDIT 2: I've posted more pictures in that album.

Have you changed the TLC5940 library to use 9 chips (three on each painter).
The other thing to worry about is the distance:-

[Duemilanove] => 2ft of cables => [Painter1] => 3.5ft cables => [Painter2] => 3.5ft cables => [Painter3]

Some of those signals are going at high speed and I don't see any thing to buffer them in the circuit.

I wondered if distance would be a factor, but in the example on Brilldea's website they have a pretty significant length of ribbon cable between each painter. And if length of cable was an issue, I would think that the first painter board would at least function correctly, right? In any case, how would I go about buffering those signals?

On the bright side, I was just looking through those pictures I posted, and I noticed that Painter 3 was plugged in wrong. The ribbon cable was plugged into the OUT side instead of the IN side. I corrected that and all of the lights are bright now, but they're still displaying randomly.

I think I can rule out issues with the power supply, now. I'm going to try swapping out some of the chips later today, to see if that's the problem.

Oh, and I did change NUM_TLCS to 9 in tlc_config.h. I'm using Arduino in Ubuntu nowadays, though. Maybe I'll try it out in Windows just to be safe.

Thanks for the response, Mike. I know I wrote a lot, but it helps me to figure things out.

And if length of cable was an issue, I would think that the first painter board would at least function correctly, right?

Not necessarily. If you have a problem with reflections on the signal lines then it could affect the one closest to the signal source.
What happens if you disconnect all but one?
If is not so much a matter of buffering but rather that line impedance matching. You could try and put a pull up resistor at the far end.
You should try and look at the signals on a scope to see if they look right.

I unplugged the other painters so just Painter 1 was connected. It looked a bit different, so I replaced all of the TLC5940 chips on that board. Now it works great! I'm still waiting on more chips so I can test the whole system. In the mean time... When I run a program on just the first painter, it runs for a while and then crashes. This happens more often when I strobe all of the lights quickly then when I just leave them all on. Any thoughts? Thanks.

Need more decoupling, try a big bulk cap in addition to what you have already like 100uF or larger.

Across the LED supply or the Arduino supply? Or across the 5V supply coming out of the Arduino going to the TLCs? Again thanks for your help.

All are good but try it across the LED supply as close to the LEDs as you can get. If the LEDs are a long way from the TLC try the odd 100pf cap on the cathode to ground

I got a similar problem with my project. I use a cable length of about 1m but when I do this
the TLC5940 draws 1.2A from my 2A power supply what for me looks like a short cut. But when
the cable is shorter ~20cm all works fine.
What can I do to prevent this "short"? Do I have to put caps in between?

PS: Sometimes it even draws 300mA without an LED connected (I did even change the Chip same result)

Thx
Andy

It has to be said at the outset that these things are not designed to be on the end of a long wire.

Excessive current draw can sometimes happen when it is oscillation. It is not clear what is at the end of your long wire the TLC chip or the LEDs.

If it is the LEDs then a very small capacitor (50 to 100pf) from cathode to ground might work. Try only connecting on LED at a time and see when it starts.
If it is the chip at the end of the line then try a 0.1uF from +5 to ground as close to the chip as possible. Also try pull up resistors on the signal lines and maybe even protection on the chip inputs.
Protection details Protection

The stock tlc5940 Library is buggy - did this for me also. Theres some info on the old forum about it - I can't find it atm but someone wrote their own lib that solved it.

Is the buggy stock library you referenced this one written by Alex Leone?

Because that is the same library as the one on the old forum, and it is the library that I am using.

Or are you talking about a different library? Thanks.

Well, I don't think anything is wrong with the library. It more or less runs what I tell it to on a single painter board with 16 RGB LEDs. My problem comes when chaining the painter boards together. I've verified that each painter (3 TLCs per board) works fine individually. This means that there is trouble along that ribbon cable. It's good that the problem is more or less narrowed down to that, I suppose.

I just tried a few things and got some decent results. (Oh, I guess I never said, but my LEDs aren't very far from the boards. Maybe, 8 inches at most.)

I connected Painter 1 directly to Painter 3, so there was only about 3 feet of wire between them. That alone made Painter 3 function more closely to what I programmed; Painter 1 worked flawlessly. Then I tested out different capacitors across VLED/Gnd and Vcc/Gnd. The capacitors ranged from 1000?F to 0.1?F. I got the best results using a 0.1?F cap across Vcc/Gnd. Seems like I need some more decoupling, right?

The thing is, I already have 0.1?F and 1.0?F SMD caps across Vcc/Gnd for each chip, but they are very tiny. I could barely pick them up with a tweezers. I soldered them with a 15W iron, do you think I might have burned them up? Anyway, I'm considering putting 0.1?F caps in parallel across the smd caps on each chip.

Any thoughts? Thanks again for your help.

@mike: Oh, and were you suggesting putting a pull up resistor between the last pin's Signal Out and Vcc? Or which pins exactly? I wish I had a scope, but I won't be able to get my hands on one for a few weeks at best.

Yes - that library. Someone posted on the old forum that they had made some changes to solve the problem - I think on was to do with timings. I'll have a good search when I am at my pc.

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1286580054

@mike: Oh, and were you suggesting putting a pull up resistor between the last pin's Signal Out and Vcc? Or which pins exactly? I wish I had a scope, but I won't be able to get my hands on one for a few weeks at best.

Not serial out but serial in and also the clock and load pins. This is because the signals get weak at the ends.

@defsdoor: Thanks for the link. I just read through that post, and I'm hesitant to make those changes for two reasons:

  1. The poster talks about changing the XLAT and BLANK pins on the Arduino, but I don't see where he changes their pins in the code. I don't want to start making guesses on what I should be changing, since most of the timing code is over my head. :confused:
  2. I think he is using the multiplexing library.

It sounds like the changes could be beneficial, but I'm not confident enough to make those changes myself. Do you think that this could be causing a problem? The library seems to work well when I'm using 3 TLCs. It only gives me problems when there is a significant length of wire between the TLCs.

@mike: Ahh, yes I understand. Putting 10k pull-up resisitors from a signal wire to Vcc right before it enters the painter should help boost the signal if it's getting too weak as it travels across the wire. Is that right? Again, thank you. This project is soo close to coming together!

Pull ups on the signal lines, all of them really. Those tiny surface mount ceramics are better than the large ones with leads. If you have any more try putting then on top of the original ones to add extra capacitance. If you have them ceramics of 1uF or larger would be good.
Eight inches is a long way in electronics, the trouble I was having recently with spurious oscillations on the LED lines was caused by that sort of distance. Attached is a photo of what was happening.

I tested out two painters again. I added 0.1?F caps across each chip. I also put a 10k pull-up resistor between each of the signals and Vcc just before they entered the painter boards.

When I ran the program, the two LED arrays were more closely matched than they were before, but the first painter didn't work perfectly like it did the first time. Hmm. I not sure what to make of this. :confused:

EDIT: I tested the two painters once more, this time with a really short signal cable between them. I didn't really see any different results from before.

Can anyone explain to me what changes need to be made to the TLC code library? I can add that "IMPORTANT BIT" into the ISR function, but I'm not quite clear on what I need to do with BLANK and XLAT. Do I plug them into Analog Inputs 0 and 1 of the Arduino? If so, then isn't it bad thing to set their pinModes to OUTPUT? And, shouldn't the new pin numbers be assigned to BLANK and XLAT in the code? It just isn't very clear in that post. :confused:

Thanks once more for your help. I'm running out of possible problems, which is a good thing. There has to be a point where I have checked everything that could be going wrong. I can post a video of the painters in action if anyone cares to see it, just let me know.

The new pin must be declared, BLANK and XLAT are connected to analog 0 and 1, but used as digital pin 14 and 15. Fede