Skip to content

🎵 🌈 Real-time LED strip music visualization running on ESP32 based on Arduino or ESPHome platform

License

Notifications You must be signed in to change notification settings

phdelodder/audio-reactive-led-strip

 
 

Repository files navigation

中文

Music LED Strip

Real-time LED strip music visualization running on ESP32, based on Arduino or ESPHome platform(ESPHome can connect to HomeAssistant easily).

Effect Show

You can find more video on https://lw.hachina.io

Hardware

Hardware needed

Note:

  • The FastLED libary is used by the program, so the led strip we support is the same as FastLED

Microphone Shield

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)

Phisical link

How to use on ESPHome

copy file music_leds_esphome.h and directory include to the ESPHome's config directory

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 ESPHome Yaml

** config led strip **

  1. Generate the basic configuration yaml in ESPHome by wizard.
  2. Add includes of music_leds_esphome.h in domain esphome (as example below)
  3. Config the fastled light
  4. Add addressable_lambda effect of the fastled light (as example below)
  5. Compile and upload the firmware.
  6. 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, and N_PIXELS in music_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

How to use in Arduino

Install ESP32 Board in Arduino

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.

Install Fastled library in Arduino

Search and install FastLED in menu Sketch/Include Library/Manage Libraries....

Clone the project

git clone https://github.com/zhujisheng/audio-reactive-led-strip

Compile&Upload
  1. Open audio-reactive-led-strip.ino in Arduino
  2. Connect to ESP32 by the USB
  3. Select the correct Board and Port in the menu Tools
  4. Upload
  5. you should modify N_PIXELS and the calling method of FastLED.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.

Thanks

https://github.com/scottlawsonbc/audio-reactive-led-strip

Zack-Xu, designer of the microphone shield PCB.

About

🎵 🌈 Real-time LED strip music visualization running on ESP32 based on Arduino or ESPHome platform

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 70.1%
  • Python 29.9%