PWM (Tlc5940) values are not linear and saturate midrange

PWM Val 0 250 500 750 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2020 2040 2041 2042 2043 2044 2045 2050 2100 4095
Voltage 12 11.86 11.33 10.58 9.27 8.84 8.26 7.67 7.09 6.51 5.92 5.35 4.79 4.21 3.7 3.6 2.84 2.47 1.56 0.45 0.05 0.002 0 0 0

1 Like

Thanks Nate for documenting. Will be curious to see why this is happening. Can you measure the voltage coming into the transistor (see schematic below, pin 1) to see if that that is from the TLC5940 chip or the transistor?

Measuring pin1 to pin2 of the transistor (gate to ground)

PWM Val 0 1000 1500 4095
Voltage 3.3 1.65 0.85 0

So this means that it’s the Tlc5940 itself right? Because the voltage I measured using the multimeter shouldn’t drop that quickly

Tagging @ezirayw. We’ve talked about this in the past. Ezira has o-scope traces coming off the Tlc at various input values.

I didn’t save the traces since I decided to ditch using intermediate PWM value. But if I remember correctly, the PWM duty cycle didn’t reflect what you’d expect given a certain Tlc input on the arduino, which lead to the voltages not being correct. I think it has to do with how the Tlc library is designed to communicate with the chip because the datasheet indicates that it should be proportional.

https://www.ti.com/lit/ds/symlink/tlc5940.pdf?ts=1643314201710 (page 20)

1 Like

It might be worth looking into the library and checking to see if arduino inputs are communicated properly

1 Like

Hello, there!

Did you figure out what was the issue? I’m having the same problem

Hey Eduarda! Sorry this has yet to be a critical issue for us, so no one has gone through the libraries to figure out the fix.

Hey @danhart if you’re talking to the EDF anyway, any chance you can get them to fix this?

1 Like

Hi everyone,

I wanted to provide some updates on a solution to the half-range aspect of this issue that was recently figured out in the Khalil lab!

The details can be found in this merged pull request on GitHub, but in summary, there were several parameters of the microcontroller timer configuration that were either erroneously hard-coded and/or mis-documented. I’ve reworked the parameterization that is accessible via the tlc_config.h file in the Tlc5490_SAMD library to make the system use the entire possible range of PWM values.

Additionally, I’ve added some comments in that same file that more thoroughly explain what each parameter is doing and provide several oscilloscope-validated timing configurations at various frequencies.

To use this fix, you can pull the latest code from the evolver-arduino repository and install the latest version of the Tlc5490_SAMD library on your arduino boards.

While this explains and fixes the issues of midrange saturation found while using the old configuration, it doesn’t seem to address the non-linear output observed in @Nate_Borders’ data. One hypothesis we’ve come up with for that aspect of the issue centers on the hardware design of the PWM power delivery circuit itself.

The TLC5490 PWM chip used in this circuit delivers output in fixed current mode per the spec sheet, as it’s designed to be capable of directly driving LEDs. However, when we look at power MOSFET circuit in the schematic here, we see that the output of the TLC5490 is directly connected to the gate of the MOSFET in what looks like a voltage control configuration. With the pullup resistor to 3.3V attached at this node, it seems like the voltage isn’t well defined which may explain the observed nonlinearity.

Since the project is heavily fitted to using the TLC5490, we’d need a circuit capable of linearly converting current to voltage. A transimpedance amplifier seems like overkill…maybe just a voltage divider would work?

2 Likes