Ecualizador Digital de 6 Bandas
Table
| Banda | Función | GPIO ESP32 | Pin del DevKit | Net esquemático | ADC |
|---|---|---|---|---|---|
| 1 Graves | Wiper RV1 | 39 | VN / Sensor_VN | BAND1_GRAVES_ADC1_CH3_GPIO39 | ADC1_CH3 |
| 2 | Wiper RV2 | 36 | VP / Sensor_VP | BAND2_ADC1_CH0_GPIO36 | ADC1_CH0 |
| 3 | Wiper RV3 | 33 | IO33 | BAND3_ADC1_CH5_GPIO33 | ADC1_CH5 |
| 4 | Wiper RV4 | 32 | IO32 | BAND4_ADC1_CH4_GPIO32 | ADC1_CH4 |
| 5 | Wiper RV5 | 35 | IO35 | BAND5_ADC1_CH7_GPIO35 | ADC1_CH7 |
| 6 Agudos | Wiper RV6 | 34 | IO34 | BAND6_AGUDOS_ADC1_CH6_GPIO34 | ADC1_CH6 |
| Alimentación potenciómetros | Extremo fijo CW | 3.3V | 3V3 | 3V3 | — |
| Retorno potenciómetros/filtros | Extremo fijo CCW y capacitores | GND | GND | GND | — |
Nota: GPIO34–GPIO39 son solo entrada, ideal para ADC. Todos los controles están en ADC1 para mantener compatibilidad con WiFi del ESP32.
platformio.iniIni
[env:esp32dev] platform = espressif32 board = esp32dev framework = arduino monitor_speed = 115200 upload_speed = 921600
src/main.cppCpp
#include <Arduino.h> #define BAND1_GRAVES_PIN 39 #define BAND2_PIN 36 #define BAND3_PIN 33 #define BAND4_PIN 32 #define BAND5_PIN 35 #define BAND6_AGUDOS_PIN 34 static const uint8_t NUM_BANDS = 6; static const int adcPins[NUM_BANDS] = { BAND1_GRAVES_PIN, BAND2_PIN, BAND3_PIN, BAND4_PIN, BAND5_PIN, BAND6_AGUDOS_PIN }; static const char* bandNames[NUM_BANDS] = { "Graves", "Banda2", "Banda3", "Banda4", "Banda5", "Agudos" }; static const uint16_t ADC_MAX_COUNTS = 4095; static const uint8_t OVERSAMPLE_COUNT = 16; static unsigned long lastPrintMs = 0; uint16_t readAdcAveraged(uint8_t pin) { uint32_t acc = 0; for (uint8_t i = 0; i < OVERSAMPLE_COUNT; i++) { acc += analogRead(pin); delayMicroseconds(250); } return acc / OVERSAMPLE_COUNT; } float normalizedBandGain(uint16_t raw) { // 0.0 = slider abajo, 1.0 = slider arriba. Ajustar aquí si se desea curva logarítmica. return constrain((float)raw / (float)ADC_MAX_COUNTS, 0.0f, 1.0f); } void setupAdc() { analogReadResolution(12); analogSetAttenuation(ADC_11db); // rango práctico cercano a 0–3.3V en ESP32 Arduino for (uint8_t i = 0; i < NUM_BANDS; i++) { pinMode(adcPins[i], INPUT); } } void setup() { Serial.begin(115200); delay(500); setupAdc(); Serial.println("Ecualizador digital ESP32 — lectura de 6 bandas ADC1"); } void loop() { uint16_t raw[NUM_BANDS]; float gain[NUM_BANDS]; for (uint8_t i = 0; i < NUM_BANDS; i++) { raw[i] = readAdcAveraged(adcPins[i]); gain[i] = normalizedBandGain(raw[i]); } if (millis() - lastPrintMs >= 100) { lastPrintMs = millis(); for (uint8_t i = 0; i < NUM_BANDS; i++) { Serial.printf("%s GPIO%d raw=%u gain=%.3f%s", bandNames[i], adcPins[i], raw[i], gain[i], (i == NUM_BANDS - 1) ? "\n" : " | "); } } // Aquí se integraría el DSP real: mapear gain[] a coeficientes de filtros IIR/FIR. }
Bash
pio run pio run -t upload pio device monitor
Welcome 👋
Flux helps you build PCBs faster with an AI teammate!
Create your account to collaborate, stay updated, fork your own version, and get instant answers from our AI agent.