ESP32 spectrum analyser VU meter

Опубликовано: 15 Февраль 2026
на канале: ARTNICS
149
0

ESP32 spectrum analyser VU meter

Credits:
Audio :    • Bhaavam by Job Kurian  

Code : The code is heavily modified from    • ESP32 spectrum analyser VU meter using ard...  

...........................................................................................................

This hobby project is implemented using the hardwares:
ESP32 WROOM32
MAX4466 Electret Microphone Amplifier
WS2812B gel wire addressable LED

............................................................................................................
To create value for LED array FastLED XY Map Generator is used with options
Serpentine, Vertical, V-flip selected



FastLED XY Map Generator : https://macetech.github.io/FastLED-XY...

............................................................................................................

References :

Custom mapped matrix https://github.com/marcmerlin/FastLED...

............................................................................................................

IDE and libraries :

Arduino IDE - 1.8.19
FastLED-NeoMatrix - 1.1.0
FastLED - 3.7.0

Board Manager :

esp32 - 1.0.2

............................................................................................................

Notes :


#define NOISE 1750 // 500 Used as a crude noise filter, values below this are ignored
#define AMPLITUDE 4250 // Depending on your audio source level, you may need to alter this value. Can be used as a 'sensitivity' control.


#define SAMPLES 1024 // Must be a power of 2
#define SAMPLING_FREQ 40000 // Hz, must be 40000 or less due to ADC conversion time. Determines maximum frequency that can be analysed by the FFT Fmax=sampleF/2.


#define AUDIO_IN_PIN 35 // Signal in on this pin


#define COLOR_ORDER GRB // If colours look wrong, play with this
#define CHIPSET WS2812B // LED strip type
#define MAX_MILLIAMPS 2000 // Careful with the amount of power here if running off USB port
#define LED_VOLTS 5 // Usually 5 or 12
#define NUM_BANDS 8 // To change this, you will need to change the bunch of if statements describing the mapping from bins to bands

const uint8_t kMatrixWidth = 8; // Matrix width
const uint8_t kMatrixHeight = 8; // Matrix height
#define NUM_LEDS (kMatrixWidth * kMatrixHeight) // Total number of LEDs
#define BAR_WIDTH (kMatrixWidth / (NUM_BANDS - 1))
#define TOP (kMatrixHeight - 0) // Don't allow the bars to go offscreen




// Define matrix width and height.
FastLED_NeoMatrix *matrix = new FastLED_NeoMatrix(leds, kMatrixWidth, kMatrixHeight,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_ROWS + NEO_MATRIX_PROGRESSIVE);


uint16_t myRemapFn(uint16_t x, uint16_t y) {

int arrayIndex = ( (y*8)+x);

//visit website to generate array https://macetech.github.io/FastLED-XY...
//select serpentine, vertical and v-flip

uint16_t arrayLEDsequence [] = {
7, 8, 23, 24, 39, 40, 55, 56,
6, 9, 22, 25, 38, 41, 54, 57,
5, 10, 21, 26, 37, 42, 53, 58,
4, 11, 20, 27, 36, 43, 52, 59,
3, 12, 19, 28, 35, 44, 51, 60,
2, 13, 18, 29, 34, 45, 50, 61,
1, 14, 17, 30, 33, 46, 49, 62,
0, 15, 16, 31, 32, 47, 48, 63
};

return arrayLEDsequence[arrayIndex];


}




matrix-setRemapFunction(myRemapFn); // Angled brackets are not allowed in description,so removed it after matrix-