Hi All,
I'm Alan Trevennor, I'm a technical author and I am from the UK.
I'm creating a project for a book. This uses an AVR microcontroller and the Arduino TLC5940 library created by Alex Leone to provide the basic drive for the TLC. The project requires the TLC to drive up to ten single LEDs in non-multiplexed mode. Of course the reason for using the TLC5940 is so that these can be faded in and out using the PWM features of the chip. The GSCLK is being provided by extending the MCU's 8 MHz clock out - and yes this is a symetrical square wave. The PWM values being sent go from end to end (0 to 4095). The dot correction feature is disabled VPRG = Low, DCPRG = HIGH
It all works fine, except that the LEDs are not as bright as they should be. Which brings me to my question.
Is the formula in the datasheet based on any assumption on how the load is wired? I want 20ma forward current through each LED to get them on good and bright and so I have used the calculation:
( 1.24 / 0.020 ) x 31.5 = 1,953
to get to the need for a 2K resistor on IREF. Looking around on various forums and circuit diagrams, most people seem to have arrived at the same value for 20ma LEDs. My problem is that, at PWM value of 4095 (and putting the + side of each LED onto +5V) the LEDs were very un-bright. For comparison, I rigged up an identical LED connected to +5V through a 270R resistor (i.e. about 19ma) and that was much, much brighter than the ones hung off the TLC.
I took the IREF resistor down to 1.2K which was a bit better, but nothing like the full brightness of the direct connect LED. As I had a spare 5940, I decided to go nuts and tried a 680R resistor off IREF - and that is pretty nearly as bright as the comparison LED. Now, the TLC is ever so slightly warm to the touch, but not in any distress at all.
So, I am puzzled as to why the formula gives me a resistor value that seems perhaps four times as high as it seems I need. My maths is abysmal, but I think I got that one right? Perhaps the formula assumes some kind of other usage for the chip? Of course, the library code I am using is a bit of a black box, but loads of people seem to have used it and I have not found anyone referencing this brightness thing as an issue. If I can get confirmation that I am understanding the datasheet correctly then I can go pester the library code author in case the problem is in there somehow.
Thanks in advance for any thoughts or suggestions.
Alan T
Your TLC5940 IREF resistor calculation is correct. 1.92kohm will set a maximum LED current of 20mA. This assumes the dot correction regsiters are properly programmed and that you have a high enough voltage supply to the LEDs to properly drive them. It is best if you measure the LEDs forward current to understand why you have less brightness than you expect. You may have less peak current than you expect, or the duty cycle (PWM dimming) may be lower than you expect. You can measure put a resistor in series with the LED and differentially measure the voltage across it with an oscilloscope to understand your actual LED current.