Festival Carousel Horse LED Controller Schematic
DMX_PLUS / DMX_MINUS, and updated the battery monitor divider to R32=10kΩ / R33=3.3kΩ.I2C_SDA / I2C_SCL, dual XLR connectors are wired in parallel, and the user-input nets remain present for the 11 pots, 5 illuminated pushbuttons, and 4 toggles including LOW_BATT_OVERRIDE.pio runpio run -t uploadpio device monitorTable
| Function | GPIO / Pin | Schematic net | Notes |
|---|---|---|---|
| I2C SDA | GPIO23 | I2C_SDA | OLED + MCP23017 |
| I2C SCL | GPIO25 | I2C_SCL | OLED + MCP23017 |
| DMX RX | U1 RX / GPIO3 | DMX_RX | UART receive from SP3485 RO |
| DMX TX | U1 TX / GPIO1 | DMX_TX | UART transmit to SP3485 DI |
| DMX DE/RE | GPIO26 | DMX_DE_RE | HIGH transmit, LOW receive |
| LED 1..8 | GPIO13,14,16,17,18,19,21,22 | ESP_LED1..8 | WS2815 data via 74HCT245 + 330R |
| Pots | VP,VN,GPIO34,35,33,4,15,2,12,0,5 | POT1_ADC..POT11_ADC | Analog controls; review boot-strap use in firmware/prototype |
| Battery ADC | GPIO32 | BATTERY_ADC | 100k/22k divider: 15V input ≈ 2.70V ADC |
| Current sense ADC | GPIO33 | CURRENT_SENSE_ADC | LM358 low-side shunt sense output |
| Buttons/toggles | MCP23017 GPA0..4, GPB0..3 | BTN1..5, TOGGLE_*, LOW_BATT_OVERRIDE | I2C expander inputs |
platformio.iniIni
[env:esp32dev] platform = espressif32 board = esp32dev framework = arduino monitor_speed = 115200 lib_deps = adafruit/Adafruit SSD1306@^2.5.10 adafruit/Adafruit GFX Library@^1.11.9 adafruit/Adafruit MCP23X17@^2.3.2
Cpp
#include <Arduino.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #include <Adafruit_MCP23X17.h> #define PIN_I2C_SDA 23 #define PIN_I2C_SCL 25 #define PIN_DMX_RX 3 #define PIN_DMX_TX 1 #define PIN_DMX_DE_RE 26 const uint8_t LED_PINS[8] = {13,14,16,17,18,19,21,22}; const uint8_t POT_PINS[11] = {36,39,34,35,33,4,15,2,12,0,5}; #define PIN_BATTERY_ADC 32 #define PIN_CURRENT_ADC 33 Adafruit_SSD1306 display(128, 64, &Wire, -1); Adafruit_MCP23X17 mcp; HardwareSerial DMXSerial(2); void setDmxReceive() { digitalWrite(PIN_DMX_DE_RE, LOW); } void setDmxTransmit() { digitalWrite(PIN_DMX_DE_RE, HIGH); } void setupInputs() { for (uint8_t i = 0; i < 8; i++) pinMode(LED_PINS[i], OUTPUT); pinMode(PIN_DMX_DE_RE, OUTPUT); setDmxReceive(); for (uint8_t pin = 0; pin <= 8; pin++) mcp.pinMode(pin, INPUT); } void setup() { Serial.begin(115200); Wire.begin(PIN_I2C_SDA, PIN_I2C_SCL); DMXSerial.begin(250000, SERIAL_8N2, PIN_DMX_RX, PIN_DMX_TX); mcp.begin_I2C(0x20, &Wire); setupInputs(); display.begin(SSD1306_SWITCHCAPVCC, 0x3C); display.clearDisplay(); display.setTextSize(1); display.setTextColor(SSD1306_WHITE); display.setCursor(0,0); display.println("Carousel LED CTRL"); display.display(); } void loop() { uint16_t pots[11]; for (uint8_t i = 0; i < 11; i++) pots[i] = analogRead(POT_PINS[i]); uint16_t batt = analogRead(PIN_BATTERY_ADC); uint16_t current = analogRead(PIN_CURRENT_ADC); uint16_t inputs = 0; for (uint8_t pin = 0; pin <= 8; pin++) if (mcp.digitalRead(pin)) inputs |= (1 << pin); display.clearDisplay(); display.setCursor(0,0); display.printf("BattADC:%u\nCurrADC:%u\nInputs:%03X", batt, current, inputs); display.display(); while (DMXSerial.available()) { uint8_t b = DMXSerial.read(); (void)b; } delay(50); }
Vin = Vadc * (122.0 / 22.0).Platform & Toolchain
Pin Mapping
`platformio.ini`
Complete Starter Source
Bring-up Notes