# TLC5947 and TLC59711 PWM LED Driver Breakouts

## Overview

The TLC59711 and TLC5947 breakout boards are ideal for applications requiring precise control of lots of LEDs.

![](https://cdn-learn.adafruit.com/assets/assets/000/012/655/medium800/leds_drivers.jpg?1386106353)

The **TLC59711** can control 12 separate channels of 16-bit PWM output. This is the highest-resolution PWM board we've seen!

![](https://cdn-learn.adafruit.com/assets/assets/000/012/683/medium800/leds_1455_LRG.jpg?1386162007)

The **TLC5947** has even more channels. It can control 24 separate channels with 12-bit PWM output.

![](https://cdn-learn.adafruit.com/assets/assets/000/012/682/medium800/leds_1429_LRG.jpg?1386161839)

Both boards have a 2 or 3-pin SPI interface. Our library lets you use any two (TLC59711) or three (TLC5947) free pins to drive them. Best of all, you can chain multiple boards together to control hundreds or thousands of LEDs!  
  
Outputs from these boards are constant-current and open drain. You can drive multiple LEDs in series. One resistor is used to set the current for each of the outputs, the constant current means that the LED brightness doesn't vary if the power supply dips.   
  
We supply these with a 3.3K resistor for about 15mA per channel. But you can solder a thru-hole resistor over it if you'd like to change that value

# TLC5947 and TLC59711 PWM LED Driver Breakouts

## Assembly

## Assembly:
These boards come fully assembled and tested. We include optional header strips in case you want to use these on a breadboard. These take just a few minutes to install. For use in a breadboard, it is easiest to have the control connections on top of the board and the led connections on the bottom as shown below: ![](https://cdn-learn.adafruit.com/assets/assets/000/012/501/medium800/leds_2013_09_08_IMG_2159.jpg?1385561416)

## Soldering the Headers
Use the breadboard to hold the parts in position for soldering. ## Position the header
Cut to size first if necessary![leds_2013_09_08_IMG_2143-1024.jpg](https://cdn-learn.adafruit.com/assets/assets/000/012/502/medium640/leds_2013_09_08_IMG_2143-1024.jpg?1385561604)

![leds_2013_05_02_IMG_1741-1024.jpg](https://cdn-learn.adafruit.com/assets/assets/000/012/503/medium640/leds_2013_05_02_IMG_1741-1024.jpg?1385561638)

## Position the board
Remember to place it upside down if you want the pins to end up on top.  
  
_ **Hint** : A spare piece of header placed under the breakout board will help keep things aligned for soldering._  
![leds_2013_09_08_IMG_2145-1024.jpg](https://cdn-learn.adafruit.com/assets/assets/000/012/504/medium640/leds_2013_09_08_IMG_2145-1024.jpg?1385561738)

## And solder!
Be sure to solder all pins for good electrical connection.  
  
If you are new to soldering, check out the [Adafruit Guide to Excellent Soldering](http://learn.adafruit.com/adafruit-guide-excellent-soldering)![leds_2013_09_08_IMG_2142-1024.jpg](https://cdn-learn.adafruit.com/assets/assets/000/012/505/medium640/leds_2013_09_08_IMG_2142-1024.jpg?1385561841)

## Repeat for the other side
Flip the board over and repeat the process for the LED headers on the bottom of the board.![leds_2013_09_08_IMG_2159.jpg](https://cdn-learn.adafruit.com/assets/assets/000/012/508/medium640/leds_2013_09_08_IMG_2159.jpg?1385562048)

# TLC5947 and TLC59711 PWM LED Driver Breakouts

## Connecting to the Arduino

These boards communicate using an SPI protocol. The wiring is slightly different for the two boards, so we will describe them separately. For making breadboard connections with the header pins on top of the board, a set of [male-female jumpers](http://www.adafruit.com/products/826) are handy.  
  
The pin configurations below are consistent with the example code supplied with the libraries:

# 24-Channel TLC5947
![](https://cdn-learn.adafruit.com/assets/assets/000/030/828/medium800/leds_2014_01_12_IMG_2895.jpg?1456878246)

Connect to the Arduino as follows:

- **DIN -\> Digital 4**
- **CLK -\> Digital 5**
- **LAT -\> Digital 6**
- **GND -\> GND**
- **V+ -\> VIN**

Here we show V+ connected to the Arduino VIN pin. This will power the breakout board and LED directly from the supply connected to the DC power jack. The TLC5947 can accept a V+ of 5v-30v. Higher voltages allow you to drive multiple LEDs in series from each channel.  
  
The **DIN/CLK/LAT** pins can be changed to any other pins later

Danger: 

# 12-Channel TLC59711

You've got _two options_ for powering/wiring your TLC59711

1. LEDs&nbsp; **V+** and logic level **VCC** connected together to 3 - 5V
2. LEDs **V+** at 4-17V and logic level&nbsp; **VCC** at 3.3V

If you need to use it with a 5V logic UNO, you can **do either of the following two wiring diagrams:**

Connect V+ and VCC to 5VDC (this is the best and easiest option)

![leds_tlc5v.png](https://cdn-learn.adafruit.com/assets/assets/000/038/139/medium640/leds_tlc5v.png?1482969261)

Connect V+ to 4-17V and keep VCC disconnected. Then use 10K resistors or a level shifter between the clock and data wires going into the _first_ of the TLC59711

![leds_tlc_highv.png](https://cdn-learn.adafruit.com/assets/assets/000/038/140/medium640/leds_tlc_highv.png?1482969309)

If you are using a 3.3V logic Arduino, you have two wiring options:

Keep **VCC** disconnected, and connect **V+** to **4-17V**

![leds_tlc3v.png](https://cdn-learn.adafruit.com/assets/assets/000/038/142/medium640/leds_tlc3v.png?1482969593)

Connect **VCC** and **V+** together to 3.3V (if a 4V+ power source is not available)

![leds_just433v.png](https://cdn-learn.adafruit.com/assets/assets/000/038/143/medium640/leds_just433v.png?1482969692)

Other than that, connect to the Arduino as follows:

- **DI -\> Digital 11**
- **CI -\> Digital 13**
- **GND -\> GND**

**The DI/CI pins can be changed to any other pins later**

Danger: 

# Chaining Boards
Multiple boards can be chained to control hundreds of LEDs. Using an Arduino, you will run out of memory long before you exceed the chaining capacity of these boards!  
  
Header connections at both ends of the board make chaining simple. Our [6-Conductor 0.1" Socket-Socket Cable](http://www.adafruit.com/products/206 "Link: http://www.adafruit.com/products/206") is perfect for linking them together.

![leds_2013_12_06_IMG_2268-1024.jpg](https://cdn-learn.adafruit.com/assets/assets/000/012/719/medium640/leds_2013_12_06_IMG_2268-1024.jpg?1386345454)

![leds_2013_12_06_IMG_2269-1024.jpg](https://cdn-learn.adafruit.com/assets/assets/000/012/720/medium640/leds_2013_12_06_IMG_2269-1024.jpg?1386345486)

The next two pages will show you how to connect some LEDs and test them out with the library example sketch:

https://vine.co/v/hxr7aTb9TAL

# TLC5947 and TLC59711 PWM LED Driver Breakouts

## Power and LEDs

## Connecting Monochrome LEDs
Note that one leg of the led is longer than the other. This is the Anode and should be connected to the V+ hole in the board.![leds_2013_09_08_IMG_2157-1024.jpg](https://cdn-learn.adafruit.com/assets/assets/000/012/661/medium640/leds_2013_09_08_IMG_2157-1024.jpg?1386107004)

![leds_2013_09_08_IMG_2158-1024.jpg](https://cdn-learn.adafruit.com/assets/assets/000/012/663/medium640/leds_2013_09_08_IMG_2158-1024.jpg?1386107035)

## Off-Board Mounting
For more flexibility in positioning LEDs, you will probably want to connect your LEDs with wire instead of soldering them directly to your breakout board.   
  
Our [Pig-Tail Cables](http://www.adafruit.com/products/1003) make remote mounting of individual LEDs very simple.  
  
You can also install headers onto the PCBs, then plug the pig-tail socket there, and solder the LED legs to the wire ends - whatever makes sense for your project  
  
_ **Tip:** One strand of the pig-tail is marked in gray. Solder this to the V+ side to mark the polarity._![leds_2013_12_06_IMG_2271-1024.jpg](https://cdn-learn.adafruit.com/assets/assets/000/012/716/medium640/leds_2013_12_06_IMG_2271-1024.jpg?1386344614)

![leds_1003_LRG.jpg](https://cdn-learn.adafruit.com/assets/assets/000/012/717/medium640/leds_1003_LRG.jpg?1386344937)

![leds_2013_12_06_IMG_2274-1024.jpg](https://cdn-learn.adafruit.com/assets/assets/000/012/718/medium640/leds_2013_12_06_IMG_2274-1024.jpg?1386344964)

## Connecting RGB LEDs
Output channels are conveniently arranged in groups of 3 to simplify connecting RGB leds.   
  
The common anode (longest lead) should be soldered to one of the V+ holes (any one will do)  
  
When working with a breadboard, connect V+ to the bus on the edge of the breadboard and plug the anode into the bus.![leds-1024.jpg](https://cdn-learn.adafruit.com/assets/assets/000/012/657/medium640/leds-1024.jpg?1386106641)

![leds_2013_09_08_IMG_2156-1024.jpg](https://cdn-learn.adafruit.com/assets/assets/000/012/658/medium640/leds_2013_09_08_IMG_2156-1024.jpg?1386106819)

![leds_2013_09_08_IMG_2155-1024.jpg](https://cdn-learn.adafruit.com/assets/assets/000/012/659/medium640/leds_2013_09_08_IMG_2155-1024.jpg?1386106855)

## Multiple LEDs in Series
The wide voltage range and constant current drive makes it simple to drive multiple LEDs in series from any channel. Just be sure to choose a supply voltage is higher than the sum of the Vfs of all the leds in series.   
  
For example: To drive 5 blue LEDs in series, you would need at least **3.2v \* 5 = 16v**. This voltage is within the range of either the TLC59711 or the TLC5947.  
  
![leds_2013_09_08_IMG_2161-1024.jpg](https://cdn-learn.adafruit.com/assets/assets/000/012/664/medium640/leds_2013_09_08_IMG_2161-1024.jpg?1386107180)

# Powering your LEDs

For running as many as 8 channels of RGB or 24 channels of single LEDs, you can usually get by borrowing power from the Arduino as shown. If you plan on running more LEDs with these boards, you should start thinking about how to power them.

## Constant Current

Both the TLC59711 and TLC5947 are constant current drivers. This is just what LEDs need. Since they are constant current, you have some flexibility with the supply voltage and you don't don't need to add current limiting resistors. The TLC59xxx drivers will adjust automatically to power supply fluctuations. Your LEDs won't flicker and you don't have to worry about burning them out. We have configured these breakouts to set the current level at 15mA per channel. This is a safe level for virtually all leds you might want to connect to them.   
  
To operate at different currents, it is possible to replace the on-board reference resistor with a through-hole resistor. These drivers are capable of driving up to 60mA (TLC59711) or 30mA (TLS5947)&nbsp;per channel. The graphs in the data sheets show the relationship between resistance and output current.  
  
[TLC59711 Data Sheet](http://www.adafruit.com/datasheets/tlc59711.pdf "Link: http://www.adafruit.com/datasheets/tlc59711.pdf")  
[TLC5947 Data Sheet](http://www.adafruit.com/datasheets/tlc5947.pdf "Link: http://www.adafruit.com/datasheets/tlc5947.pdf")

## Choosing a Supply Voltage
Since these are constant current drivers, the voltage selection is not so critical. It just needs to be slightly higher than the forward votage (Vf )of your LEDs.   
  
**Supply Voltage Range:**  

- **TLC5947 - 5v to 30v**  
- **TLC59711 - 5v to 17v**  

**Typical LED Vf by Color:**  

**- Red 2.1v  
- Yellow 2.2v  
- Green 3.2v  
- Blue 3.2v  
- White 3.2v**

# Connecting an External Supply
If you do decide you need an external supply for your LEDs:  

- First remove the connection between V+ and VIN from the Arduino.  
- **Be sure to keep the connection between GND and the Arduino GND.**
- Next connect the negative terminal of your supply to GND on the breakout.
- Finally, connect the positive terminal of your supply to V+ on the breakout.

# TLC5947 and TLC59711 PWM LED Driver Breakouts

## Programming - Library Reference

# Install The Library
To use these boards, first download and install the library using one of the buttons below. If you are new to Arduino Libraries, check this guide for instructions on how to install them:  
  
[http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use](http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use "Link: http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use")[Adafruit TLC59711 Library Download](https://github.com/adafruit/Adafruit_TLC59711/archive/master.zip)
[Adafruit TLC5947 Library Download](https://github.com/adafruit/Adafruit_TLC5947/archive/master.zip)
# Run the Example Code
  
Wire your breakout and connect some LEDs as shown on the previous pages. Load the example code for your breakout board:  
  
**File-\>Examples-\>Adafruit\_59711-\>tlc59711test**  
or:  
**File-\>Examples-\>Adafruit\_5947-\>tlc5947test**  
  
And run. If you are using RGB LEDs, the code will cycle through some colors to demonstrate the capabilities of the board. https://vine.co/v/hxr7aTb9TAL

# TLC5947 Library Reference:
**Adafruit\_TLC5947(uint8\_t n, uint8\_t c, uint8\_t d, uint8\_t l)**  
Call the constructor to create an instance of the TLC5947 PWM breakout driver.  

- n = Number of Drivers (\>1 if the drivers are chained)  
- c = Clock pin  
- d = Data pin  
- l = Latch pin  

  
**boolean begin(void);**  
Call begin just once in your setup() function to initialize the devices.  
  
**void setPWM(uint8\_t chan, uint16\_t pwm);**   
Call this to set the PWM level for a channel.  

- chan = Channel  
- pwm = PWM level (0 = minimum, 4095 = maximum)  

  
**void setLED(uint8\_t lednum, uint16\_t r, uint16\_t g, uint16\_t b);**   
Call this to set the RGB value for a group of 3 channels  

- lednum = LED number (channel number of the "red" pin divided by 3)  
- r = red level  
- g = green level  
- b = blue level  

  
**void write(void);**  
Call this after every change to write the new PWM levels to the device. # TLC59711 Library Reference:

**Adafruit\_TLC59711(uint8\_t n, uint8\_t c, uint8\_t d);**  
Call the constructor to create an instance of the TLC59711 PWM breakout driver.

- n = Number of Drivers (\>1 if the drivers are chained)
- c = Clock Pin
- D = Data Pin

**Adafruit\_TLC59711(uint8\_t n);**  
Alternate consturctor for hardware SPI. Assumes hardware SPI pins for MOSI and SCK.  
  
**boolean begin(void);**  
Call begin just once in your setup() function to initialize the devices.  
  
**void setPWM(uint8\_t chan, uint16\_t pwm);**   
Call this to set the PWM level for a channel.

- chan = Channel
- pwm = PWM level (0 = minimum, 65535= maximum)

**void setLED(uint8\_t lednum, uint16\_t r, uint16\_t g, uint16\_t b);**   
Call this to set the RGB value for a group of 3 channels

- lednum = LED number (channel number of the "red" pin divided by 3)
- r = red level
- g = green level
- b = blue level

**void write(void);**  
Call this after every change to write the new PWM levels to the device.

# TLC5947 and TLC59711 PWM LED Driver Breakouts

## Python & CircuitPython

It's easy to use the TLC5947 and TLC59711 with Python or CircuitPython, and the&nbsp;[Adafruit CircuitPython TLC5947](https://github.com/adafruit/Adafruit_CircuitPython_TLC5947)&nbsp;and&nbsp;[Adafruit CircuitPython TLC59711](https://github.com/adafruit/Adafruit_CircuitPython_TLC59711)&nbsp;modules.&nbsp; These modules allows you to easily write Python code that controls the PWM outputs of these boards.

You can use this driver with any CircuitPython microcontroller board or with a computer that has GPIO and Python [thanks to Adafruit\_Blinka, our CircuitPython-for-Python compatibility library](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).

# CircuitPython Microcontroller Wiring

First wire up your board exactly as shown on the previous pages for an Arduino.&nbsp; For example here's how to wire a TLC5947 to a Feather M0 using a standard hardware SPI connection:

- **Board GND/ground** to **driver GND**
- **Board USB/5V** to&nbsp; **driver V+** and **RGB LED anode** (longest leg).
- **Board SCK** to&nbsp; **driver CLK**
- **Board MOSI** to&nbsp; **driver DIN**
- **Board D5** to **driver LAT** (or use any other free digital I/O).
- **RGB LED red leg** to&nbsp; **driver output 21** (or any other output).
- **RGB LED green leg** to **driver output 22** (or any other output).
- **RGB LED blue leg** to&nbsp; **driver output 23** (or any other output).

You might need to check your RGB LED's datasheet to find which legs are the red, green, blue inputs (or just experiment with turning them on off to find out).&nbsp; The longest leg will always be the anode, or positive voltage input.&nbsp; Be sure you're using a **common anode** and **not common cathode** &nbsp;RGB LED!

![adafruit_products_m0_tlc5947_bb.png](https://cdn-learn.adafruit.com/assets/assets/000/050/624/medium640/adafruit_products_m0_tlc5947_bb.png?1534875484)

If you're using a TLC59711 here's how to wire it to a Feather M0 again using a standard SPI connection:

- **Board GND** to **driver GND**
- **Board USB/5V** to&nbsp; **driver V+, driver VCC,** and **RGB LED anode** (longest leg).
- **Board SCK** to **driver CI**
- **Board MOSI** to&nbsp; **driver DI**
- **RGB LED red leg** to **driver output R3** (or any other R output).
- **RGB LED green leg** to **driver output G3** (or any other G output).
- **RGB LED blue leg** to&nbsp; **driver output B3** (or any other B output).

Again you might need to check your RGB LED's datasheet to find which legs are the red, green, blue inputs (or just experiment with turning them on off to find out).&nbsp; The longest leg will always be the anode, or positive voltage input.&nbsp; Be sure you're using a **common anode** and **not common cathode** &nbsp;RGB LED!

![adafruit_products_m0_tlc59711_bb.png](https://cdn-learn.adafruit.com/assets/assets/000/050/625/medium640/adafruit_products_m0_tlc59711_bb.png?1534875561)

Info: 

# Python Computer Wiring

Since there's _dozens_ of Linux computers/boards you can use we will show wiring for Raspberry Pi. For other platforms, [please visit the guide for CircuitPython on Linux to see whether your platform is supported](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).&nbsp;

Here's the Raspberry Pi and TLC5947 wired with SPI:

&nbsp;

- **Pi 5V** to **driver V+**  
- **Pi GND** &nbsp;to&nbsp; **driver GND**
- **Pi MOSI&nbsp;** to&nbsp; **driver DIN**
- **Pi SCLK** &nbsp;to&nbsp; **driver CLK**
- **Pi GPIO5** to&nbsp; **driver LAT** (or use any other free digital I/O).
- **RGB LED anode leg** to&nbsp; **driver V+&nbsp;**
- **RGB LED red leg** to&nbsp; **driver output 1** (or any other output).
- **RGB LED green leg** to&nbsp; **driver output 2** (or any other output).
- **RGB LED blue leg** to&nbsp; **driver output 3** (or any other output).

Check your RGB LED's datasheet to find out which legs are red, green and blue, or experiment with turning them on and off to find out. The longest leg will always be the anode, or positive voltage output. Be sure you're using a **common anode** and **not common cathode** &nbsp;RGB LED!

![adafruit_products_raspi_tlc5947_spi_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/059/518/medium640/adafruit_products_raspi_tlc5947_spi_bb.jpg?1534875983)

Here's the Raspberry Pi and TLC59711 wired with SPI:

- **Pi 5V** to&nbsp; **driver V+, driver VCC**  
- **Pi GND** &nbsp;to&nbsp; **driver GND**
- **Pi MOSI&nbsp;** to **driver DI**
- **Pi SCLK** &nbsp;to&nbsp; **driver CI**
- **RGB LED anode leg** to&nbsp; **driver V+**
- **RGB LED red leg** to **driver output R0** (or any other R output).
- **RGB LED green leg** to&nbsp; **driver output G0** (or any other G output).
- **RGB LED blue leg** to **&nbsp;driver output B0** (or any other B output).

Check your RGB LED's datasheet to find out which legs are red, green and blue, or experiment with turning them on and off to find out. The longest leg will always be the anode, or positive voltage output. Be sure you're using a **common anode** and **not common cathode** &nbsp;RGB LED!

![adafruit_products_raspi_tlc59711_spi_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/059/519/medium640/adafruit_products_raspi_tlc59711_spi_bb.jpg?1534876225)

# CircuitPython Installation of TLC5947 and TLC59711 Libraries

Next you'll need to install either the&nbsp;[Adafruit CircuitPython TLC5947](https://github.com/adafruit/Adafruit_CircuitPython_TLC5947)&nbsp;or&nbsp;[Adafruit CircuitPython TLC59711](https://github.com/adafruit/Adafruit_CircuitPython_TLC59711)&nbsp;module&nbsp;on your CircuitPython board, depending on which board you're using.

First make sure you are running the&nbsp;[latest version of Adafruit CircuitPython](../../../../welcome-to-circuitpython/installing-circuitpython)&nbsp;for your board.

Next you'll need to install the necessary libraries&nbsp;to use the hardware--carefully follow the steps to find and install these libraries from&nbsp;[Adafruit's CircuitPython library bundle](https://github.com/adafruit/Adafruit_CircuitPython_Bundle).&nbsp; Our introduction guide has&nbsp;[a great page on how to install the library bundle](../../../../welcome-to-circuitpython/circuitpython-libraries)&nbsp;for both express and non-express boards.

Remember for non-Express boards, you'll need to manually install the necessary libraries from the bundle, either:

- **adafruit\_tlc5947.mpy**

Or:

- **adafruit\_tlc59711.mpy**

Before continuing make sure your board's lib folder or root filesystem has the&nbsp; **adafruit\_tlc5947.mpy** or **adafruit\_tlc59711.mpy**** &nbsp;**files copied over.

Next[&nbsp;connect to the board's serial REPL](https://learn.adafruit.com/welcome-to-circuitpython/the-repl) so you are at the CircuitPython&nbsp; **\>\>\>** &nbsp;prompt.

# Python Installation of TLC5947 and TLC59711 Libraries

You'll need to install the Adafruit\_Blinka library that provides the CircuitPython support in Python. This may also require enabling I2C on your platform and verifying you are running Python 3. [Since each platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux)!

Once that's done, from your command line run the following command:

- `sudo pip3 install adafruit-circuitpython-tlc5947`

Or:

- `sudo pip3 install adafruit-circuitpython-tlc59711`

If your default Python is version 3 you may need to run 'pip' instead. Just make sure you aren't trying to use CircuitPython on Python 2.x, it isn't supported!

# CircuitPython & Python Usage of TLC5947

To demonstrate the usage of the TLC5947 we'll initialize it and control PWM outputs using the Python REPL.&nbsp; First run the following code to initialize the SPI bus and other connections to the chip:

```
import board
import busio
import digitalio
import adafruit_tlc5947
spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI)
latch = digitalio.DigitalInOut(board.D5)
tlc5947 = adafruit_tlc5947.TLC5947(spi, latch)
```

Be sure to set **latch** to the right digital I/O pin connected to your TLC5947's latch input.&nbsp; The wiring and code above use pin **D5**.

Now you're ready to control any of the 24 PWM outputs from the board.&nbsp; There are two ways to control these outputs, the first is with direct access to each channels 12-bit PWM duty cycle.&nbsp; You just index into the TLC5947 object like an array and set or get the duty cycle value, for example to set output 21 to a 100% duty cycle (which should turn the LED on to full red intensity if wired as shown):

```
tlc5947[21] = 4095
```

Notice the LED turns bright red!&nbsp; You can drop it down to half red brightness by setting a smaller duty cycle.&nbsp; Any value from 0 (off/no intensity) to 4095 (maximum/full intensity) can be set.&nbsp; Try a value in-between like 2048:

```
tlc5947[21] = 2048
```

You can change the other colors of the LED too, like to set full green (output 22) and quarter intensity blue (output 23):

```
tlc5947[22] = 4095
tlc5947[23] = 1024
```

The other way to control the TLC5947 outputs is with a syntax similar to [CircuitPython's built-in PWMOut object](http://circuitpython.readthedocs.io/en/latest/shared-bindings/pulseio/PWMOut.html).&nbsp; This is useful if you have code meant to work with PWMOut objects, like a motor controller or other higher-level class.&nbsp; You can pass in a special TLC5947 PWMOut object and it will be controlled just like a regular CircuitPython PWMOut.

Create a PWMOut object by calling the **create\_pwm\_out** function and pass it the number of the output.&nbsp; For example to make a PWM out for the red channel of the LED (output 21) you would run:

```
red = tlc5947.create_pwm_out(21)
```

Now you can change the **duty\_cycle** property of the red object to control the duty cycle of that channel on the TLC5947.&nbsp;

**One thing to note is that the duty cycle for this PWMOut expects a 16-bit value just like the regular CircuitPython PWMOut!** &nbsp; This means you instead need to use a range of values from 0 (off/no intensity) to 65535 (max/full intensity).&nbsp; Also there's a small chance you'll get little math errors because the TLC5947 only supports a 12-bit duty cycle so be aware if you need the most accurate PWM output you might want to use the direct channel access shown above.

To set the red channel to maximum intensity run:

```
red.duty_cycle = 65535
```

Or set any value from 0 - 65535 to change to an in-between duty cycle!

You might notice the PWMOut object also has a **frequency** property.&nbsp; Unlike CircuitPython's built-in PWMOut this property actually does nothing and cannot be changed.&nbsp; The TLC5947 has a fixed PWM frequency which is good for driving LEDs, not for servos.&nbsp; If you need control of PWM frequency you might need to use a native PWM output from your development board!

That's all there is to using the TLC5947 with CircuitPython!&nbsp; Here's a complete example of initializing the chip and pulsing (dimming and brightening) the LED.&nbsp; Save this as **code.py** on your board to run it.

# Full TLC5947 Example Code
https://github.com/adafruit/Adafruit_CircuitPython_TLC5947/blob/main/examples/tlc5947_simpletest.py

# CircuitPython & Python Usage of TLC59711

To demonstrate the usage of the TLC59711 we'll initialize it and control PWM outputs using the Python REPL.&nbsp; First run the following code to initialize the SPI bus and other connections to the chip:

```
import board
import busio
import digitalio
import adafruit_tlc59711
spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI)
tlc59711 = adafruit_tlc59711.TLC59711(spi)
```

Now you're ready to start controlling the PWM outputs of the TLC59711.&nbsp; There are two ways to control these outputs.&nbsp; The first way is with a format that's very similar to controlling a strip of NeoPixels.&nbsp; For each of the R0, G0, B0, R1, G1, B1, etc. sets of PWM outputs they can be adjusted at once by indexing into the TLC59711 object.&nbsp; For example to set the R3, G3, B3 output to full red intensity run:

```
tlc59711[3] = (65535, 0, 0)
```

Notice you set the outputs using a 3-tuple of 16-bit values.&nbsp; These are the PWM duty cycle values to assign to the R3, G3, and B3 channels respectively.&nbsp; You could set the same outputs to moderate green/blue (half intensity of each) by running:

```
tlc59711[3] = (0, 32767, 32767)
```

The other way to control PWM outputs is with direct access to each output pin.&nbsp; The TLC59711 object has a property for each R0, G0, B0, R1, etc. output and you can set or get its 16-bit PWM duty cycle directly.&nbsp; For example to change R3 to full intensity:

```
tlc59711.r3 = 65535
```

This is handy if you're not controlling RGB LEDs and instead just want to control each channel independently.

Finally the TLC59711 supports a global red, green, and blue channel brightness control.&nbsp; These values adjust all of the associated color outputs, like the red brightness channel control changes the R0, R1, R2, and R3 outputs.&nbsp; Set this to a 7-bit value (0-127) with 0 being low intensity and 127 being maximum intensity.&nbsp; Both the channel brightness and the individual channel PWM duty cycle are used to set the final output of a channel.&nbsp; For example to dim all the red channels by half you can run:

```
tlc59711.red_brightness = 63
```

There's a similar **green\_brightness** &nbsp;property that controls G0, G1, G2, G3 and **blue\_brightness** &nbsp;property that controls B0, B1, B2, B3.

That's all there is to controlling the TLC59711 with CircuitPython!&nbsp; Below is a complete example of initializing communication with the chip and changing some of the PWM outputs as shown above.&nbsp; Save this as **code.py** on your board to have it run.

# Full TLC59711 Example Code
https://github.com/adafruit/Adafruit_CircuitPython_TLC59711/blob/main/examples/tlc59711_simpletest.py

# TLC5947 and TLC59711 PWM LED Driver Breakouts

## Python Docs for TLC5947

# TLC5947 and TLC59711 PWM LED Driver Breakouts

## Python Docs for TLC59711

# TLC5947 and TLC59711 PWM LED Driver Breakouts

## Downloads and Links

# Libraries:

[TLC59711 Library](https://github.com/adafruit/Adafruit_TLC59711/archive/master.zip) (12 channel breakout)  
[TLC5947 Library](https://github.com/adafruit/Adafruit_TLC5947/archive/master.zip) (24 channel breakout)  
For tips on installing Arduino Libraries, see our guide: [All About Arduino Libraries](http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use).

# Data Sheets & Files

- [TLC59711 Data Sheet](http://www.adafruit.com/datasheets/tlc59711.pdf)
- [TLC5947 Data Sheet](http://www.adafruit.com/datasheets/tlc5947.pdf)
- [Fritzing objects in Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library)
- [EagleCAD PCB files for TLC5947 on GitHub](https://github.com/adafruit/Adafruit-TLC5947-PCB)
- [EagleCAD PCB files for TLC59711 on GitHub](https://github.com/adafruit/Adafruit-TLC59711-Breakout-PCB)

# TLC5947 Schematic & Print
![](https://cdn-learn.adafruit.com/assets/assets/000/018/721/medium800/leds_tlc5974sch.png?1407533315)

![](https://cdn-learn.adafruit.com/assets/assets/000/018/726/medium800/leds_tlc594.png?1407774571)

# TLC59711 Schematic and Print
![](https://cdn-learn.adafruit.com/assets/assets/000/018/728/medium800/leds_tlcschem.png?1407774830)

![](https://cdn-learn.adafruit.com/assets/assets/000/018/727/medium800/leds_tlc59711.png?1407774764)


## Featured Products

### Adafruit 12-Channel 16-bit PWM LED Driver - SPI Interface

[Adafruit 12-Channel 16-bit PWM LED Driver - SPI Interface](https://www.adafruit.com/product/1455)
For all of you out there who want to control 12 channels of PWM, we salute you! We also would like you to check out this breakout board for the TLC59711 PWM driver chip. This chip can control 12 separate channels of 16-bit PWM output. This is the highest-resolution PWM board we've seen!...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1455)
[Related Guides to the Product](https://learn.adafruit.com/products/1455/guides)
### Adafruit 24-Channel 12-bit PWM LED Driver - SPI Interface

[Adafruit 24-Channel 12-bit PWM LED Driver - SPI Interface](https://www.adafruit.com/product/1429)
For all of you out there who want to control 24 channels of PWM, we salute you! We also would like you to check out this breakout board for the TLC5947 PWM driver chip. This chip can control 24 separate channels of 12-bit PWM output. Designed (and ideal) for LED control, this board is not good...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1429)
[Related Guides to the Product](https://learn.adafruit.com/products/1429/guides)
### Premium Female/Male 'Extension' Jumper Wires - 40 x 6" (150mm)

[Premium Female/Male 'Extension' Jumper Wires - 40 x 6" (150mm)](https://www.adafruit.com/product/826)
Handy for making wire harnesses or jumpering between headers on PCB's. These premium jumper wires are 6" (150mm) long and come in a 'strip' of 40 (4 pieces of each of ten rainbow colors). They have 0.1" male header contacts on one end and 0.1" female header contacts...

In Stock
[Buy Now](https://www.adafruit.com/product/826)
[Related Guides to the Product](https://learn.adafruit.com/products/826/guides)
### Pig-Tail Cables - 0.1" 2-pin - 4 Pack

[Pig-Tail Cables - 0.1" 2-pin - 4 Pack](https://www.adafruit.com/product/1003)
You'll find these handy 2-pin 0.1" spacing pig-tails to be quite helpful when wiring up your project. The connector end snaps cleanly into 0.1" spaced header (and fits neatly side by side on 0.1" spacing as well). We think this would be especially useful when paired with <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/1003)
[Related Guides to the Product](https://learn.adafruit.com/products/1003/guides)
### 6-conductor 0.1" socket-socket cable

[6-conductor 0.1" socket-socket cable](https://www.adafruit.com/product/206)
6" (150mm) long jumper cable of 6 conductors, 0.1" spacing with two 'female'/sockets on either end. Great for wiring up ShiftBrites together!

**Note:** Wire&nbsp;colors may vary.&nbsp;

In Stock
[Buy Now](https://www.adafruit.com/product/206)
[Related Guides to the Product](https://learn.adafruit.com/products/206/guides)

## Related Guides

- [LED Tricks: Gamma Correction](https://learn.adafruit.com/led-tricks-gamma-correction.md)
- [Adafruit Mini I2C STEMMA QT Gamepad with seesaw](https://learn.adafruit.com/gamepad-qt.md)
- [Festive Feather Holiday Lights](https://learn.adafruit.com/festive-feather-holiday-lights.md)
- [Adafruit TPL5110 Power Timer Breakout](https://learn.adafruit.com/adafruit-tpl5110-power-timer-breakout.md)
- [FTDI Friend](https://learn.adafruit.com/ftdi-friend.md)
- [Smart Bathroom App](https://learn.adafruit.com/smart-bathroom-app.md)
- [Adafruit NeoKey 1x4 QT I2C Breakout](https://learn.adafruit.com/neokey-1x4-qt-i2c.md)
- [Microsoft Azure Cost Monitor](https://learn.adafruit.com/azure-cost-monitor.md)
- [Adafruit PCF8574 I2C GPIO Expander](https://learn.adafruit.com/adafruit-pcf8574.md)
- [Adafruit Music Maker Shield](https://learn.adafruit.com/adafruit-music-maker-shield-vs1053-mp3-wav-wave-ogg-vorbis-player.md)
- [NES Cart RetroPie Game Console](https://learn.adafruit.com/nes-cart-retropie.md)
- [MUNNY Glowing Friend with Bluetooth Control!](https://learn.adafruit.com/munny-lamp.md)
- [Adafruit INA219 Current Sensor Breakout](https://learn.adafruit.com/adafruit-ina219-current-sensor-breakout.md)
- [Adafruit Pi Stemma QT Breakout](https://learn.adafruit.com/adafruit-pi-stemma-qt-breakout.md)
- [Adafruit BMP580, BMP581, and BMP585 - Temperature and Pressure Sensor](https://learn.adafruit.com/adafruit-bmp580-bmp581-and-bmp585-temperature-and-pressure-sensor.md)
