Eliminating the Arduino Uno: Standalone ESP32-CAM Robotics & 4-Pin PWM Tricks
Most hobbyist WiFi camera robot designs use two microcontrollers: an ESP32-CAM for video streaming and an Arduino Uno to control motor drivers. This dual-board approach adds unnecessary wiring, weight, and serial communication latency.
For the esp32-cam-with-car-control project, my goal was to make the ESP32-CAM the sole brain of the vehicle.
1. Overcoming the GPIO Pin Shortage
The ESP32-CAM exposes very few usable GPIOs because most are consumed by the OV2640 camera and onboard flash.
The 4-Pin PWM Solution
Standard L298N motor driver wiring requires 6 pins (2 enable pins for PWM speed control + 4 directional inputs). By leaving the hardware jumpers on the ENA and ENB pins permanently enabled, we apply PWM directly to the IN1–IN4 directional pins, reducing our required GPIO count from 6 to 4!
2. In-Memory Web Server & Telemetry
Instead of relying on SD card filesystems, all HTML, CSS, and WebSocket controller assets are compiled directly into microcontroller program memory. The car streams live MJPEG video and telemetry from an onboard MPU6050 accelerometer at low latency.