Issues with a TLC5490-powered LED matrix

Hi all,

My project involves a matrix of 49 LEDs powered by 4 daisy-chained TLC5490’s. I’m using an Duemilanove as my controller. The TLC5490s are wired using the instructions that come with Alex Leone’s Arduino/TLC5490 library, and each LED is directly driven by a TLC5490 output (no multiplexing). I’ve run the “knight rider” test program that comes with the Arduino/TLC5490 library, which just lights up the LEDs individually one at a time (actually 3 at a time, with the middle one the brightest and one dimmer one on each side to improve the animation). This all works as expected either powering the Arduino over USB or via a compatible wall-wart that I purchased from Adafruit. When I light up all of the LEDs at once at 1/4 power, they’re each drawing 6.6mA as evidenced by my multimeter, which means that my total draw is around 6.6 * 49 + a little bit for the Arduino, which comes out to around 325 mA, which my computers USB port should have no problem with, which it doesn’t – the whole board lights up. What’s weird is that when I light them up using a program which turns on the next LED in the sequence with a delay of 500ms before moving on, it acts normally, but then after lighting about 30 LEDs, the rest of them turn on very rapidly – not instantaneously, but with only a few ms delay between and it doesn’t seem to be consistent. The code is very simple; the main loop is:

int pins[] = {
  54,51,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,30,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,41,42,53,55,59,49,47,43};

void loop(){
  for (int channel = 0; channel < sizeof(pins); channel++) {
    Tlc.set(channel[pins], 1024);
    Tlc.update();
    delay(500);
  }
}

This turns on one more LED every 500 ms at an intensity of 1024 (out of 4095). Why they suddenly start lighting up very rapidly after lighting up 20 LEDs seems very strange to me. It doesn’t matter which 30 LEDs it is, either – if I run the loop the opposite direction, it lights up the 30 LEDs on the other end of the board before doing the same behavior. This is unexplained strange behavior number one.

The second thing I can’t figure out is if I power the board with my wall-wart, running the same program. This time, the board lights up LEDs as expected until it hits the 20th LED or so, at which point the Arduino seems to reset – the next light doesn’t come on, sometimes there’s some weird light flickering, and then they all go off and it starts over again with the matrix completely unlit and the lights start coming on again one at a time. I have measured that my wall-wart is putting out a constant 9.3V (under no load, just using the voltmeter on the circular plug, and VCC remains at a steady 5V throughout the entire process, from power on through lights coming on to the Arduino resetting to it starting the sequence over again. When I measure the voltage when its powered by USB from my computer, it starts at around 4.97V when no LEDS are on, and slowly drops as the lights come on, ending up around 4.82V when the whole board is lit up.

I’m a bit stumped. Any suggestions on what I should test or any indications of what the problem might be would be most welcome. Thanks!

I think these:
for (int channel = 0; sizeof(pins); channel++)
Tlc.set(channel[pins], 1024);

Should be:
for (int channel = 0; channel < sizeof(pins); channel++)
Tlc.set(pins[channel], 1024);

Good catch -- I modified the code a little bit for clarity before posting (to switch it from running from the top of the pin array to the bottom) and I made a typo. Fixed it in my post.

You've still got channel[pins] instead of pins[channel]

Why not power the LEDs directly with a 5v supply form the wall, with some decoupling capacitors on the chips? I find that the Arduino is really funny when using several TLCs drawing current from it, I just power them direct now.

scswift: You've still got channel[pins] instead of pins[channel]

You're right about that being mistyped, but the compiler actually figures this one out and it doesn't cause an issue. Stupid oversight but I don't think it's causing my other problems.

Demonic69: Why not power the LEDs directly with a 5v supply form the wall, with some decoupling capacitors on the chips? I find that the Arduino is really funny when using several TLCs drawing current from it, I just power them direct now.

Could you explain a little further? I'd think that I could get a 5V power supply and a barrel jack to power the TLC5490's, but if I connect the Arduino to that then I'm supplying 5V, outside of the operating range of 6-20V (and the recommended range of 7-12V). It would obviously be preferable to not have two power supplies, too.

markneub: Could you explain a little further? I'd think that I could get a 5V power supply and a barrel jack to power the TLC5490's, but if I connect the Arduino to that then I'm supplying 5V, outside of the operating range of 6-20V (and the recommended range of 7-12V). It would obviously be preferable to not have two power supplies, too.

I believe he's suggesting that you connect 5V from an external power supply to the Arduino's 5V input pin. The recommended range is for external power applied via vin (or the barrel jack) to the on-board regulator. You should be able to power the Arduino with an external regulated 5V source.

I hope this helps,

Brad.

I think I had a similar problem. Do the leds flicker like they do in this video I made?

http://www.youtube.com/watch?v=mp--r8kpDrw&list=UUHu8bZRR72LZA43ex8DMREg&index=4&feature=plcp

That’s one way, or you could split off a 12v supply, send one side to the barrel jack for the arduino and one side to an LM7805 or similar to provide a dedicated supply to your TLCs.
I think the best way would to be build a bare-bones arduino and run both the TLC and the Atmega from a regulated 5v supply.
Either way make sure you’re using some decoupling on the chips.

Unhappy elf, that must be the most complicated set of components I’ve seen for a TLC so far, are they common cathode LEDs and you’re converting? Are there resistors on each channel?

So just to make sure I understand this properly, the idea is that if I hook the Arduino and the TLC's to the same regulated 5V power source, I should put some decoupling capacitors in between the TLC and the power so that if higher draw from the TLC's causes the voltage to drop intermittently (or if the power supply itself is just a little finicky), then I'll be continuing to provide a clean 5V to the Arduino?

I have an idea for another solution which is clunky, but I don't think it would that expensive and might not be a terrible idea since I have a lot of extra space inside the housing of my project. I could just get a 5V power supply with a barrel jack and power my TLCs with that and power the Arduino separately with the 9V supply I already have (using the onboard regulator). Then I have two wall-warts for my project which is obviously not ideal, but i could just plug them both into a multi-socket extension cord inside the housing and feed the cord out the back. If I go this route, is there still any need for decoupling capacitors between my 5V source and the TLCs, or is that just important if the TLCs and the Arduino are sharing a power source? Thanks for all your help

markneub: If I go this route, is there still any need for decoupling capacitors between my 5V source and the TLCs, or is that just important if the TLCs and the Arduino are sharing a power source? Thanks for all your help

You should always place a 0.1uF ceramic cap at each TLC5940 in-between the power and ground pins.

Cheap and easy insurance.

I hope this helps,

Brad.

You’re right about that being mistyped, but the compiler actually figures this one out and it doesn’t cause an issue.

The compiler isn’t smart enough to figure something like that out. If it compiles, what it’s probably doing is grabbing random memory at a start address defined by the value of channel, which just so happens to coincide with where your pins array is store in memory.

In other words, pins[0] is at address pins+0. pins[1] is at address pins+1. pins is a pointer to a memory location, and tells it how far ahead of that to pull a value from. pins in this case is possibly equal to 0 since it is the first variable you defined.

So if the compiler is allowing you to do channel[pins], what is happening is instead of grabbing values from pins+channel you are grabbing values from channel+pins.

Which I suppose in this case might work, but if you were to do something like: channel[pins*2] then all hell would break loose.

Thanks for the explanation, scswift. That makes sense and I’ll definitely update my code just to make sure that it doesn’t cause any problems.

Just in case anyone is interested, here’s a video I made of my project: http://www.youtube.com/watch?v=___XwMbhV4k

As you can see it is functional, but it only works on USB power right now (computer bus power or AC to USB adapter) and I’d like to use a normal wall-wart, and it is a little finicky, locking up sometimes. Besides that, I want to get to the bottom of the weirdness I described above for my own sake :slight_smile: I’ll post an update when I make some changes to it.

Demonic69: Unhappy elf, that must be the most complicated set of components I've seen for a TLC so far, are they common cathode LEDs and you're converting? Are there resistors on each channel?

Yes there are current limiting resistors on each channel and PNP transistors controlling the LED's. I was a question on Amps. The TLC can old supply or sink so much, and with the amount of LED's I wanted to use the transistors became necessary.

Sorry for the thread hijack OP.

Does it seem reasonable that I could power the TLC5490's with just something like this? http://www.sparkfun.com/products/8269

(and use a barrel jack adapter like http://www.sparkfun.com/products/119)

and throw in those decoupling capacitors between VCC and GND on each TLC? This is assuming I completely decoupled the Arduino from this circuit and had it powered separately. It seems like it would be fine to me, but if anyone has any experience on the matter and wants to comment it would be much appreciated. Thanks again!

markneub: Does it seem reasonable that I could power the TLC5490's with just something like this? http://www.sparkfun.com/products/8269

(and use a barrel jack adapter like http://www.sparkfun.com/products/119)

and throw in those decoupling capacitors between VCC and GND on each TLC? This is assuming I completely decoupled the Arduino from this circuit and had it powered separately. It seems like it would be fine to me, but if anyone has any experience on the matter and wants to comment it would be much appreciated. Thanks again!

Yes I know this will work. I had it set up like this until I started using a Computer PSU to power my system. The only thing you need to do, other than what you said is tie the grounds together(the Arduino gnd and tlc power supply).

The only thing you have to worry about (apparently) is a possible spike from the 5v wall-wart destroying the TLC. I've not tested it but there are plenty on the forums that say that a wall-wart supply is not 100% guaranteed to be a clean 5v and may spike, especially at power on. I'm pretty sure a capacitor or 2 could solve this though, but don't quote me on it :D The project looks great btw!