TLC5940 Library for the Arduino Due

Alex Leone wrote a library for the TLC5940 16 channel LED PWM driver for the AVR-based Arduinos ( However, since running the TLC5940 well requires delving into lower-level parts of the hardware like timer counters and interrupts, this library isn't immediately adaptable to the Due's ARM Cortex M3 microcontroller.

I've started a TLC5940 library that makes use of the features offered by the ARM processor. At least for now, this library doesn't offer all the fancy features that Alex Leone's library has (e.g. animations, fades, PROGMEM storage, etc.) because I didn't need those features. I have my own libraries for describing and running lightshows.

Since other people in the community might be interested, I created a Googly Code project for it:

Hopefully some will find this useful. ;)

  • Madeline

Surprised there has been no feed back on this, thanks Madeline. I haven't tried it yet but it looks great. Anybody else used it?

I haven't tried it yet but it looks great.

Thanks! I just improved the documentation a bit, both in the code files and on the Google Code project page. I also tweaked my previous post a tad so it's more clear that I made a library and not that I had a question about an existing one. The board I designed for the project that motivated this library is being depanelled at OSH Park so I should receive it soon! I'm excited. :)

  • Madeline


write a post about the library also here:

Excellent idea. I'll do that right now.

  • Madeline

Dear Madeline,

great jobs for writing the library for the due.

But i have some problems with it.(i'm new to arduino, perhaps thats why :cold_sweat:) I tried out your code with your example but it didnt work ;-( I am confused about how to connect the other pins, like the IREFF & DSCPRG. IREFF with 2k resistor to gnd? DSCPRG ?

Would be great if you could post how you connected all the pins of the tlc5940 to the arduino due in you example? Thanks!



Hi Madeline,

I am using your library and have got it working perfectly for a single TLC5940. However, when I try to daisy chain a second TLC5940, the performance of the first TLC5940 degrades (some of the smaller grayscale values result in no LED changes) and the second TLC5940 does not function at all.

I have connected the pins similarly to what comments in your code says, and have the the SOUT pin of the first TLC5940 connected to the SIN pin of the second TLC5940. I have also changed the number of TLC5940s to 2 in the due_tlc5940_config.h. Is there something else I could be missing?