Electronics

PWM Control of 3 LEDs with 1 Wire using Texas Instrument's TLC59731

2016-05-08 11:12

I/O pins are notorious on short supply on MCU's.

So what do you do if you have only one to spare and a number of chanels you want to PWM control?

I found this little fellow, that only uses one digitial output pin to control a basically infinit number of PWM chanels.

Hardware

The schematic is simle enough.

I put the circut on an ARDUINO UNO R3 shield (together with some other suff I'm currently playing around with), shown here sitting on top of a Cypress CY8CKIT-042-BLE Poineer Kit.

Protocol

If you only have one wire to control multiple PWM chanels the complexity has to go into the protocol.

Turns out the protocol is not difficult to understand, only the datasheet of the TLC59731 is (at least was for me).

So I decided to hook up my logic analyser and start playing around with the information of the datasheet.

I find things so much easier to understand if I can see what is going on on the wire.

The wire protocol - It's all about the right timing:

The higher protocol:

Software

Once understood the protocol is not hard to implement.

This is the example for the Cypress CY8CKIT-042-BLE, that uses the Cypress CY8C4247LQI-BL483 PSoC.

You can download the source from my GitHub project page. If I have found the time already, you might also find the source for other platforms there.

Source code explained:

The pictures above show the results of this program.