Wire and control ledstrips with the esp8266

I am trying to correctly wire an rgb adressable ledstrip. In a successive blog post, I will make it smart as my goal is to control the lights via Home Assistant, depending on triggers.

Hardware required is the cheap WS2811. This ledstrip works on 12V and you can control every 3 leds (as one). I will wire it with both a Raspberry Pi Zero and an Esp8266. If you’re interested, read on!


  • Led power supply (to generate 12V DC from 230V AC): Mean Well LPV2012 (buy).
  • Raspberry Pi power supply (to generate 5V DC from 12V DC):  TracoPower TSR 1-2450 (buy or usb charger).
  • Esp8266 power supply (to generate 3.3V DC from 12V DC): TracoPower TSRN 1-2433SM (buyelse or usb charger).
  • Addressable led strip, WS2811 12V 5050 (buy).
  • Soldering iron or solderless led strip connector (like this).
  • Plug to connect with an outlet (like this).
  • Wemos ESP8266 (Lolin D1 Mini)

How much power do you need?

Depending on how long your led strip is you will need more w. Usually ledstrips contain either 30 or 60 leds per meter. The usage of 1 led should be rated in the tech sheet. This is of course maximum draw.

Length of ledstripNumber of leds per meterMaximum draw per ledTotal w required
1300.3 w9 w
1600.3 w18 w
5300.3 w45 w
5600.3 w90 w

A note for long led strips

When you want to power long led strips, you may have to power your ledstrip with 12V on multiple places as the current drops.


  • Measure your V on multiple points. If it drops to much, I would also power it there.
  • When leds don’t work as intended, this is probably the cause.

Wiring schemes

A small note on the power supply; the ws2811 runs on 12v, unlike the ws2812 wich works on 5v.


Raspberry pi zero


Raspberry Pi Zero

Let’s first try to make our great led strip with funky animations with a Raspberry Pi.

Initial setup of your pi:

  1. Install Raspbian on your sd card, use Etcher!
  2. Boot up your raspberry pi.
  3. Enable ssh & wifi/ethernet for connectivity (so you can connect via an ssh terminal). Update if needed (sudo apt-get update / sudo apt-get upgrade). Change your users password! You can do all of this via sudo rasp-config.

Make sure everything is correctly wired. Now we can install the required Raspbian packages and do more required configuration:

  • Install required packages:
sudo apt-get update
sudo apt-get install gcc make build-essential python-dev git scons swig
  • Disable audio output, add to this file: sudo nano /etc/modprobe.d/snd-blacklist.conf
blacklist snd_bcm2835
  • Edit boot configuration file: sudo nano /boot/config.txt
#dtparam=audio=on (comment this line)
  • Reboot: sudo reboot

Let’s download this library that helps driving these led strips: WS281X.

  • git clone https://github.com/jgarff/rpi_ws281x.git
  • cd rpi_ws281x/
  • sudo scons
  • Now you can test if it works! sudo ./test



There are quite a few Esp8266 boards available. We are going to use a Wemos D1 mini as it’s simple to buy, small and in my opinion of good quality.

Arduino IDE

It’s fairly simple to use Arduino IDE to code your Esp8266. There are a few libraries you should install:

  • Todo: add libs we use

Todo: Add screenshot of installed libs.

Todo: How to install / configure the board layout? (http://arduino.esp8266.com/stable/package_esp8266com_index.json)

Code and flash!

Todo: Add all code here.

Inspiration / sources

Tutorials for the Esp8266:

Tutorials for the raspberry pi:

One Reply to “Wire and control ledstrips with the esp8266”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.