Paja

Icon

Rapid prototyping for music, art and design work

TLC 5940 – PWM Driver

TLC 5940 PWM driver can control up to 16 LEDs. You can dim each LED separately. It also allows to cascade multiple TLC 5940 PWM driver thus you can have more than 16 LEDs multiplied with the IC. As I need 60 LEDs, I am cascading 4 of them. As I understand, it communicates with SPI with a couple of additional wires. There is a Arduino library for TLC5940 which comes with good example sketches. I have attached basic schematic and Arduino code to test multiple TLC5940.

Texas Instruments TLC5940 on Arduino Playground
http://www.arduino.cc/playground/Learning/TLC5940

Arduino TLC5940 library

TLC5940 library reference

TLC5940 datasheet

To control multiple TLC5940 ICs, you need to modify tlc_config.h file in the library.

#define NUM_TLCS 1 -> 2 (amount of TLC5940)

Arduino code (uses only core functions)

Arduino code (with additional class for fading animation)

 

Schematic for cascaded TLC5940

Registor at Pin 27 on TLC5940 can be 4.7K instead of 2K.

Issue with Wire.h

There has been an issue when you use wire library with TLC5940 library. For instance, I couldn’t read DS1307 Real time clock IC which use I2C interface while control LEDs with the TLC5940 library. This has been raised as an issue on TLC5940 Arduino library wiki but there isn’t further discussion on it.

http://code.google.com/p/tlc5940arduino/issues/detail?id=10

Issue with SPI

TLC5940 library use SPI pins (Digital 13, 12 and 11pins) by default as it uses SPI in the library. However, I couldn’t communicate DS3234 Real Time Clock IC which also uses SPI interface while controlling LEDs with the library. By using Bitbang mode instead SPI default mode for data transfer, TLC5940 will not use the same SPI defaut pins. The default SPI pins can be given only to DS3234. The Bitbang mode assigns the following pins:

BLANK -> D10
SCLK -> D4
SIN -> D7
XLAT -> D9
GSCLK -> D3
XERR -> D6 (XERR is not enabled by default in the library thus you can ignore it. Arduino code remains as the same.)

To change the mode, you need to modify tlc_config.h as follow:

#define DATA_TRANSFER_MODE    TLC_SPI  —> #define DATA_TRANSFER_MODE    TLC_BITBANG

 

 

Facebook Twitter Email

Category: Snippets

Tagged:

Comments are closed.

Social links powered by Ecreative Internet Marketing