DIY Wifi Smart LED

Make your own Wifi enabled LED strip using open source software. This strip can be controlled by virtually any device in your home.

Ryan Wise

6 minute read

I setup an ESP8266 and WS2812B LED strip with WLED and a while back and thought it was one of the coolest ways to control a smart light, that I’ve ever tried. WLED is a web server for ESP8266/ESP32 boards that controls NeoPIxel LED strips. There is an app that works out of the box for basic controls / effects. More importantly there is a REST api, and even better it allows for UDP communication for quick updates.

Part List

  • ESP8266 Node MCU x 3 $12.99 USD - Boards used for controlling the light strip, you don’t need 3 but you can divide the LED strip up and have multiple and the price of one is only $2USD cheaper on Amazon
  • LED strip 144 LEDs $18.49 USD or 300 LEDs $29.99 USD (more spread out though) - WS2812B led strips
  • (optional) Jumper Wires $14.99 USD - If you don’t want to strip wire or solder (not recommended)
  • (optional) Lever Nuts $18.99 USD - If you can strip wire but don’t want to solder
  • (SUPER optional) Raspberry Pi Zero W $28.99 - If you want to use the Forza Tachometer but don’t have/want a regular computer to run the server

All of these parts are affiliate links to Amazon, feel free to get them elsewhere but buying them from those links help support me :)

Flashing the firmware

For flashing I’ll be using esptool, you will need to have Python 2.7 or 3.4 (or newer) installed first.

install esptool

pip install esptool

Download the binary from Aircookie’s WLED project here you will want the one ending with _ESP8266.bin, assuming you’re using the esp8266 and not the esp32. Once that’s downloaded open up a terminal (or cmd/powershell in Windows) to the directory with the .bin file you just downloaded.

Connect the ESP8266 with a usb cable

Flash the firmware

esptool.py write_flash 0x0 [The bin file you downloaded]
#example [if you're on linux or MacOS you'll need sudo]
esptool.py write_flash 0x0 WLED_0.10.0_ESP8266.bin

If this method doesn’t suite you, there are alternatives here and here

Wifi & App Setup

Using any Wifi enabled device connect to the WLED-AP network with the default password wled1234. Once connected open up a web browser to 4.3.2.1 or http://wled.me.

Click the Wifi-Settings button and enter in your router’s ssid and passphrase. If you have both a 5Ghz and 2.4Ghz network make sure to use the 2.4Ghz one. After applying the device should reset and connect to your network. If it doesn’t connect there was an issue connecting to your network, double check the config :)

wifi setup in app customize light in app

Now you can move onto configuring the device. There are a few ways of doing this, one is you can just open the IP of the device in your browser. (you can find it by downloading an app like Fing or if you’re savy, use nmap) The easier option is downloading the WLED app. Android, iOS. You just click the add button on the top right, click discover lights and once it discovers the light you are good to go. If this doesn’t work you can try the other method as well. I found the app is reliable and easy but occasionally it won’t detect them.

From the app or browser you can click config → LED setup and tell it how many LEDs you have on your strip.

Wiring

Wiring this up is super simple, with the LED strip linked above it only has 3 wires. 5v, Data in and ground. Which means we only have 3 wires to connect!

Wire Function Pin
Red Power(5v) Vin
Black Ground Gnd
Green LED Data D4

Example

Wiring

Once those are connected properly, plug your ESP8266 in and watch it light up! You can mess around and change the color in the app or browser! Or even use one of the cool palettes along with an effect. (I recommend the beach palette with the lake effect)

Example basic lit LED strip

Bad image quality FTW

Cool but what else? - RPM Meter (Tachometer) in Forza

I’m working on creating a few different projects using the UDP protocol for WLED, one I have completed is an RPM meter (tachometer) in Forza Horizon 4 (also works for Forza Motorsport 7). Forza has an option for remote telemetry which will ping a host on your network for telemetry data 60 times a second over UDP.

So if we want our WLED strip to do this we need another host on our network different from the WLED board and our machine running Forza. This is only necessary because we are using WLED. If we didn’t want an easy to use LED strip and just wanted an RPM meter we could make the board directly compatible with the packets from the Forza telemetry output. I’ll put out some firmware that is compatible with the board directly to skip the man in the middle at a future date.

Software Setup

In order to set this up with the man in the MITM (man in the middle) approach, we need some computer (I use a raspberry pi) to run the program that will forward the LED info to the WLED board. You can find it on my Github here. This is written in GoLang so it SHOULD work on any machine. If there is any issue feel free to make an issue on Gitub, email me directly or DM me on Twitter.

Installing the software

Go to my Github releases and download the Forzatachometer for linux or Windows. Windows has the .exe, I should change the name to include the platform but I’m lazy.

Start by making sure you have a firewall rule to allow UDP on port 8080 on your computer. If you’re using Linux & iptables you can use the following command:

sudo iptables -A INPUT -p udp --dport 8080 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT

This shouldn’t be necessary for Windows because it should ask for permission when it’s ran but if you’re running into issues check here.

Open up a terminal or cmd instance (Powershell has issues with the Go flags) in the directory where you downloaded the software.

Now you should be able to start the server

forzatachometer -host-ip=[YOUR IP ADDRESS] -wled-ip=[YOUR LED STRIPs IP] -led-count=[NUMBER OF LEDS IN YOUR STRIP]
#example linux
forzatachometer -host-ip=192.168.1.131 -wled-ip=192.168.1.150 -led-count=144
#example windows
forzatachometer.exe -host-ip=192.168.1.131 -wled-ip=192.168.1.150 -led-count=144

Once the server is up and running go ahead and give it a test. Put the IP address of the MITM computer into Forza and the port for it to send the data to (default is 8080). Once you get into a car and start driving it should reflect the RPM on the LED strip.