Glitching TLC5940

So i've made this big 1.2x1.2meter panel with 256led's:

It consists of strings of 4 (3v) leds in series, 4 strings next to each other, 16 strings "deep".
1 **** **** **** ****
2 **** **** **** ****
...
16 **** **** **** ****

I was trying to use 4 TLC5940's to control the 4 colomns of strings, but it was super 'glitchy', blocks of leds randomly turning on and off.

So i tried the same with 2 TLC's, but it's still kind of glitchy.

I'm using the Arduino Playground - TLC5940 library. And i've wired it up as the example for 2 tlc's shows, with 0.1 uF decoupling transistors between the vcc and ground from the tlc's.

What I mean with glitchy is; some strings go off instead of on, and some just go on and off randomly.

I'm planning on building the same thing 6 times as big, with 12 tlc's, and i've got everything i need so i'd really want it to work eventually, can anyone please help me?

I think to solve "glitchy" we would need to see the actual code you are using, and the way you have wired it up. Not just vague descriptions. It could conceivably be a power supply problem.

I'm using the "basicuse" example from the library, but with this void loop instead:

void loop()
{
  for (int channel = 0; channel < NUM_TLCS * 16; channel++) {
    Tlc.set(channel, 4095);
  }
  Tlc.update();
  delay(1000);
  for (int channel = 0; channel < 16; channel++) {
    Tlc.set(channel, 0);
  }
  Tlc.update();
  delay(1000);
}

Row "30" is inversed and row 31 is randomly going on and off.

I've got it wired the exact same way the picture the example shows, but with 12v and 4 leds instead of just one led..

If there is any more information i could give you i'd be more than happy to give it to you

Moderator edit: [code] ... [/code] tags added. (Nick Gammon)

Inevitableavoidance:
I've got it wired the exact same way the picture the example shows, but with 12v and 4 leds instead of just one led..

So does that mean your powering the TLC5940's from the Arduino 5v?

I've ran several TLC5940's direct from an Arduino like that and had no problems, but I'm usually only driving 4 LEDS at near 100% (for about 140mA peak).

If the unmodified BasicUse example works as expected, the next step would be to power the Arduino and TLC5940's from an external 5v source.

I hope this helps,

Brad.

Did you give each TLC5940 it's own decoupling capacitor?

with 0.1 uF decoupling transistors between the vcc and ground from the tlc's.

I think you mean capacitor not transistor.

Each chip needs a ceramic capacitor, not any other type, and it needs to be as close to the chip as possible. Also a single large value capacitor across the supply, something like 100uF will help as well.
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

Also short wires between the TLC and arduino help. Use a scope to look at the signals out of the TLC, is there any oscillation on the signals?

I meant capacitors, my bad.

I rewired the two TLC's from 2 breadboards to one, that seemd to solve it for the most of it, but that won't work with 12 TLC's with the bigger project. I'm powering the leds with a 12v power supply, and the TLC's with the 5v from the arduino, which is powered by usb.

Do i need to put the 100uF capacitor over the 12v power supply, or over the arduino's?

Inevitableavoidance:
I'm powering the [...] TLC's with the 5v from the arduino, which is powered by usb.

That's probably a bad idea. It would be better to use something like a 7805 fed from 12v and then passed to VIN on the arduino and TLC5940's.

Powering the TLC5940 from the Aduino is fine for a demo application but not what you should do in the real world.

FWIW,

Brad.

Thanks for the advice, would it be a problem if i used the 12v from the leds? or would that cause even more interference?

would it be a problem if i used the 12v from the leds?

That will increase the power dissipation in the TLC chip.

I'm powering the [...] TLC's with the 5v from the arduino, which is powered by usb.

To me that is fine, the TLCs don't take that much, as long as it is decoupled well.

Do i need to put the 100uF capacitor over the 12v power supply, or over the arduino's?

Well both would not go amiss, but put it on the 5V for preference.

I've only got 2 working TLC's atm, i'll recieve more monday, so I can't really test it now.

How would using 12v, with a 7805, like Brad said, increase the power dissipation if I may ask?

And if I would do that, could that cause more glitching since i'd be using the same power supply as the leds?

You said that

I'm powering the LEDs with a 12v power supply,

I took that to mean the anodes of the LEDs were being connected to 12V.

I'm a bit confused..

The anodes of the led's are connected to a 12v adapter.
The arduino is powered by usb.
The TLC's are powered by the arduino.

My question was:
Would using the 12v adapter with a 7805 to power the TLC's cause more glitching, since i'd also be powering the led's with it.

You then replied:

That will increase the power dissipation in the TLC chip.

Then I asked how that would happen. :stuck_out_tongue:

I'm now only using two TLC's on 1 breadboard and it's more or less glitchfree.
(I had 4 TLC's at the start, but damaged 2, so there's only 2 left.
New TLC's will arive monday.
There are 4 TLC's total supposed to be on this board, in the bigger end project, there will be 12)

Inevitableavoidance:
I'm a bit confused..

It appears everyone on this thread is confused.

Inevitableavoidance:
The anodes of the led's are connected to a 12v adapter.
The arduino is powered by usb.
The TLC's are powered by the arduino.

That's critical information that should bring everyone up to speed.

Inevitableavoidance:
Would using the 12v adapter with a 7805 to power the TLC's cause more glitching, since i'd also be powering the led's with it.

Your glitches are caused by lack of decoupling not lack of power.

Inevitableavoidance:
You then replied:

That will increase the power dissipation in the TLC chip.

Mike made the assumption your LED's were originally connected to 5V and that you were asking about connecting to 12V. He attempted to correct himself, but may not have been clear that is what he was saying.

Inevitableavoidance:
Then I asked how that would happen. :stuck_out_tongue:

The TLC5940 is a constant current source. It will drop whatever voltage is left over after the LEDs drop their forward voltage. The amount of current that flows through each output is the same. So if you had changed the LED's supply voltage then the TLC5940 would be dissipating more Power (Voltage * Current). This doesn't appear to matter in your case since you have always been powering the LEDs from 12V. The comments just caused confusion.

[quote author=Brad Burleson link=topic=99196.msg744146#msg744146 date=1333187444]
That's probably a bad idea. It would be better to use something like a 7805 fed from 12v and then passed to VIN on the arduino and TLC5940's.[/quote]
Don't misunderstand how the TLC5940 operates. It does not draw current from its Vcc to power the LEDs. It controls the amount of current allowed to flow through its outputs. All of the "high current" comes from whatever supply the LEDs are connected to, not the TLC5940. There's no reason to add another regulator when the Arduino's on-board regulator (or USB supply) can handle powering dozens of TLC5940s.

Wow, thank you a lot for making everything clear again. :slight_smile:

But, in the end, I won't have an arduino on usb anymore.
I'll just have an atmega328 on a board somewhere which I'll need to power, with maybe the same 12v source.

What I thought when I said

Would using the 12v adapter with a 7805 to power the TLC's cause more glitching, since i'd also be powering the led's with it.

was that the leds wil be going on and off a lot, so i thought that might interfere with other circuits running from the same 12v source.. or won't that be a problem?

By the way, would, theoretically, adding 1000 capacitors to a power source, change anything about the output?

Inevitableavoidance:
What I thought when I said

Would using the 12v adapter with a 7805 to power the TLC's cause more glitching, since i'd also be powering the led's with it

was that the leds wil be going on and off a lot, so i thought that might interfere with other circuits running from the same 12v source.. or won't that be a problem?

That's where decoupling capacitors can help.

Inevitableavoidance:
By the way, would, theoretically, adding 1000 capacitors to a power source, change anything about the output?

Adding 1000 capacitors doesn't matter. What matters is how much capacitance you have added (or the value of each of those 1000).

You need to strike a balance between having enough and not having too much. If you have too much, there will be a large amount of in-rush current when your circuit turns on, as all of the capacitance is charged. (Too much has a lot of "depends" in it. However, thousands of microfarads is probably a good line to watch.)

A 0.1uF cap near each IC's VCC is helpful to smooth out high frequency demands. Sometimes, it may be necessary to put something larger in parallel, like a 1.0uF. FYI, Even if you have 20 of these caps in your design, that's still less than half the capacitance as the bulk decoupling caps on the Arduino board itself.

Sometimes, it may be necessary to put something larger in parallel,

Aren't decoupling capacitors always parallel? Or is that the mistake i'm making?

It sounds like you are not sure what the decoupling capacitors are doing for you. Please read this:-
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

Aren't decoupling capacitors always parallel?

Yes

I'm now using a different power supply for the leds, and i encountered something odd.

When I change the voltage to a about 1.5v more, or 1.5v less than 12v, there is a lot less glitching..
Does this bring any more light to the problem?

Does this bring any more light to the problem?

Not really, it just points up that it is a decoupling issue. It is probably that the regulation on the power supply is different for the different voltages enabling the existing decoupling to cope with the interference.