skip navigational linksPJRC
Shopping Cart Checkout Shipping Cost Download Website
Home MP3 Player 8051 Tools All Projects PJRC Store Site Map
You are here: Teensy Teensyduino Libraries Tlc5940

PJRC Store
Teensy 3.6, $29.25
Teensy 3.5, $24.25
Teensy 3.2, $19.80
Teensy LC, $11.65
Teensy 2.0, $16.00
Teensy++ 2.0, $24.00
Main Page
Getting Started
How-To Tips
Code Library

Tlc5940 Library

Tlc5940, by Alex Leone, interfaces with one of more TLC5940 chips from Texas Instruments. Though expensive, each chip provides 16 PWM outputs with 12 bit resolution, and built in current limiting for directly driving LEDs without resistors.

Download: Included with the Teensyduino Installer
Latest Developments on Github

Tlc5940 works on Teensy 3.6, Teensy 3.5, Teensy 3.2, Teensy 3.1, Teensy 3.0, Teensy 2.0, Teensy++ 2.0, and Teensy++ 1.0.

Tlc5940 does not support Teensy LC or Teensy 1.0.

The special servo motor mode (tlc_servo.h) only works on Teensy++ 2.0, and Teensy++ 1.0.

Hardware Requirements

Tlc5940 test board. Wiring details shown below

The TLC5940 chip (PDF) requires only 2 resistors and connects to Teensy using 5 signals.

Teensy 3.x
Teensy 2.0
Teensy++ 1.0
Teensy++ 2.0
VPRG, GND27, 22Connect to GND
DCPRG, VCC19, 21Connect to +5V
IREF20Connect 2.2K resistor to GND
Must be
output mode
as PWM
--424, 2724, 27
* The BLANK pin should have a 10K resistor connected to +5V.

Several TLC5940 chips may be used. The SOUT signal (pin 17) of each connects to the SIN (pin 26) of the previous chip, and GSCLK, BLANK, XLAT, SCLK are connected in common to all chips.

Example Programs

Tlc5940 includes several examples, available from the File > Examples menu.

File > Examples > Tlc5940 > BasicUse

File > Examples > Tlc5940 > Fades

Peripherals Used

Tlc5940 uses the SPI port and 2 timers. The MISO pin is not used. The SS pin may only be used as an output. Timer1 and Timer2 are used on Teensy++. On Teensy, Timer1 and Timer3 are used. Some PWM pins associated with these timers are either used by the library. The others may be used as input or output, but not as PWM (analogWrite).

Wiring and Pinout Info


For more details, please refer to the official Tlc5940 page, or this older page.

For development on Tlc5940 for Teensy, please refer to this Github repository: