Wildly blinking LEDs may not be the ideal lighting, but they�ll surely spice up any party. And since a party without music is boring, having both synced up is a great way to set the mood.

When it comes to sound-reactive lighting, WLED is without a doubt the best option. It�s a free, feature-rich, open-source mobile app that gives us complete command over a wide variety of NeoPixel LEDs. With the help of a MAX4466-amplified microphone connected to an ESP32, this app allows you to sync an LED strip with music. Additionally, you can select from more than 30 distinct sound-reactive effects and more than 70 color palettes to make the party even more fun.

In this tutorial, you will learn how to connect a strip of WS2812B LEDs and a MAX4466 microphone amplifier module to an ESP32 board and install WLED-SR (the sound-reactive version of WLED).

Things You Will Need

For this project, you will need the following items:

  • An ESP32 Development board
  • A WS2812B addressable LED strip
  • A MAX4466 microphone amplifier module
  • A 5V power supply (with a rating of 3A or higher)

Installing WLED-SR 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 2

3. From the dropdown menu, you will need to select the �sound-reactive� version of WLED, which can be found as the bottom option.

select sound reactive version of wled

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.

4. Click Install.

click install wled

5. 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.

wled select com port

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.

If your ESP32 isn�t connecting, you might need to press and hold the BOOT button while connecting.

6. Click �Install WLED SR� to begin the process.

wled sr install button

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

wled sr final installation confirmation

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

8. 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 sr installing

9. Click Next to complete the installation.

wled sr installation complete

10. Select the Network icon on the taskbar. You should notice a new wireless access point named WLED-AP.

wled ap network

11. Join that and then enter wled1234 if prompted for a password.

wled ap network joined

12. When you connect to the network, your default browser will launch automatically and load the WLED home page. If it doesn�t launch for some reason, open a new browser and navigate to http://4.3.2.1, which should take you to the same location.

wled sr access point home page

13. Select WIFI Settings. This will bring up the WIFI Setup section.

wled ap mode wifi settings

14. Change the Network Name and Network Password to the name and password for your WiFi network. 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 wifi settings updated

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

15. Click Save and Connect. Your ESP32 will reboot and connect to your WiFi network. However, it is a good idea to reset your ESP32 by pressing the EN button.

wled wifi settings save and connect

16. Finally, make sure that you reconnect to your home network.

17. Now navigate to your mDNS address (in my case it�s http://mylights.local/) to access the WLED User Interface (UI).

wled accessed through new address

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

Once the setup is complete it�s a good idea to head to the configuration section.

Configuring Sound Input

1. Click on �Config� and then select �Sound Settings.�

wled sr sound settings

2. Scroll down to �Sound Input Pin Manager� and change the �Analog input pin� number to 35. This pin will be used to connect to the output pin of the MAX4466 microphone amplifier module.

wled sr analog input pin selection

3. Click �Save.�

wled sr save sound settings

4. Finally, click �Back� to return to the main screen.

wled sr return to main page

Configuring LED lights

1. Click on Config and select �LED Preferences�.

wled sr 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 up to the top and click �Save�.

wled save led preferences

7. Click �Back� to return to the main screen.

wled return to main page

Connecting the Hardware

Once you�ve finished configuring the WLED, unplug the ESP32 from the USB port. Now, let�s proceed to connect the addressable LED strip and the MAX4466 module to the ESP32.

The wiring for the addressable LED strip is relatively straightforward. You�ll need to connect just three wires: 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.

Now, let�s connect the MAX4466 module to the ESP32. The VCC of the MAX4466 module can range between 2.4-5VDC. For optimal performance, it�s recommended to use the 3.3v pin as it provides the �quietest� supply on the ESP32. Therefore, connect the module�s VCC pin to the ESP32�s 3.3V pin and the GND pin to the ground. Lastly, connect the OUT pin of the module to the ESP32�s ADC pin, GPIO35.

If you have few LEDs, you can connect the ESP32 to your computer (or a wall charger) with a USB cable and power the strip directly from the board.

connecting ws2812b led strip and max4466 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 led strip and max4466 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 30 distinct sound-reactive effects. This is where the real fun begins.

1. Navigate to the Effects tab and choose an effect that displays a musical-note symbol before its name. The LEDs will respond immediately.

wled app sound reactive effect selection

2. You can change the Rate of fall, sensitivity and LED brightness to customize the effects.

wled app effect sensitivity brightness rate of fall

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

Adjusting the Sensitivity

Depending on the source of the sound, you may need to adjust the gain of the MAX4466 module. The gain basically determines how much the module amplifies the sound signal, and thus the sensitivity to sound.

max4466 module gain trimmer

To adjust the gain, locate the small trimmer potentiometer on the back of the MAX4466 module and use a small straight-bladed screwdriver to make the necessary adjustments. The gain range can be set anywhere from 25x to 125x. Turning the potentiometer counterclockwise (CCW) increases the gain, while turning it clockwise (CW) decreases the gain.

Make all gain adjustments gently. If you feel resistance, stop immediately. The tiny trim pot is delicate and can be easily damaged if turned beyond its limits.

You can also adjust the sound sensitivity through WLED settings to suit your requirements. To adjust the sound sensitivity, navigate to Config > Sound Settings.

wled sound squelch gain setting

Here, you�ll find two settings:

  • Squelch: This represents the minimum threshold at which the lights will display any color or effect. The higher the value, the louder the sound required to trigger the LEDs.
  • Gain: This setting controls the sound sensitivity. The higher the value, the higher the sensitivity.

Feel free to play with these settings until you achieve the optimal experience for your setup.


Login
ADS CODE