Skip to content

Latest commit

 

History

History
89 lines (60 loc) · 3.09 KB

interfaces.md

File metadata and controls

89 lines (60 loc) · 3.09 KB

Interfaces

Pin numbers match include/pins.h and pinout.md.

I2C

Shared bus.

Signal ESP32 GPIO Diagram pad
SDA GPIO0 GP0 → PCA9685 SDA, OLED SDA
SCL GPIO1 GP1 → PCA9685 SCL, OLED SCK
Device Address Firmware behaviour if missing
PCA9685 0x40 Hard fail: red RGB, hang
SSD1306 OLED 0x3C Soft fail: tests continue without display

Bus start: Wire.begin(I2C_SDA, I2C_SCL) with no explicit frequency → Arduino-ESP32 default (typically 100 kHz). Not set in this repo.

PCA9685 VCC = 3V3. OLED VCC = 3V3. Pull-ups: onboard on the Adafruit PCA9685 and typical OLED modules are enough; no external pull-ups required.

I2S

Device: MAX98357A (mono class-D). No MCLK wire.

Signal ESP32 GPIO Amp pin (as drawn)
BCLK GPIO2 / GP2 BCLK
WS / LRC GPIO3 / GP3 LRC
DATA GPIO4 / GP4 DIN

Bring-up configuration in src/main.cpp:

Parameter Value
Mode I2S_MODE_STD
Sample rate 44100 (SAMPLE_RATE)
Width I2S_DATA_BIT_WIDTH_16BIT
Slots I2S_SLOT_MODE_STEREO

Firmware writes identical samples to both stereo slots. MAX98357A is mono; with GAIN and SD not wired, breakout defaults apply (GAIN floating ≈ 9 dB, SD pulled up ≈ left channel).

Amp Vin = USB 5V (drawing). I2S wires are 3.3 V logic. SPK+/SPK- are not on the PNG.

Warning

MAX98357A SPK- is not ground.

Servo PWM

Generated by PCA9685, not by ESP32 LEDC/MCPWM.

  • I2C command from ESP32
  • 12-bit PWM, 50 Hz
  • Channels 0–4
  • Pulse mapping: servos.md

ESP32 GPIO is not wired to servo SIG lines.

PCA9685 output enable (optional)

Signal ESP32 GPIO Notes
OE GPIO5 / GP5 Active LOW — outputs enabled. Firmware drives HIGH during PCA9685 init, then LOW after neutral PWM is written

Controlled only when PCA9685_OE_WIRED = true in include/pins.h. Default false: OE pin unused (Adafruit breakout pull-down keeps outputs enabled). Wire GP5 → PCA9685 OE and set the flag to block invalid PWM during boot and flash resets.

USB

Single USB-C on the robot: Adafruit 5993.

Net 5993 ESP32
VBUS +5V rail 5V pad
GND common GND GND
D− data GPIO18
D+ data GPIO19

One cable for robot power, flash, and serial CDC (ARDUINO_USB_MODE=1, ARDUINO_USB_CDC_ON_BOOT=1, monitor 115200). Leave the C3-Zero onboard USB-C unused when 5993 data is wired — power.md.

C3-Zero has no USB–UART bridge. If CDC does not enumerate, hold BOOT (GPIO9) then attach USB (Waveshare flashing note).

Not used

Interface Pads Notes
UART0 GPIO21 TX / GPIO20 RX Silkscreen; console is USB CDC
BLE antenna Hardware may be present; out of scope — product uses Wi-Fi only
ESP32 onboard USB-C — Unused when 5993 supplies power + data