Go Down

Topic: Library for TLC5940 16-channel PWM chip (Read 91860 times) previous topic - next topic


Very cool!  Are you just using serial to send data to the Arduino now?

As for dmx, you can use the Atmega168's USART (serial) module in receive mode.  It supports the start/8 data bits/2 stop bits protocol of dmx, you just have to set the baud rate.  (see the atmel datasheet).  I don't know of an ic off the top of my head that converts from 2.5/-2.5V into a digital 0/5V signal, but I'm sure you can find one.


Yep all done over serial, infact is stupidly simple, im just pumping #[0]-[100]; for the signal level.

I belive the SP485 (http://www.datasheetcatalog.org/datasheet/sipex/SP481CN.pdf) can do the conversion, these are used in the Open DMX Usb along with FTDI's FT232 to provide a crude dongle.


Nov 19, 2008, 01:17 pm Last Edit: Nov 19, 2008, 01:18 pm by Grumpy_Mike Reason: 1
In case you haven't seen it here is what I did with an early version of the library. Acleone - big thanks to you.
To do:-
I have to hack into "Arduino serial" to add extra OSC commands to handle colour and implement them in the Arduino.
I have to finish the web site with all the construction details.

But in the mean time have a look at the video


Half way through you get to see the colours.


Does this last update make it possible to use more than 10 TLC's daisy-chained (due to the uint8 var) ?


Yes, the limit is now 16.  If you still need more, I can make a custom version of the library.


Cool! Thanks! 16 is sufficient for my next project.


This library is fantastic.  I've slowly been daisy-chaining chips together (as I'm something of a newbie) , and this explains why I can't get past 16 chips.  If you're honestly interesting in making a custom version of the library, a version that supports 20 TLCs would be great...


I have to finish the web site with all the construction details.

I saw that you did. I really enjoy the way you explain your works. Nice, clear and clean!


Happy Thanksgiving!  Have an update: Tlc5940_latest.zip

  • Tlc.init() sets all channels to zero and updates.
  • Added TLC_PWM_PERIOD and TLC_GSCLK_PERIOD to tlc_config.h
  • Added TLC_CHANNEL_TYPE to tlc_config.h - Now the library supports 4096 TLCs!  (if TLC_CHANNEL_TYPE is uint16_t)
  • Changed the examples to use TLC_CHANNEL_TYPE
  • set DATA_TRANSFER_MODE default to TLC_SPI

Since the DATA_TRANSFER_MODE is now TLC_SPI, be sure to change your hardware setup (or just set it back to TLC_BITBANG in tlc_config.h, then delete Tlc5940.o):
  • Arduino Digital Pin 11 (used to be pin 8) -> TLC pin 26
  • Arduino Digital Pin 13 (used to be pin 7) -> TLC pin 25


Nov 28, 2008, 07:48 am Last Edit: Nov 28, 2008, 07:50 am by reflect9 Reason: 1
Thnx acleone for many updates!

Anybody tried the lastest version of library?   'cause mine doesn't work.  only the first TLC5940 chip works (and it gets hot) but others brink pseudo-randomly.   It worked fine with the previous versions.

for checking : The library is for arduino-0012, isn't it?
for checking : What I have to change is just reordering pin settings?


sorry.  I forgot to delete tlc5940.o file.    it seems work fine until now!


does this only work on the arduino with a atmega168 ? or will it work on my older atmega8 board ?


Here's an Atmega8 version:  Tlc5940__Atmega8_latest.zip

(I should have probably used preprocessor directives, but then I would have had to change all my horrible pin-out diagrams).  Tell me if it works!  The BasicUse example has hardware setup.


cool, thanks for that. I'll give it a shot over the weekend. I'll give you feedback.

Thanks again  :)


wanted to give a big thank you for the library, i look forward to using it soon.

Go Up