ESP32-CAM RC Car






Remote Controlled Car using ESP32-CAM board (Ai Thinker).
Supplies
- 01 - ESP32-CAM board
- 01 - Car Chassis (2WD or 4WD)
- 02 - DC Motors (3v - 6v)
- 01 - L298N Dual H-Bridge board
- 02 - White Leds
- 02 - 18650 batteries (3.7v - 4.2v)
- 01 - Battery support
- 01 - Electrolytic Capacitor 1000 μF (16v - 50v)
- 01 - (Optional) Antenna for ESP32-CAM board - improves video streaming and prevents lags
- 01 - (Optional) OV2640 ESP32 CAM (120 or 160 degree lens) - wide-angle capture
Note: in order to enable the external antenna, it is required to change resistor position in ESP32-CAM board see tutorial.
Schematics

The schematics is using the L298N board because it is easier to build the connections, but you can also use other motor drivers such as L293D, L9110, DRV833 and TB6612FNG.
About Car Chassis



This project can work with a 2WD or 4WD car chassis
Reference
Install VS Code With Platform IO Plugin

Download and install PlatformIO, a plugin for Microsoft Virtual Studio Code
It is a more robust IDE compared to Arduino IDE. It also allows us to easily create our own private libraries and use a more object oriented code.
Upload the Code
The project is hosted in Github at:
https://github.com/vitorccs/esp32cam-rc-car
Download the ZIP file containing the source code at:
https://github.com/vitorccs/esp32cam-rc-car/archive/refs/heads/master.zip
Once you open the project folder at VS Code with PlatformIO, it automatically downloads and install all library dependencies - much easier than Arduino IDE and risks free of downloading incorrect source or version (!)
Customization
The PINs can be customized in the main.cpp
Fine-tuning customization can be done in the individual files like ServoMotor.h for servo motor angle
Control

The ESP32-CAM connects to your Wi-Fi network and provides a Web page containing a virtual joystick.
Note: In order to control your car remotely from your public internet IP address, you need to set up Port Forwarding in your home router for ports 80 (Web page), 81 (video streaming) and 82 (web socket/joystick commands).
Advices
Power Supply
I recommend to use high quality 18650 batteries (3.7v - 4.2v, 2200mAh, at least 2C of discharge rate).
Most people prefer to use different power sources for ESP32-CAM (3.3v or 5v) and Bridge driver (7.4 - 8.4v).
I prefer to have a single power source and thus a single power switch. However, it is recommended to use capacitor to filter the electrical noise created by the 02 DC motors.
Resources
Fritzing file
The eletronic schematic was created in the Fritzing software and can be downloaded at