Intellidwell Logo Docs
Quiz Web App ↗

💾 Firmware & Flashing Guide

The system utilizes two distinct firmware builds: one lightweight transmitter firmware for the Seeed Studio XIAO ESP32-C3 remotes, and one coordinator firmware for the ESP32 DevKit V1 Base Station Hub.

1. Remote Firmware (XIAO ESP32-C3)

The remote firmware configures internal pull-ups on pins D0–D3 (GPIO 2, 3, 4, 5), initializes ESP-NOW on Channel 1, registers a low-power deep sleep timer with GPIO wakeup interrupts, and handles LED status feedback.

Configuring Remote ID (remote_xiao_esp32c3.ino)
// Set this unique ID for each remote (1, 2, 3, 4, 5, 6, 7, 8)
#define REMOTE_ID               1

// WiFi Channel (Must match Base Station Hub)
#define ESPNOW_WIFI_CHANNEL     1

// Button Pins (Active LOW with internal pull-up)
#define PIN_BTN_A       D0   // GPIO2  - Choice A (Red / True)
#define PIN_BTN_B       D1   // GPIO3  - Choice B (Blue / False)
#define PIN_BTN_C       D2   // GPIO4  - Choice C (Yellow)
#define PIN_BTN_D       D3   // GPIO5  - Choice D (Green)
#define PIN_LED_STATUS  D4   // GPIO6  - Feedback LED / NeoPixel

2. Base Station Hub Firmware (ESP32 DevKit V1)

The Base Station acts as the master coordinator. It stays in continuous radio listening mode, timestamps buzz arrivals with sub-millisecond precision, sends ACK/lockout packets back to remotes, and writes formatted JSON lines to the USB Serial port at 115200 baud.

Base Station Hub Highlights (base_station_esp32.ino)
#define ESPNOW_WIFI_CHANNEL     1
#define SERIAL_BAUD_RATE        115200

#define PIN_LED_ONBOARD         2   // Blue activity LED
#define PIN_BUZZER              25  // Optional Piezo chime
#define PIN_LED_STATUS_OPEN     26  // Green (Buzzers Open)
#define PIN_LED_STATUS_LOCKED   27  // Red (Buzzers Locked)
#define PIN_BTN_MANUAL_RESET    0   // DevKit BOOT button

3. Step-by-Step Flashing Walkthrough

Flashing with Arduino IDE:

  1. Open Arduino IDE (v2.0+ recommended).
  2. Ensure the ESP32 board package is installed via Settings → Additional Board Manager URLs:
    https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
  3. For Remotes: Open quiz/firmware/remote_xiao_esp32c3/remote_xiao_esp32c3.ino, select board XIAO_ESP32C3, change #define REMOTE_ID to match the target unit (1–8), connect via USB-C, and click Upload.
  4. For Base Station: Open quiz/firmware/base_station_esp32/base_station_esp32.ino, select board DOIT ESP32 DEVKIT V1, select the COM port, and click Upload.

Flashing with PlatformIO:

PlatformIO CLI Commands
# Flash XIAO ESP32-C3 Remote:
cd /home/nelsonserver/websites/quiz/firmware/remote_xiao_esp32c3
pio run -t upload

# Flash ESP32 DevKit V1 Base Station:
cd /home/nelsonserver/websites/quiz/firmware/base_station_esp32
pio run -t upload