Real-time LED strip music visualization running on ESP32, based on Arduino or ESPHome platform(ESPHome can connect to HomeAssistant easily).
You can find more video on https://lw.hachina.io
- Nodemcu 32S
- Microphone Shield of HAChina
- Led Strip
Note:
- The FastLED libary is used by the program, so the led strip we support is the same as FastLED
The Microphone Shield of Hachina includes a PDM microphone, an Touch Pad, post connectors(making connection to led strip easily).
The Microphone Shield can connect to nodemcu-32s directly and easily.
Note:
- You can use your own microphone linked to ESP32 instead of the Microphone Shield
- The software only support PDM microphone. If you use I2S microphone, you should modify the program(I2s is supported by ESP32-IDF)
git clone https://github.com/zhujisheng/audio-reactive-led-strip
cp -r audio-reactive-led-strip/includes/ ~/esphome_config/
cp audio-reactive-led-strip/music_leds_esphome.h ~/esphome_config/
Note: You can use other commands or tools to download and copy.
** config led strip **
- Generate the basic configuration yaml in ESPHome by wizard.
- Add includes of
music_leds_esphome.h
in domainesphome
(as example below) - Config the fastled light
- Add
addressable_lambda
effect of the fastled light (as example below) - Compile and upload the firmware.
- Config the esphome in HomeAssistant
Note:
- When you upload the firmware, you should press the IO0 button on NodeMCU 32S
- ESP32 may can't start up under poor power supply.
- If the number of LEDS is not 60, please modify the
num_leds
in ESPHome's configuration YAML, andN_PIXELS
inmusic_leds_esphome.h
meanwhile.
esphome:
name: ......
platform: ESP32
board: ......
includes:
- music_leds_esphome.h
- includes/FFT.h
- includes/ExpFilter.h
- includes/VisualEffect.h
- includes/gaussian_filter1d.h
......
light:
- platform: fastled_clockless
# - platform: fastled_spi
id: LedsStrip
chipset: NEOPIXEL
#chipset: APA102
pin: GPIO21
#data_pin: GPIO21
#clock_pin: GPIO17
num_leds: 60
#rgb_order: BGR
name: "MUSIC LEDS"
effects:
- addressable_rainbow:
- addressable_lambda:
name: Scroll with Music
update_interval: 0s
lambda: |-
music_leds.ShowFrame(MODE_SCROLL, &it);
- addressable_lambda:
name: Energy with Music
update_interval: 0s
lambda: |-
music_leds.ShowFrame(MODE_ENERGY, &it);
- addressable_lambda:
name: Spectrum with Music
update_interval: 0s
lambda: |-
music_leds.ShowFrame(MODE_SPECTRUM, &it);
** Config TouchPad **
Configuration below is for the TouchPad on the microphone shield. you can find here, more about the TouchPad of ESP32.
esp32_touch:
# setup_mode: True
binary_sensor:
- platform: esp32_touch
name: "Touch Pad on ESP32"
pin: GPIO32
threshold: 1000
on_press:
then:
- light.toggle: LedsStrip
Add ESP32's package url in Additional Boards Manager URLs
of the menu Preferences
:
https://dl.espressif.com/dl/package_esp32_index.json
Open Boards manager...
in menu Tools
. Search ESP32
, then install it.
Search and install FastLED
in menu Sketch
/Include Library
/Manage Libraries...
.
git clone https://github.com/zhujisheng/audio-reactive-led-strip
- Open
audio-reactive-led-strip.ino
in Arduino - Connect to ESP32 by the USB
- Select the correct
Board
andPort
in the menuTools
- Upload
- you should modify
N_PIXELS
and the calling method ofFastLED.addLeds
in fileaudio-reactive-led-strip.ino
, if you want to use led strip with not 60 leds on it, or it's SPI connectted.
https://github.com/scottlawsonbc/audio-reactive-led-strip
Zack-Xu, designer of the microphone shield PCB.