Whether you call them individually addressable RGB LEDs, WS2812B, or NeoPixels, there�s no denying that they are extremely popular and a must-have for any glowy and blinky project.

Writing code to control addressable LEDs isn�t difficult, but what if you just want to add some ambient lighting to your living room or office and manage it all from your smartphone? Currently the best option, hands down, is WLED�A free, feature-rich, open-source mobile app that gives us complete command over a wide variety of RGB LEDs.

The WLED app makes controlling individually addressable LEDs much simpler, convenient, and�most importantly�fun. This app is just too cool not to try.

In this tutorial, we will learn how to install WLED on an ESP32 board and use it to control a string of addressable LEDs.

Installing WLED on an ESP32 Board

WLED has made installing this custom firmware on an ESP32 Board a breeze. We simply plug in the ESP32 and click a few buttons, and the installer does the rest.

1. Connect your ESP32 board to your computer using a USB cable. Make sure the USB cable you�re using supports data transfer.

esp32 connected to computer using a usb cable

2. Launch a web browser and navigate to install.wled.me. This URL will take you to the website shown below.

wled installation page

Make sure the browser supports Web Serial. As of this writing, that means �desktop� browsers such as Google Chrome, Microsoft Edge, or Opera. Other browsers (Safari, Firefox, Explorer, and mobile) will not work.

3. Click Install.

4. Select the COM port to which your ESP32 is connected and click Connect. WLED uses Web Serial API to open serial ports on your computer.

If nothing appears, you may need to update your USB-to-serial drivers, or you may not be using a USB cable that supports data transfer.

wled select com port

5. Click �Install WLED� to begin the process.

wled install button

6. Confirm the installation to flash the firmware to the board. This additional step serves as your final warning, after which all data on the device will be erased.

It is important to note that some ESP32 boards require you to press the BOOT button before selecting the final install button.

wled final installation confirmation

7. The installation process should now begin. You can now release the BOOT button as it was able to connect. Installation should only take a few minutes.

wled installing

8. Click Next to complete the installation.

wled installation complete

9. Enter your Wi-Fi credentials and click Connect. This will connect your ESP32 to your Wi-Fi network and save the details for later use.

wled configure wifi

The WiFi network must be 2.4 GHz; the ESP32 does not support 5 GHz networks.

10. The message �Device connected to the network!� should appear. Click Visit Device to access the WLED User Interface (UI).

wled visit device

11. Make a note of the URL as you will need it to access the WLED UI.

wled web interface url

A Quick Tour of the WLED UI

WLED�s UI is simple, but may appear overwhelming at first. The UI can be divided into five sections.

wled ui overview pc mode
WLED Web Interface
wled app ui overview
WLED App

1. Configuration: Here you can find buttons such as Power (to turn the lights on or off), Timer (to organize the lights to come on and off at certain points during the day), Sync (to sync multiple WLED devices across your network), Peek (to see an animation preview of your lights), Config (to configure the number of LEDs and the GPIO port), and a Brightness slider (to control the overall brightness).

2. Color Picker: This section allows you to change the color of the LEDs, whether they are static or animated. If you scroll down this section, you can access various color palettes for use in effects.

3. Effects/Animation: Here you�ll find a library of ready-made animations for your lights. While each effect has its own color scheme, you can easily customize it in the Color Picker section.

4. Segment: If you have a large array or matrix of LEDs, you can split them into segments and assign a different color, animation, or color scheme to each segment.

5. Presets: Here, you can create presets for your custom light show, as well as a playlist to cycle through the many available animations.

Configuring the WLED

Changing the URL

Once the setup is complete it�s a good idea to head to WiFi Setup screen and change the address to something you can remember so you can easily access this interface again.

1. Click on Config.

wled config

2. Select WiFi Setup.

wled wifi settings

3. Scroll down to mDNS address and set the address to your liking. I called mine http://mylights.local/ � from now on, this is what I�ll be typing into a web browser on my WiFi network to connect to my lights.

wled mdns address

4. Scroll to the top or bottom of the page and click Save & Connect.

wled wifi setup save and connect

5. The message �WiFi settings saved.� should appear.

wled wifi settings saved

6. Connect to the new IP address now.

wled accessed through new address

Configuring LED lights

1. Click on Config and select LED Preferences.

wled led preferences

2. Scroll down to Hardware Setup and select the type of led strip you have.

wled led type select

4. Set the �Length� to match the number of LEDs. We have a total of 12 LEDs, so I changed the length to 12.

wled number of leds select

5. Make a note of the GPIO pin number. This pin will be used to send data to the LEDs. By default, GPIO16 is used.

wled esp32 gpio pin select

6. Scroll down to the bottom and click Save.

wled save led preferences

7. Click Back to return to the main screen.

wled return to main page

Connecting a WS2812x Addressable LED Strip to an ESP32

Once you�ve finished configuring the WLED, unplug the ESP32 from the USB port. Let�s wire up an addressable LED strip to the ESP32.

The wiring is relatively simple. There are only three wires to connect: two for power and one for data transmission.

Connect the Red wire (+5V/VCC) of the addressable LED strip to the ESP32�s VIN pin and the White/Yellow wire (GND) to the ESP32�s GND pin.

Finally, connect the Green wire (DIN) of the LED strip to the ESP32�s GPIO16 (RX2), via a 330 Ohm resistor. This in-line resistor is there to protect the data pin. A resistor between 220 and 470 Ohm should do nicely. Try to place the resistor as close to your addressable LEDs as possible.

If you have few LEDs you can plug the ESP32 into your computer using a USB cable and power the strip directly through the board.

connecting ws2812b addressable led strip to esp32 usb powered

If you have a larger project that requires more LEDs, USB power won�t be enough. Instead you should inject power into the strip from an external source. Keep in mind that each RGB LED consumes about 60mA (20mA per color channel), when the brightness is set to full. That means that for every 30 LEDs, your LED strip could be drawing up to 1.8 Amps.

connecting ws2812b addressable led strip to esp32 5v external power

Once wiring is complete, LEDs should come to life and emit a soft yellow light. If this isn�t the case, double-check your wiring before proceeding.

From here everything can now be done via the WLED App.

Using the WLED Mobile App

1. Download the WLED app from the Google Play Store or the Apple App Store on your smartphone or tablet.

wled app on google play store

2. Open the app and click on the plus icon in the upper right corner to open up the discovery page.

wled app add devices

3. Hit Discover Lights. This will search through your WIFI for all connected boards running WLED software.

wled app discover lights

4. Once it says Found WLED! click the Tick icon in the upper-right corner. This will bring you back to the home page where you will have a list of all the WLED devices on your network.

wled app add discovered wled devices

5. Click on the newly discovered device to open the control panel.

wled app list of wled devices

6. Select a color using the color wheel. And voil�, you now have fully operational, remotely activated addressable LEDs!

wled app interface

If the color of the LEDs does not match the color you selected in the app, go to Config > LED Preferences and adjust the Color Order setting under Hardware Setup until it does.

wled color order setting

7. If you have multiple WLED devices, you may want to change the name displayed on the app to differentiate them. Go to Config > User Interface and name it whatever you want, then hit Save.

wled device name change

Changing Effects

WLED offers over 180 different effects. This is where the real fun begins.

1. Navigate to the Effects tab and select an effect. The LEDs will respond immediately.

wled app effect select

2. You can change the speed and intensity of the effect. The further you move the slider, the faster and more intense the effect.

wled app effect speed intensity

3. Each effect has its own color scheme, which you can easily change in the Color Picker section. This will keep the animation effect but replace the colors.

wled app effect color scheme

Tips and Recommendations

There are a few tips and recommendations to keep in mind when designing your setup with ESP32:

  • ESP32 can handle up to ten strips at a time.
  • While most strip types have yet to be tested, the following are known to work: WS281x, SK6812 RGBW, PWM white
  • As soon as installation is complete, select the LEDs type, pin numbers, length, and color order of your LED strips in the LED settings page.
  • Framerate can be increased significantly by selecting the appropriate power supply for the setup and turning off the WLED brightness limiter setting.
  • There are no pin restrictions; feel free to use any available pin.
  • The performance is determined by how many LEDs you drive with the ESP32 and how many ESP32 output pins you use.
    • For excellent performance, it is recommended to use 512 LEDs/pin with 4 outputs for a total of 2048 LEDs.
    • For optimal performance, it is recommended to use 800 LEDs/pin with 4 outputs for a total of 3200 LEDs.
    • For good performance, you can use 1000 LEDs/pin with 4 outputs for a total of 4000 LEDs.
    • For marginal performance, you can use 1000 LEDs/pin with 5 outputs for a total of 5000 LEDs.
    • For marginal performance, you can use 800 LEDs/pin with 6 outputs for a total of 4800 LEDs.
  • ESP32 is capable of calculating approximately 65k-85k LEDs per second (that�s 1000 LEDs @~70fps, 2000 LEDs @~35fps, 4000 LEDs @~18fps)


Login
ADS CODE