← MindPaw
Project files
11 KB
Machine-translated by Robotheca from the original in Chinese (opens in a new tab). License: MIT (opens in a new tab).
MindPaw Complete Pin Wiring Diagram (V2.0)
Final Solution After Replacing LD3320 with HLK-V20
1. ESP12F Complete Pin Assignment Table
ESP12F Package Pin Arrangement (chip-facing, top notch up):
┌─────────────────────────────────┐
│ RST □ TX □│← GPIO1 (UART TX) ✅ Idle!
│ ADC □ (A0, Battery Monitor) RX □│← GPIO3 (UART RX) ✅ Idle!
│ EN □ D5 □│← GPIO14 → Servo 1 SCK + OV2640 SCK
│ IO16□← D0 → Servo 2/Speaker D6 □│← GPIO12 → Servo 3 + OV2640 MISO
│ IO14□← D5 → Servo 1 D7 □│← GPIO13 → Servo 4 + OV2640 MOSI
│ IO12□← D6 → Servo 3 D8 □│← GPIO15 → OV2640 CS + 10 kΩ↓GND
│ IO13□← D7 → Servo 4 3V3□│
│ VCC□ GND□│
│ CLK□(Flash) GND□│
│ SDO□(Flash) 3V3□│
│ CMD□(Flash) EN □│
│ SD1□(Flash) RST □│
│ SD2□(Flash) GND □│
│ SD3□(Flash) D8□│← GPIO15
│ GND□ D4□│← GPIO2 → Button 1 (INPUT_PULLUP)
│ D3□│← GPIO0 → HLK-V20 TX (SoftwareSerial RX)
│ D1□│← GPIO5 → OLED SCL (I2C Clock)
│ ┌─ 3.3 V ─ Connected to SD3 ┐ D2□│← GPIO4 → OLED SDA (I2C Data)
└───────────────────────────────┘
2. Module Wiring Summary Table
| Module | ESP12F Pin | Connection Method | Notes |
|---|---|---|---|
| Servo 1 | GPIO14 (D5) | Signal wire → Servo1 orange wire | Shared via 1KΩ with OV2640 SCK |
| Servo 2 | GPIO16 (D0) | Signal wire → Servo2 orange wire | Exclusive (can be reassigned to speaker) |
| Servo 3 | GPIO12 (D6) | Signal wire → Servo3 orange wire | Shared via 1KΩ with OV2640 MISO |
| Servo 4 | GPIO13 (D7) | Signal wire → Servo4 orange wire | Shared via 1KΩ with OV2640 MOSI |
| Servo Power | VCC (5V external) | Servo red wire → 5V battery | ⚠️ Do not use ESP’s 3.3V |
| Servo Ground | GND | Servo brown wire → Common ground | — |
| OLED I2C | GPIO4 (D2) = SDA | I2C data line | 4.7KΩ pull-up to 3.3V |
| GPIO5 (D1) = SCL | I2C clock line | 4.7KΩ pull-up to 3.3V | |
| VCC → 3.3V, GND → GND | — | — | |
| OV2640 | GPIO15 (D8) = CS | CS → OV2640 CS | 10KΩ pull-down to GND (required!) |
| GPIO14 (D5) = SCK | 1KΩ → OV2640 SCK | Shared with Servo 1 | |
| GPIO13 (D7) = MOSI | 1KΩ → OV2640 MOSI | Shared with Servo 4 | |
| GPIO12 (D6) = MISO | 1KΩ → OV2640 MISO | Shared with Servo 3 | |
| VCC → 3.3V, GND → GND | — | Tested: 3.3V supply is sufficient | |
| SDA/SDI | → OV2640 SDA | SDA requires 4.7KΩ pull-up | |
| SCL/SIOC | → OV2640 SCL | Used with SDA for I2C control | |
| HLK-V20 | GPIO0 (D3) = UART RX | HLK-V20 TX → D3 | SoftwareSerial only receives |
| No RX connected | HLK-V20 RX left floating | Only connect via USB-TTL during PC configuration | |
| VCC → 3.3V~5V, GND → GND | — | Wide voltage range: 3.3~5V | |
| Speaker | GPIO16 (D0) | Signal → Transistor base | Alternative to Servo 2 |
| or keep Servo 2 | GPIO16 (D0) | Only connect Servo 2 | Use D2/D3 for speaker instead? |
| Button 1 | GPIO2 (D4) | Button → GND | INPUT_PULLUP |
| Battery ADC | A0 | Voltage divider → Battery+ | 8.4V→1.0V divider |
| Serial Debug | GPIO1 (TX) | USB-TTL RX | ✅ Fully reserved! |
| GPIO3 (RX) | USB-TTL TX | ✅ Fully reserved! |
3. Speaker Wiring Details
3.1 Passive speaker + transistor drive (recommended, ¥2)
The speaker itself requires 2 wires (two speaker pins), but controlling it only needs 1 GPIO:
+5V
│
╱
╱ Speaker (8Ω/0.5W)
╲
│
│ C
GPIO16(D0) ──[1KΩ]── B NPN transistor (S8050/2N2222)
E
│
GND
- Speaker itself: 2 wires (+ → 5V, - → transistor C pole)
- Control circuit: 1 GPIO + 1 1KΩ resistor + 1 NPN transistor
- Total pins used: 1 GPIO16
3.2 Active buzzer module (simplest, ¥1)
GPIO16(D0) ──→ Buzzer module signal pin
Buzzer module VCC ──→ 3.3V
Buzzer module GND ──→ GND
Active buzzers can only produce a single tone (cannot use tone() for frequency modulation) and are not recommended.
3.3 Amplifier Module + Small Speaker (Best Sound Quality, ¥5)
Use the MAX98357/PAM8403 amplifier board:
GPIO16(D0) ──→ Amplifier Module IN
Amplifier Module VCC ──→ 5V Directly from Battery
Amplifier Module GND ──→ Common Ground
Amplifier Module OUT+, OUT- ──→ 2 Speaker Wires
4. Complete Circuit Connection Diagram
+5V (directly from battery)
│
┌─────────────────────────┼─────────────────────────┐
│ │ │
Servo1-4 Speaker/Buzzer HLK-V20
(red wire → 5V) │ │
╱ │
╱ 8Ω │
╲ │
│ │
C │
┌────┤ NPN │
│ │ transistor │
│ 1KΩ E │
│ │ │
│ GND │
│ │
ESP12F │ │
┌──────────────────────────┼────────────────────────────────┐
│ │ │
│ GPIO16(D0) ─────────────┘ GPIO0(D3) ◄──────── HLK-V20 TX
│
│ GPIO14(D5) ──┐──1KΩ──▶ Servo 1 Shared │
│ └──▶ OV2640 SCK │
│ 3.3V──┬──┤ │
│ GPIO12(D6) ──┐──1KΩ──▶ Servo 3 │ 4.7KΩ│
│ └──▶ OV2640 MISO │ 4.7KΩ│
│ ┌────┴──┘ │
│ GPIO13(D7) ──┐──1KΩ──▶ Servo 4 │ │
│ └──▶ OV2640 MOSI │ │
│ GPIO4(D2)── OLED SDA
│ GPIO15(D8) ───▶ OV2640 CS + 10KΩ↓GND GPIO5(D1)── OLED SCL
│
│ GPIO2(D4) ◀═ Button 1 ═ GND A0 ── Voltage Divider ──▶ Battery+
│
│ GPIO1(TX) ◀═══ USB-TTL RX (debug) GND ──▶ Common Ground
│ GPIO3(RX) ◀═══ USB-TTL TX (debug) 3.3V ──▶ OLED/OV2640
│
└─────────────────────────────────────────────────────────┘
│
◇ GND
5. Final Pin Usage List
| Pin | Function | Priority |
|---|---|---|
| GPIO0 (D3) | HLK-V20 RX (SoftwareSerial) | ✅ Required |
| GPIO2 (D4) | Button 1 (INPUT_PULLUP) | ✅ Recommended to keep |
| GPIO4 (D2) | OLED SDA (I2C) | ✅ Required |
| GPIO5 (D1) | OLED SCL (I2C) | ✅ Required |
| GPIO12 (D6) | Servo 3 + OV2640 MISO (1KΩ shared) | ✅ Required |
| GPIO13 (D7) | Servo 4 + OV2640 MOSI (1KΩ shared) | ✅ Required |
| GPIO14 (D5) | Servo 1 + OV2640 SCK (1KΩ shared) | ✅ Required |
| GPIO15 (D8) | OV2640 CS + 10KΩ↓GND | ✅ Required |
| GPIO16 (D0) | ⚠Either/Or: Servo 2 or Speaker | ⚠ As needed |
| GPIO1 (TX) | Serial debug | ✅ Keep |
| GPIO3 (RX) | Serial debug | ✅ Keep |
| A0 | Battery ADC | ✅ Recommended |
| 3.3V | OLED/OV2640/HLK-V20 power supply | — |
| 5V (external) | Servo/Speaker power supply | — |
| GND | Common ground | — |
6. Trade-off between Servo 2 and the speaker
GPIO16 (D0) can only be used for one of the following:
Solution A: Keep Servo 2, use another pin for the speaker
GPIO16 → Servo 2
Speaker → GPIO2(D4) + button multiplexing (short press = button, long press = sound?)
→ or abandon (use OLED's buzzer? Not recommended)
Option B: Use a speaker, remove Servo 2
GPIO16 → Speaker (transistor-driven)
Remove Servo 2 → Robot dog becomes a 3-legged design (not recommended)
Option C: Replace with ESP32 (Recommended, ¥15)
ESP32 has 20+ available GPIOs, all independently assigned:
Servo 1~4 → Any 4 pins (no sharing)
OV2640 → Dedicated SPI (no sharing)
HLK-V20 → Dedicated UART
Speaker → Dedicated PWM
OLED → Dedicated I2C
Plus 10+ extra GPIOs → Add sensors!
⭐ Best Solution: PCA9685 Servo Driver Board (¥5)
ESP12F PCA9685 Servo Driver Board
┌────────┐ ┌──────────────────┐
│ GPIO4 ├──── SDA ────────┤ SDA │
│ GPIO5 ├──── SCL ────────┤ SCL │
│ │ │ │
│ │ │ PWM0 ──▶ Servo 1 │
│ │ │ PWM1 ──▶ Servo 2 │
│ │ │ PWM2 ──▶ Servo 3 │
│ │ │ PWM3 ──▶ Servo 4 │
│ │ │ PWM4~15 ── Spare │
│ GPIO14 ├──▶ OV2640 SCK │ │ (Exclusive)
│ GPIO12 ├──▶ OV2640 MISO │ │ (Exclusive)
│ GPIO13 ├──▶ OV2640 MOSI │ │ (Exclusive)
│ GPIO15 ├──▶ OV2640 CS │ │ (Exclusive)
│ GPIO0 ├──▶ HLK-V20 TX │ │ (Exclusive)
│ GPIO16 ├──▶ Speaker │ │ (Exclusive)
│ GPIO2 ├──▶ Button │ │
└────────┘ └──────────────────┘
After adding PCA9685:
- ✅ All modules are independently wired, no longer shared
- ✅ More stable servo control (hardware PWM from PCA9685)
- ✅ Servo 2 retained
- ✅ Speaker also independent
- Cost: ¥5 for the module + a few Dupont wires
Files by @ace-trump-tech, at commit 21c5492, read from GitHub in your browser. Hardware license: MIT; software license: MIT. Robotheca doesn't review code: read it before running it.