Debug and synchronize communication between the robocar main controller (Heltec WiFi LoRa 32) and camera module (ESP32-CAM)
Apply this skill when the user:
βββββββββββββββββββββββ I2C βββββββββββββββββββββββ
β Main Controller βββββββββββββββΊβ Camera Module β
β Heltec WiFi LoRa β β ESP32-CAM β
β β β β
β - AI decisions β β - Image capture β
β - Motor control β β - Vision analysis β
β - LoRa comms β β - I2C slave β
βββββββββββββββββββββββ βββββββββββββββββββββββ
# Build main controller
make robocar-build-main
# Build camera module
make robocar-build-cam
# Or build both
make robocar-build-all
Open two terminals and monitor both:
Terminal 1 - Main Controller:
make robocar-monitor-main PORT=/dev/cu.usbserial-0001
Terminal 2 - Camera Module:
make robocar-monitor-cam PORT=/dev/cu.usbserial-0002
If unsure which device is which:
ls -la /dev/cu.usbserial-* /dev/ttyUSB*
Look for:
| Symptom | Possible Cause | Solution |
|---|---|---|
| No response | Wrong address | Verify 7-bit address format |
| Timeout | Missing pull-ups | Add 4.7K resistors on SDA/SCL |
| Corrupted data | Speed too fast | Reduce I2C clock frequency |
| Intermittent | Loose connection | Check wiring |
Ensure both controllers use the same address:
Main controller (master):
#define CAMERA_I2C_ADDR 0x55 // 7-bit address
Camera module (slave):
#define I2C_SLAVE_ADDR 0x55 // Must match master
Main Controller Camera Module
SDA (21) ββββββββββββΊ SDA (GPIO)
SCL (22) ββββββββββββΊ SCL (GPIO)
GND ββββββββββββΊ GND
Pull-up resistors (4.7K) on SDA and SCL to 3.3V.
Enable verbose I2C logging in both projects:
esp_log_level_set("i2c", ESP_LOG_DEBUG);
Look for matching transactions:
If commands arrive too fast:
Add delay between commands:
i2c_master_cmd_begin(I2C_NUM, cmd, pdMS_TO_TICKS(100));
vTaskDelay(pdMS_TO_TICKS(10)); // Wait for slave to process
# Flash main controller first
make robocar-flash-main PORT=/dev/cu.usbserial-0001
# Then flash camera (requires GPIO0 to GND)
# Connect GPIO0 to GND on ESP32-CAM
make robocar-flash-cam PORT=/dev/cu.usbserial-0002
# Disconnect GPIO0 from GND and reset
For rapid iteration:
make robocar-build-allmake robocar-flash-mainmake robocar-flash-camSymptoms:
Debug Steps:
Symptoms:
Debug Steps:
Symptoms:
Debug Steps:
# Show system info
make robocar-info
# Check environment
make check-environment
# Clean and rebuild
make robocar-clean
make robocar-build-all
# Full dev cycle for main
make robocar-develop-main PORT=/dev/xxx
# Full dev cycle for camera
make robocar-develop-cam PORT=/dev/xxx