# Mirror HUD Display - ESP32 (SPI Interface) ESP32-based mirror display for EUC battery and speed data via BLE. ## Hardware Configuration ### Waveshare 1.51" Transparent OLED (SSD1309) - **Interface**: SPI (4-wire) - **Resolution**: 128x64 - **Controller**: SSD1309 ### Wiring for Standard ESP32 DevKit (SPI Interface) | OLED Pin | ESP32 Pin | Description | |----------|-----------|-------------| | VCC | 3.3V | Power Supply | | GND | GND | Ground | | CLK | GPIO 18 | SPI Clock (SCK) | | DIN | GPIO 23 | SPI Data (MOSI) | | RES | GPIO 16 | Reset | | DC | GPIO 17 | Data/Command | | CS | GPIO 5 | Chip Select | ### Pin Configuration ```cpp #define OLED_CLK 18 // SPI Clock (SCL/SCK) #define OLED_MOSI 23 // SPI Data (SDA/MOSI) #define OLED_RES 16 // Reset #define OLED_DC 17 // Data/Command #define OLED_CS 5 // Chip Select ``` ## BLE Configuration - **Device Name**: `mirror-hud` - **Service UUID**: `12345678-1234-1234-1234-123456789abc` - **Battery Characteristic**: `87654321-4321-4321-4321-cba987654321` - **Speed Characteristic**: `11111111-2222-3333-4444-555555555555` ## Build & Upload ```bash # Navigate to project cd /Users/seb/euc/mirror-display # Build for ESP32 pio run # Upload and monitor pio run --target upload --target monitor ``` ## Display Behavior ### Boot Sequence 1. **Power on**: Shows "tangerine" in large text with border 2. **BLE Ready**: Shows "tangerine" with connection status 3. **Data Received**: Switches to EUC HUD display ### Data Display Layout ``` ┌─────────────────────────────┐ │ CONN │ │ EUC HUD │ │ │ │ 25.4 km/h │ │ │ │ Batt: 85.2% [████████░░] │ └─────────────────────────────┘ ``` ## Troubleshooting ### SPI Connection Issues - Verify all 7 wire connections (VCC, GND, CLK, DIN, RES, DC, CS) - Check 3.3V power supply (not 5V!) - Ensure ESP32 SPI pins are correct (18, 23, 5, 16, 17) - Try different ESP32 board if issues persist ### Display Issues - Serial monitor shows SPI initialization steps - Look for "✓ U8g2 SPI initialization successful!" - Check for "SPI OLED should now show 'tangerine'!" message ### Common SPI Wiring Mistakes - **CLK/DIN swapped**: Double-check GPIO 18 (CLK) and GPIO 23 (DIN) - **Missing DC/CS**: Data/Command and Chip Select are required - **Power issues**: Must use 3.3V, not 5V - **Loose connections**: SPI requires all connections to be solid ## Alternative Pin Configuration If default pins don't work, try: ```cpp #define OLED_CLK 14 // Alternative SPI Clock #define OLED_MOSI 13 // Alternative SPI Data #define OLED_CS 15 // Alternative Chip Select #define OLED_DC 2 // Alternative Data/Command #define OLED_RES 4 // Alternative Reset ```