GithubHelp home page GithubHelp logo

geoffdavis / audio-reactive-led-strip Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zhujisheng/audio-reactive-led-strip

0.0 1.0 1.0 16.12 MB

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

License: GNU General Public License v3.0

C++ 70.15% Python 29.85%

audio-reactive-led-strip's Introduction

中文

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.

audio-reactive-led-strip's People

Contributors

zhujisheng avatar

Watchers

 avatar

Forkers

klaernie

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.