# Driving TM1814 addressable LEDs

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/133/261/medium800thumb/led_pixels_PXL_20241021_2201091102-ezgif.com-speed.jpg?1729548522)

TM1814 is a four-channel constant current LED driver. Similar to the NeoPixel's WS2812B, TM1814 uses one data line to control a string of daisy chained LEDs.

However, TM1814 is not compatible with the WS2812B, so it needs different software to drive it. Adafruit publishes Adafruit\_CircuitPython\_TM1814, a software library for CircuitPython that runs on RP2040 and RP2350 microcontrollers, including the Feather RP2040, Feather RP2350, Raspberry Pi Pico, and Raspberry Pi Pico 2.

Key facts about TM1814:

- TM1814 works with LED supply voltages up to 24V, vs about 5V for NeoPixels. A particular LED strip will have a design voltage, often 12V; refer to the LED strip supplier's details and do not exceed them.
- TM1814 often controls more than one LED package. For instance, a 12V strip is likely to have 3 RGBW LEDs for every 1 TM1814. These 3 LEDs will all have the same color and act as a "single pixel" in your code.
- There is an overall LED current control, selectable from 6.5mA to 38mA in 0.5mA steps, that applies to all TM1814 in a strip
- TM1814 is a standalone chip designed for RGBW designs, while WS281x chips are RGB only
- TM1814 will display a test pattern when not actively driven by a microcontroller
- The waveform is very similar to an inverted NeoPixel waveform, but not exactly

## Why require RP2040/RP2350

The RP2 "PIO" peripheral can be used to create high precision waveforms constantly, without any intervention needed from your program's main code. The `background_write` function of CircuitPython's **StateMachine** object made this simple to implement. Doing the same thing on another microcontroller family, like ESP32, would have been more complicated and might have required changes in the CircuitPython core.

## `adafruit_tm1814` library overview

`TM1814PixelBackground` is an `adafruit_pixelbuf` object and supports all of that object's methods. So, your code can set all the LEDs with a line like `pixels.fill((255,0,0))` or set individual pixels with code like&nbsp;`pixels[0] = (255,0,0)`. It is also compatible with the extensive set of animations available through the [Adafruit LED Animation library](https://learn.adafruit.com/circuitpython-led-animations/overview).

It also adds functionality specific to TM1814: the `current_control` property. The current is settable, per R/G/B/W channel, in the range of 6.5mA to 38mA.

Additionally, the `show()` method exists, but does nothing, because the strip is constantly being updated. For similar reasons, the `auto_write` property exists, but any value assigned to it is ignored, and the property always reads back as `True`.

If you use an inverting signal conditioner between your microcontroller and the TM1814 strip, you can pass `inverted=True` to the constructor to give the signal the correct polarity.

You can check the full documentation for `adafruit_tm1814` via the link in the sidebar.

Featured
### Adafruit Metro RP2040

[Adafruit Metro RP2040](https://www.adafruit.com/product/5786)
Choo! Choo! This is the RP2040 Metro Line, making all station stops at "Dual Cortex M0+ mountain", "264K RAM round-about" and "16 Megabytes of Flash town". This train is piled high with hardware that complements the Raspberry Pi RP2040 chip to make it an excellent...

In Stock
[Buy Now](https://www.adafruit.com/product/5786)
[Related Guides to the Product](https://learn.adafruit.com/products/5786/guides)
![Angled shot of black, credit-card-sized development board.](https://cdn-shop.adafruit.com/640x480/5786-00.jpg)

Featured
### Adafruit Feather RP2040

[Adafruit Feather RP2040](https://www.adafruit.com/product/4884)
A new chip means a new Feather, and the Raspberry Pi RP2040 is no exception. When we saw this chip we thought "this chip is going to be awesome when we give it the Feather Treatment" and so we did! This Feather features the&nbsp; **RP2040** , and all niceties you know and...

In Stock
[Buy Now](https://www.adafruit.com/product/4884)
[Related Guides to the Product](https://learn.adafruit.com/products/4884/guides)
![Angled shot of black rectangular microcontroller "Feather RP2040"](https://cdn-shop.adafruit.com/640x480/4884-04.jpg)

Featured
### Adafruit Feather RP2350 with HSTX Port

[Adafruit Feather RP2350 with HSTX Port](https://www.adafruit.com/product/6000)
RP2350&nbsp;flies high with the&nbsp;Feather&nbsp;format - now you can use any FeatherWings with this battery-powered dev board. It comes with 8MB of flash, 22pin HSTX output port, Stemma QT, debug SWD, and optional PSRAM spot. It's our first RP2350 board and we crammed a ton of goodies...

In Stock
[Buy Now](https://www.adafruit.com/product/6000)
[Related Guides to the Product](https://learn.adafruit.com/products/6000/guides)
![Overhead shot of black, rectangular microcontroller with 22-pin FPC connector.](https://cdn-shop.adafruit.com/640x480/6000-07.jpg)

Featured
### Adafruit Metro RP2350

[Adafruit Metro RP2350](https://www.adafruit.com/product/6003)
Choo! Choo! This is the RP2350 Metro Line, making all station stops at "Dual Cortex M33 mountain", "528K RAM round-about" and "16 Megabytes of Flash town". This train is piled high with hardware that complements the Raspberry Pi RP2350 chip to make it an excellent...

In Stock
[Buy Now](https://www.adafruit.com/product/6003)
[Related Guides to the Product](https://learn.adafruit.com/products/6003/guides)
![Angled shot of black, credit card-sized microcontroller with stacking headers.](https://cdn-shop.adafruit.com/640x480/6003-06.jpg)

Featured
### Pink and Purple Woven USB A to USB C Cable - 1 meter long

[Pink and Purple Woven USB A to USB C Cable - 1 meter long](https://www.adafruit.com/product/5153)
This cable is not only super-fashionable, with a woven pink and purple Blinka-like pattern, it's also made for USB C for our modernized breakout boards, Feathers, and more.&nbsp;&nbsp;[If you want something just like it but for Micro B, we...](https://www.adafruit.com/product/4111)

Out of Stock
[Buy Now](https://www.adafruit.com/product/5153)
[Related Guides to the Product](https://learn.adafruit.com/products/5153/guides)
![Angled shot of coiled pink and purple USB cable with USB A and USB C connectors.](https://cdn-shop.adafruit.com/640x480/5153-02.jpg)

# Driving TM1814 addressable LEDs

## Wiring & Power

![](https://cdn-learn.adafruit.com/assets/assets/000/133/265/medium800/led_pixels_tm1814_bb.png?1729605717)

## Wiring the TM1814 LED strip

Refer to manufacturer instructions to identify the connections & connectors on your TM1814 LED strip.

Make the following connections:

- TM1814 power and GND to dedicated power supply according to manufacturer directions (e.g., 12VDC 20A)
- TM1814 GND to microcontroller GND
- TM1814 Data In to microcontroller A0 (GP26 on Pico / Pico 2)

Do not connect TM1814 power to microcontroller power, as this will damage the microcontroller.

## LED Strip Organization

As mentioned above, TM1812 is designed to work with higher supply voltages. This is useful because it allows a strip to provide more total light with less total current. Of course, there's a hitch: The LED strip has to be designed such that it's appropriate to drive the LEDs with a higher voltage. The simplest way to do this is to place several LEDs in series. For instance, a 12V strip may have 3 RGBW LED packages controlled by a single TM1814 controller chip. The typical forward voltage of a white or blue LED is around 3V, and so when 3 are placed in series the typical forward voltage is 3V+3V+3V=9V. Add a few volts for operating margin, and the manufacturer assigns 12V as the nominal voltage of the strip.

In the photo below you can see that there's 1 TM1814 chip (the black rectangle) togther with 3 RGBW LEDs (white rectangles with circles). The strip manufacturer has marked the voltage (12V) and the data direction (data inputs at the left and outputs at the right)

![](https://cdn-learn.adafruit.com/assets/assets/000/133/266/medium800/led_pixels_PXL_20241021_220346356_2.jpg?1729605831)

## LED strip power estimation

The per-chip maximum current is the chip supply current plus the LED current. The LED current can be up to 4\*38mA = 152mA. Add 10mA per chip to account for the TM1814's own power usage, and multiply by the number of chips. That comes out to 16.2A for a 5-meter strip with 100 TM1814s and 300 RGBW LEDs. So a 12V 20A DC power supply is not unreasonable, and it may be helpful to connect GND and VCC at multiple points on the strip to reduce power supply sag under load. Wiring high current LED strips is out of scope for this guide, but never fear: there is a [dedicated page within the NeoPixel Überguide](https://learn.adafruit.com/adafruit-neopixel-uberguide/powering-neopixels) just about how to power LED strips. This advice applies to TM1814, except that you have to observe the manufacturer's voltage rating, not the NeoPixel 5V advice.

If you set the current control registers to a lower value (see below) you can limit the overall strip current as well. For instance, at the lowest 6.5mA the maximum per chip current is probably 36mA, making the whole strip "only" 3.6A. However, you need to keep in mind that the current draw may be higher in self test mode.

In adafruit\_tm1814, the default current is the lowest 6.5mA. The self test mode appears to use 12.5mA current.

# Driving TM1814 addressable LEDs

## CircuitPython Simpletest

Primary: The code in this guide is compatible with CircuitPython 9.2 and later, including 9.2.0-rc.0.

## CircuitPython simpletest

Click on the **Download Project Bundle** button in the window below. It will download to your computer as a zipped folder.

https://github.com/adafruit/Adafruit_CircuitPython_TM1814/blob/main/examples/tm1814_simpletest.py

## Copy the code to your CircuitPython device

After downloading the Project Bundle, plug your CircuitPython device into the computer's USB port with a known good USB data+power cable. You should see a new flash drive appear in the computer's File Explorer or Finder (depending on your operating system) called **CIRCUITPY**. Open up the zipped file, go to the the appropriate folder inside (e.g., **CircuitPython 9.x** if you are using CircuitPython 9.x) and copy the items in that folder directly onto your **CIRCUITPY** drive.

Your **CIRCUITPY** drive should look like this after copying the sound effects and the **code.py** file.

![Files](https://adafruit.github.io/Adafruit_CircuitPython_Bundle/tm1814_tm1814_simpletest.py.png )

## Code Walkthrough & Customization

As usual, Python code begins by importing required modules:

```auto
import board
import rainbowio
import supervisor

from adafruit_tm1814 import TM1814PixelBackground
```

The next section supports some customization: you can change the pin connected to the TM1814 data line, and customize the number of pixels.

```auto
# The pin where the LED strip data line is connected
TM1814 = board.A0
# The number of TM1814 controllers. Note that sometimes one "pixel" controls
# more than one LED package.
#
# One common configuration is 3 LED packages & 1
# controller per 50mm, giving 100 TM1814 controllers (300 LED packages) in 5
# meters of LED strip.
NUM_PIXELS = 100
```

A TM1814 LED strip is initialized and set to all black with this line:

```auto
pixels = TM1814PixelBackground(TM1814, NUM_PIXELS, brightness=0.1)
```

The code's forever loop just sets the whole strip's color to a rainbow color in a pattern that repeats about every 4 seconds:

```auto
# Cycle the rainbow at about 1 cycle every 4 seconds
while True:
    pixels.fill(rainbowio.colorwheel(supervisor.ticks_ms() // 16))
```

# Driving TM1814 addressable LEDs

## CircuitPython LED Animations

Primary: The code in this guide is compatible with CircuitPython 9.2 and later, including 9.2.0-rc.0.

Click on the **Download Project Bundle** button in the window below. It will download to your computer as a zipped folder.

https://github.com/adafruit/Adafruit_CircuitPython_TM1814/blob/main/examples/tm1814_led_animation.py

## Copy the code to your CircuitPython device

After downloading the Project Bundle, plug your CircuitPython device into the computer's USB port with a known good USB data+power cable. You should see a new flash drive appear in the computer's File Explorer or Finder (depending on your operating system) called **CIRCUITPY**. Open up the zipped file, go to the the appropriate folder inside (e.g., **CircuitPython 9.x** if you are using CircuitPython 9.x) and copy the items in that folder directly onto your **CIRCUITPY** drive.

Your **CIRCUITPY** drive should look like this after copying the sound effects and the **code.py** file.

![Files](https://adafruit.github.io/Adafruit_CircuitPython_Bundle/tm1814_tm1814_simpletest.py.png )

## Wiring the TM1814 LED strip

Refer to manufacturer instructions to identify the connections & connectors on your TM1814 LED strip.

Make the following connections:

- TM1814 power and GND to dedicated power supply according to manufacturer directions (e.g., 12VDC 2A)
- TM1814 GND to microcontroller GND
- TM1814 Data In to microcontroller A0 (GP26 on Pico / Pico 2)

Do not connect TM1814 power to microcontroller power, as this will damage the microcontroller.

## Code Walkthrough & Customization

As usual, Python code begins by importing required modules:

```auto
import board
import rainbowio
import supervisor

from adafruit_led_animation.animation.rainbow import Rainbow
from adafruit_led_animation.animation.rainbowchase import RainbowChase
from adafruit_led_animation.animation.rainbowcomet import RainbowComet
from adafruit_led_animation.animation.rainbowsparkle import RainbowSparkle
from adafruit_led_animation.sequence import AnimationSequence

from adafruit_tm1814 import TM1814PixelBackground
```

The next section supports some customization: you can change the pin connected to the TM1814 data line, and customize the number of pixels.

```auto
# The pin where the LED strip data line is connected
TM1814 = board.A0
# The number of TM1814 controllers. Note that sometimes one "pixel" controls
# more than one LED package.
#
# One common configuration is 3 LED packages & 1
# controller per 50mm, giving 100 TM1814 controllers (300 LED packages) in 5
# meters of LED strip.
NUM_PIXELS = 100
```

A TM1814 LED strip is initialized and set to all black with this line:

```auto
pixels = TM1814PixelBackground(TM1814, NUM_PIXELS, brightness=0.1)
```

Then the code creates a series of animations (as detailed in the guide for the&nbsp;[Adafruit LED Animation library](https://learn.adafruit.com/circuitpython-led-animations/overview)) and runs the animations forever:

```auto
# Perform a rainbow animation sequence
rainbow = Rainbow(pixels, speed=0.1, period=2)
rainbow_chase = RainbowChase(pixels, speed=0.1, size=5, spacing=3)
rainbow_comet = RainbowComet(pixels, speed=0.1, tail_length=7, bounce=True)
rainbow_sparkle = RainbowSparkle(pixels, speed=0.1, num_sparkles=15)


animations = AnimationSequence(
    rainbow,
    rainbow_chase,
    rainbow_comet,
    rainbow_sparkle,
    advance_interval=5,
    auto_clear=True,
)

while True:
    animations.animate()
```

# Driving TM1814 addressable LEDs

## CircuitPython Docs

# Driving TM1814 addressable LEDs

## Downloads

[TM1814 Datasheet](https://cdn-learn.adafruit.com/assets/assets/000/133/260/original/TM1814-TitanMicro.pdf?1729546940)

## Guide Products

### Adafruit Metro RP2040

[Adafruit Metro RP2040](https://www.adafruit.com/product/5786)
Choo! Choo! This is the RP2040 Metro Line, making all station stops at "Dual Cortex M0+ mountain", "264K RAM round-about" and "16 Megabytes of Flash town". This train is piled high with hardware that complements the Raspberry Pi RP2040 chip to make it an excellent...

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

[Adafruit Feather RP2040](https://www.adafruit.com/product/4884)
A new chip means a new Feather, and the Raspberry Pi RP2040 is no exception. When we saw this chip we thought "this chip is going to be awesome when we give it the Feather Treatment" and so we did! This Feather features the&nbsp; **RP2040** , and all niceties you know and...

In Stock
[Buy Now](https://www.adafruit.com/product/4884)
[Related Guides to the Product](https://learn.adafruit.com/products/4884/guides)
### Adafruit Feather RP2350 with HSTX Port

[Adafruit Feather RP2350 with HSTX Port](https://www.adafruit.com/product/6000)
RP2350&nbsp;flies high with the&nbsp;Feather&nbsp;format - now you can use any FeatherWings with this battery-powered dev board. It comes with 8MB of flash, 22pin HSTX output port, Stemma QT, debug SWD, and optional PSRAM spot. It's our first RP2350 board and we crammed a ton of goodies...

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

[Adafruit Metro RP2350](https://www.adafruit.com/product/6003)
Choo! Choo! This is the RP2350 Metro Line, making all station stops at "Dual Cortex M33 mountain", "528K RAM round-about" and "16 Megabytes of Flash town". This train is piled high with hardware that complements the Raspberry Pi RP2350 chip to make it an excellent...

In Stock
[Buy Now](https://www.adafruit.com/product/6003)
[Related Guides to the Product](https://learn.adafruit.com/products/6003/guides)
### Pink and Purple Woven USB A to USB C Cable - 1 meter long

[Pink and Purple Woven USB A to USB C Cable - 1 meter long](https://www.adafruit.com/product/5153)
This cable is not only super-fashionable, with a woven pink and purple Blinka-like pattern, it's also made for USB C for our modernized breakout boards, Feathers, and more.&nbsp;&nbsp;[If you want something just like it but for Micro B, we...](https://www.adafruit.com/product/4111)

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

## Related Guides

- [Introducing Adafruit Feather RP2040](https://learn.adafruit.com/adafruit-feather-rp2040-pico.md)
- [Adafruit Metro RP2040](https://learn.adafruit.com/adafruit-metro-rp2040.md)
- [Adafruit Feather RP2350 with HSTX](https://learn.adafruit.com/adafruit-feather-rp2350.md)
- [Adafruit Metro RP2350](https://learn.adafruit.com/adafruit-metro-rp2350.md)
- [Walkmp3rson: Personal MP3 'Tape' Player](https://learn.adafruit.com/walkmp3rson-personal-mp3-tape-player.md)
- [Air Quality Monitor and Case](https://learn.adafruit.com/aqi-case.md)
- [Introducing Adafruit Feather](https://learn.adafruit.com/adafruit-feather.md)
- [Disconnected CO2 Data Logger](https://learn.adafruit.com/disconnected-co2-data-logger.md)
- [Flappy Nyan Cat Game on Fruit Jam and Metro RP2350](https://learn.adafruit.com/flappy-nyan-cat-game-on-metro-rp2350.md)
- [Using a Keyboard with USB Host](https://learn.adafruit.com/using-a-keyboard-with-usb-host.md)
- [4x4 Rotary Encoder MIDI Messenger](https://learn.adafruit.com/4x4-rotary-encoder-midi-messenger.md)
- [NeoTrellis MIDI Feedback Controller](https://learn.adafruit.com/neotrellis-midi-feedback-controller.md)
- [Soundboard Speaker for Bikes & Scooters](https://learn.adafruit.com/soundboard-speaker-for-bikes-scooters.md)
- [Feather ESP32-S3 TFT CircuitPython Day 2024 Countdown Clock](https://learn.adafruit.com/feather-esp32-s3-tft-circuitpython-day-2024-countdown-clock.md)
- [Getting Started with Microsoft Azure and CircuitPython](https://learn.adafruit.com/getting-started-with-microsoft-azure-and-circuitpython.md)
- [Ableton Live MacroPad Launcher](https://learn.adafruit.com/ableton-live-macropad-launcher.md)
- [Which CircuitPython Board is Right for You?](https://learn.adafruit.com/choose-your-circuitpython-board.md)
- [Qualia S3 Sushi Conveyor Belt](https://learn.adafruit.com/qualia-s3-sushi-conveyor-belt.md)
- [QT Py RP2040 USB to Serial MIDI Friends](https://learn.adafruit.com/qt-py-rp2040-usb-to-serial-midi-friends.md)
