Hi,
I have been trying to get the tlc5940 to work with high current leds in combination with a npn transistor and a constant current regulator, and have some issues, which makes me wonder if I am doing something wrong either on the hardware side or the software side (already posted a similar post in the tlc5940 library thread without any replies).
I had no problems getting the tlc to work with 16 normal eds and using the "basic use" sketch from the examples.
I want to use it for LEDs which draw more current than what the tlc5940 can handle, and after some research here in the forums I found two solutions, either using a mosfet or a NPN transistor.
I decided to go with the NPN solution.
I hooked up 5 high current leds (3W, drawing 700mA each) on the first five channels, and used normal leds for the rest of the channels.
I used a 10k pull-up resistor for each of the high current channels, each channel connected to a tip122 (through a 1k resistor) which again is connected to the led and a constant current regulator (LM317).
The Iref resistor is 2k (so about 20mA current from the tlc5940).
See the schematic for more details.
http://www.bek.no/~hc/downloads/powerled_schematic.png
As exected the values are reversed so 0 is on and 4095 is off.
I made an extremely simple sketch, first one with only turning on/off channel 0, the first of the high current leds.
The led turned on/off as expected. However, the other channels behaved strangely, going on and off more or less randomly (at least I haven´t found a logic to it yet), often many of them turning on/off at the same time.
When I expanded the sketch to turn on/off all the high current leds in a sequence, they behaved as expected, but again, now and then the other channels behaved strangely.
Today I hooked up 6 more, so a total of 11 leds, and this produced some very inconsistent results, so I don´t know where I am doing something wrong.
Here is the simple test code I used with the five leds:
#include "Tlc5940.h"
void setup()
{
[shighlight]Tlc[/shighlight].init();
// I added these two lines to see if it helped, but they didnt make a difference
[shighlight]Tlc[/shighlight].clear();
[shighlight]Tlc[/shighlight].update();
}
void loop()
{
tlcflash(0);
tlcflash(1);
tlcflash(2);
tlcflash(3);
tlcflash(4);
}
void tlcflash(int [shighlight]tlc[/shighlight]) {
[shighlight]Tlc[/shighlight].set([shighlight]tlc[/shighlight], 0);
[shighlight]Tlc[/shighlight].update();
delay(1000);
[shighlight]Tlc[/shighlight].set([shighlight]tlc[/shighlight], 4095);
[shighlight]Tlc[/shighlight].update();
}
thanks for any input.
hc