TLC5940 with strange duty cycles?


I’m working on a large-ish scale RGB LED setup, I’m busy prototyping and testing to see if it will scale at the moment.

As the title tells you, I’m using the TLC5940 as a LED driver. My prototype setup consists of 16 RGB LED’s and then three TLC’s, one for each channel.

I’m lucky enough to have a scope here at home, I was testing something for the multiplexing I’m wanting to do, and I found something which seems to be a little odd.

I’m using the TLC library which is available somewhere on the arduino site, the same one everyone’s using, and I think it’s the latest version.

Anyway, what I see happening is that the duty cycle when the brightness should be full is only 50%. I’m running a little piece of code which goes through all of the duty cycles and the cycle on the scope never hits 100%, which I had assumed would be the case when that channel was written with the full brightness (4095).

Here’s a section of the code:

for (int j=0;j<4095;j++){    

Any help would be appreciated in trying to understand this odd behaviour!


Ah, that might have been a little unclear.

I was testing the voltage at the LED ground pin, or the TLC output (same thing).

What I see on the scope is the value ramping from 0 to 50% duty cycle. What the program is doing in that time is outputting values from 0 to 4095. This causes me to assume that when I tell it to output at 4095, it results in a 50% duty cycle.

I've also tried going from 0 to 8191 and what I see is that when it should be outputting values higher than 4095 it wraps around (4096 == 0 etc).

This makes me pretty sure that it is in fact going from 0 to 4095 and not, for instance 0 to 2047 twice.

Obviously I can't see anything with my eyes aside from the brightness changing, as the PWM is too fast.


Hi, ok: it's linearly interpolated, smooth from 0 to 50%. When the brightness is 2047 the duty cycle is 25% and it's a proper square wave.

Essentially all duty cycles are half of what you would expect them to be.


Hi, I'm using this library:

which is linked to from here (towards the top of the page):

As far as I know, quite a few people have used that library, which worked for them. I'm just not sure that anyone has actually looked at what it does on a scope.

If the problem lies with the library then it could be a problem with the activation of the BLANK pin, which I'll look into on the scope in a few minutes.


After having looked into the scope readings, I’m pretty sure that the library is doing the right thing. When I look at the data channel and the latch (SIN and XLAT) I can see what the readings are. When, for example, the brightness that should be displayed is 4095 (maximum), the SIN stays high the whole time (logical, the bytes are all 1’s).

So I guess the obvious question is: Do any other people have TLC5940 setups, and a scope to look at the system through? Or, can anyone tell me what I might be doing wrong?


Well, it looks like no-one can answer my question...

It would be interesting to see if anyone can reproduce the results I'm seeing.