Skip to content

Audio Visualizer for ESP32 using HUB75 matrix and INMP441 microphone

Notifications You must be signed in to change notification settings

troyhacks/AuroraDrop-LXP

 
 

Repository files navigation

AuroraDrop LXP v1.0.0

RGB Matrix Audio Visualiser for ESP32

Forked from AuroraDrop by uklooney, based on the FastLED Auroa Demo by Jason Coon, and using the ESP32-HUB75-MatrixPanel-I2S-DMA library by mrfaptastic. Audio reactive and I2S code from the WLED usermod "AudioReactive" - and some love from MoonModules WLED fork as well.

Introduction

AuroraDrop LXP currently works only with HUB75 matrix panels and an INMP441 microphone. The goal of this fork is to make a functional audio visualization display with zero interaction on the end-user's part. This means no web server, no network audio, no TFT displays, no LED strips, etc.

Major goals of this fork are:

  • Using the INMP441 microphone for audio input (other I2S inputs will often work with minor modifications)
  • Automatic gain control
  • Basic BPM detection
  • Code cleanup to ease future modification
  • Removal of all functions that aren't used with the specific target hardware
  • ...and some sort of physical integration with the panel that isn't a jumble of wires.

I suggest referring to the original AuroraDrop project for details on wiring or if you have other needs past HUB75+INMP441 integrations.

Hardware Recommendations

This code has been tested with up to FOUR 64x64 pixel HUB74 "E" panels in a horizontal layout on an ESP32-S3 with 2MB of PSRAM. Also works fine with 64x32 panels (tested with two, expect more will work). A few effects need some love for widths > 128 pixels, and some are disabled based on this logic.

At 256 pixels wide the framereate does sometimes suffer - but if you play with the playlist sizes and pick effects that are very fast, 30fps is attainable on 64x256 (four panels) - which is 16,384 LEDs!

Pxl.20221219.150138079.Ts_smaller.mp4

The recommended ESP32 target for the project is specificially the ESP32-S3-DevKitM-1 board.

https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitm-1.html

The board was selected because the ESP32-HUB75-MatrixPanel-I2S-DMA driver has optimizations for the ESP32-S3 which makes it faster, and the ESP32-S3-DevKitM1 (not DevKitC1) board has a VERY advantageous pin arrangement that can be used to directly attach to the HUB75 connector (with some pin header bending!). It doesn't have PSRAM, but that doesn't seem to be as needed at the moment.

PXL_20221225_043408744 PXL_20221225_193802738

Larger matrix widths (over 128 wide) have been tested with a non-Espressif 3rd-party ESP32-S3-DevKitC1 "style" board - the pinout is better than the Espressif devkit-C1 so we can get 16 pins in an even 2x8 continuous spacing.

At the moment I'm not sure if the PSRAM is helping large widths - or it's other fixes I've done. Either way, the PSRAM is indeed in use in the HUB75 panel driver if you enable it and your board supports it. There may be other benefits of the S3 with the ESP32-HUB75-MatrixPanel-I2S-DMA driver as well.

Audio Input - INMP441 I2S

The audio input is accomplished with the INMP441 microphone. Commonly available circular breakout boards have the needed resistor and capacitor on the breakout.

If you happen to wire this up on a breadboard, make sure to run a ground between the panel (or the panel PSU) and the ESP32 if you don't have one already.

The panels will (mostly) work fine without a ground, but the I2S mic will become hilariously unstable and lead you down a rabbit hole for a week trying to figure out why the mic never seems like it's capturing real audio data.

I've had 100 issues with I2S in general - there's code in there to try and work around bugs in particular ESP IDF versions - but sometimes the "L/R" or "LR" pin just needs to be moved from GND to VCC or vice-versa to make it work, even with the compile-time fixes.

Ideally the "L/R" (or "LR") pin should be to ground, but I've had times where it's to VCC even with the in-line fixes, on different boards with the same ESP32-S3 chip and the same ESP IDF. I have no clue why. It does seem to be the board/chip and not the mic but ¯⁠\⁠_⁠(⁠ツ⁠)⁠_⁠/⁠¯

Latest Updates

1.0.0 (WIP)

  • Imported much more robust audio reactive code from the WLED AudioReactive usermod
    • ...with some nice finishing touches from MoonModules' version of the same usermod ( I ❤️ MoonModules )
  • Code cleanup (lots) ** I've expanded a lot of the more dense syntax to make the code easier to understand.
  • Better scaling of all the FFT bins based on AudioReactive code
  • Automatic gain control (now courtesy of AudioReactive)
  • I2S code modernizarion for new ESP32 APIs (now courtesy of AudioReactive hints)
  • Basic BPM detection
  • Removal of other hardware targets
  • Deactivation or optimization of some very CPU intensive effects
  • RGB LED on ESP32-S3 boards to do basic frames-per-second monitoring (now via FastLED) ** You could also add a single WS2811 or similar if your board doesn't have one
  • Removal of webserver and networking code
  • Added a generic "NOOP" effect so we can do nothing, intentionally, in a playlist.
  • Optional pot for global brightness control (use a 10k pot)
  • Optional use of a button (like "boot") to control debug display
  • Fixes and/or disable logic for some effects when MATRIX_WIDTH > 128 pixels
  • A few new effects and some zjuzhing and bugfixes on existing ones
  • Organization of background, foreground, sound, and static patterns into their own specific layers

Bugs

  • After working with the WLED audio reactive code, I've come to realize that squelch is needed - and broken in my code. The current stste will always keep amplifying until it finds "something" to visualize. Should be easy to fix.

Libraries

Based on

Lots, including...

Why "LXP" ???

This started off as just grabbing some different LED panels off Amazon to see what they could do.

Once I discovered AuroraDrop I decided to take this on as a Christmas present. I discuss lots of my ongoing projects with the intended recipient, so I just told them it was my secret project "LXP"...

...which stood for "Leigh's Xmas Present"

About

Audio Visualizer for ESP32 using HUB75 matrix and INMP441 microphone

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 97.6%
  • C 2.4%