IoT Enabled Smart Music Reactive WLED RGB Light Tutorial.

Sparsh
7 min readApr 28, 2023

RGB LEDs that can be individually addressed, also known as WS2812B or NeoPixels, have become incredibly popular and are a must-have for any DIY project that involves lighting. However, controlling these types of LEDs can be challenging, especially if you want to use your smartphone to manage them.

Fortunately, there’s a free, feature-rich, open-source mobile app called WLED that makes controlling addressable LEDs much easier, convenient, and even fun! In this tutorial, we’ll show you how to install WLED on an ESP32 board and use it to control a string of addressable LEDs.

Parts you will need :

WS2812b RGB Addressable DIGITAL LEDS strip

1x ESP32

1x 1nmp441 I2S mic (or any other this was best as far as my experience)

bunch of female-to-male / female-to-female jumper wire

5v power supply (you can use a phone charger)

Laptop to configure.

Installing WLED on an ESP32 Board is easy. Here’s what you need to do:

1. Connect your ESP32 board to your computer using a USB cable that supports data transfer.

2. Open a web browser and go to install.wled.me. Make sure your browser supports Web Serial (such as Google Chrome, Microsoft Edge, or Opera).

3. Click “Install.”

4. Select the COM port to which your ESP32 is connected and click “Connect.” WLED uses the 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.

5. Click “Install WLED” to begin the installation process.

6. Confirm the installation to flash the firmware to the board. Be aware that all data on the device will be erased. Some ESP32 boards require you to press the BOOT button before selecting the final install button.

7. The installation process should start, and it will only take a few minutes to complete. You can release the BOOT button as it was able to connect.

8. Click “Next” to complete the installation.

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. Note that the Wi-Fi network must be 2.4 GHz; the ESP32 does not support 5 GHz networks.

NOTE: 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).

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

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 a few LEDs you can plug the ESP32 into your computer using a USB cable and power the strip directly through the board.

Circuit connections

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.

Once the 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.

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

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

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.

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

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

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.

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.

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.

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

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.

A Quick Tour of the WLED UI.

WLED’s User Interface may appear overwhelming at first, but it’s simple to use once you get used to it. Here’s a quick overview:

1. Configuration: This section contains buttons like Power (to turn the lights on or off), Timer (to set when the lights should turn on and off), Sync (to synchronize multiple WLED devices across your network), Peek (to preview animation effects), 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 lets you change the color of the LEDs, whether they are static or animated. You can access various color palettes for use in effects by scrolling down this section.

3. Effects/Animation: Here you’ll find a library of ready-made animations for your lights. Each effect has its own color scheme, but 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.

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 the installation is complete, select the LEDs type, pin numbers, length, and color order of your LED strips on 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)

--

--