Go Down

### Topic: Flickering LED’s at various frequencies using TLC5940 + Arduino (Read 1 time)previous topic - next topic

#### inci

##### Sep 19, 2011, 02:12 pm
Hi guys,

We are trying to generate flickering LED's at a wide range of temporal frequencies (0.5-200 Hz) using TLC5940 and Arduino (with Teensy++ board). We want the brightness of our 16 LED's to be sinusoidally modulated over time at a desired frequency (using PWM).  Currently, our code stores a brightness table (a sinewave) as a template. For different temporal frequencies, we first define how many millisecond it will take for a single period (i.e. 1000 ms for 1 Hz). We then read the current time (millis) and find at what phase on this sinewave the index should be for that particular moment in time to meet that defined frequency. We then set the brightness value to that particular index. We seem to have no problems with frequencies higher than 10 Hz. But somehow there seem to be non-linearities at lower frequencies and the frequencies are not generated correctly, either, at those low frequencies.

We thought it might be related to how long each PWM and GSCLK periods last and tried various different values (keeping their relation correctly) for TLC_GSCLK_PERIOD and TLC_PWM_PERIOD (We did it by changing the values manually on the config file). But it did not serve a solution for our problem.

What do you think the problem might be and how to solve it?

Any help would be so much appreciated!

Thank you very much!

inci

#### mxc1090

#1
##### Sep 30, 2011, 04:20 pm
The brightness/current relationship is some sort of logarithmic scale.  At lower currents the LEDs will change brightness more rapidly with respect to current and at high currents the LED brightness will not change noticeably.

#### Grumpy_Mike

#2
##### Oct 05, 2011, 02:59 pm
To get a linear change in brightness you will have to look at gamma correction:-
http://en.wikipedia.org/wiki/Gamma_correction
and
http://www.cgsd.com/papers/gamma_intro.html
and apply this to your brightness table.

Quote
We seem to have no problems with frequencies higher than 10 Hz.

It is because it is too fast to notice at higher frequencies but it is still their.

Go Up