# 🎯 WiFiX-Enhanced Pin Reference Card

## Quick Reference Guide

### ESP32 Pin Map
```
┌─────────────────────────────────────────────────────────────────────┐
│ ESP32 DevKit V1 Pinout (30-pin)                                    │
├─────────────────────────────────────────────────────────────────────┤
│ 3.3V  [●] Power Out → All Modules                                  │
│ GND   [●] Ground → All Modules                                     │
│                                                                     │
│ I2C (OLED Display):                                                 │
│ GPIO21 [●] → OLED SDA (Blue Wire)                                │
│ GPIO22 [●] → OLED SCL (Yellow Wire)                               │
│                                                                     │
│ SPI (SD Card):                                                      │
│ GPIO23 [●] → SD MOSI (Green Wire)                                 │
│ GPIO19 [●] → SD MISO (Orange Wire)                                │
│ GPIO18 [●] → SD CLK (Purple Wire)                                 │
│ GPIO5  [●] → SD CS (White Wire)                                    │
│                                                                     │
│ UART (BW16 Module):                                               │
│ GPIO16 [●] → BW16 TX (Gray Wire)                                 │
│ GPIO17 [●] → BW16 RX (Brown Wire)                                │
│                                                                     │
│ Status LED (Optional):                                              │
│ GPIO2  [●] → LED + (330Ω resistor)                                 │
│ GND    [●] → LED -                                                │
└─────────────────────────────────────────────────────────────────────┘
```

### Wire Color Code
```
🔴 RED    : 3.3V Power
⚫ BLACK  : Ground (GND)
🔵 BLUE   : I2C SDA
🟡 YELLOW : I2C SCL
🟢 GREEN  : SPI MOSI
🟠 ORANGE : SPI MISO
🟣 PURPLE : SPI CLK
⚪ WHITE  : SPI CS
🔘 GRAY   : UART TX
🟤 BROWN  : UART RX
```

### Module Connections

#### OLED Display (I2C)
```
OLED Pin → ESP32 Pin → Wire Color
VCC      → 3.3V      → 🔴 Red
GND      → GND       → ⚫ Black
SDA      → GPIO21    → 🔵 Blue
SCL      → GPIO22    → 🟡 Yellow
```

#### SD Card Module (SPI)
```
SD Pin   → ESP32 Pin → Wire Color
VCC      → 3.3V      → 🔴 Red
GND      → GND       → ⚫ Black
MOSI     → GPIO23    → 🟢 Green
MISO     → GPIO19    → 🟠 Orange
CLK      → GPIO18    → 🟣 Purple
CS       → GPIO5     → ⚪ White
```

#### BW16 Module (UART)
```
BW16 Pin → ESP32 Pin → Wire Color
VCC      → 3.3V      → 🔴 Red
GND      → GND       → ⚫ Black
TX       → GPIO16    → 🔘 Gray
RX       → GPIO17    → 🟤 Brown
```

### Quick Tests

#### Power Test
```
1. Connect USB to ESP32
2. Measure 3.3V rail: 3.2-3.4V ✓
3. Current draw: <100mA idle ✓
```

#### Communication Test
```
I2C:  i2c_scanner → Address 0x3C ✓
SPI:  sd_test → Card detected ✓
UART: serial_test → BW16 responds ✓
```

### Emergency Commands

#### Serial Monitor
```
ESP32: pio device monitor -b 115200
BW16:  pio device monitor -b 115200 -p COM?
```

#### Reset Commands
```
ESP32: EN button (GPIO0 to GND)
BW16:  Reset button or power cycle
```

### Troubleshooting Quick Fix

#### No OLED Display
```
1. Check I2C address: 0x3C
2. Add pull-ups: 4.7kΩ on SDA/SCL
3. Swap SDA/SCL if reversed
```

#### SD Card Error
```
1. Check CS pin: GPIO5
2. Format card: FAT32
3. Try different card
```

#### BW16 No Response
```
1. Swap TX/RX if reversed
2. Check baud: 115200
3. Verify firmware loaded
```

### GPIO Usage Summary
```
Used GPIOs: 16, 17, 18, 19, 21, 22, 23, 5
Available: All others (2, 4, 12, 13, 14, 15, 25, 26, 27, 32, 33)
```

---
**Keep this card handy while building!** 🛠️