Skip to content
Ben-coderrPublic

About

πŸš— 4WD ESP32-CAM & Arduino Robot Car with Live Video, Phone Web App, PC Viewer, Rear Parking Radar, and Auto-Brake

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

RobotCar Smart Rover Logo



Autonomous and Teleoperated 4WD Smart Rover

Dual-Core Architecture (ESP32-CAM + Arduino UNO) Β· FPV Video Stream Β· Rear Sonar Radar Β· Auto-Brake Β· Zero-Install Web App

Microcontrollers Live Web Demo Live 3D CAD Documentation Release License: MIT



3D Assembly Model of Robot Car

A complete, classroom-tested open-source robotics platform combining computer vision, wireless teleoperation, and deterministic real-time hardware safety.


Table of Contents


Key Features

  • Ultra-Low Latency FPV Video: AI-Thinker ESP32-CAM module delivers real-time MJPEG video over local Wi-Fi with sub-100ms latency.
  • Zero-Install Teleoperation App: Accessible from any smartphone, tablet, or PC browser via http://192.168.4.1 with touch joystick, speed gears, camera settings, and keyboard hotkeys.
  • Dedicated Classroom Observation Viewer: Dual-screen web experience at http://192.168.4.1/view offering synchronized instrument gauges, telemetry graphs, and client tracking for up to 3 screens.
  • Rear Ultrasonic Parking Radar and Auto-Brake: Rear-mounted HC-SR04 sonar with an active acoustic beeper and red flashing beacon. Features hardware auto-braking that stops reversing if an obstacle is within 15 cm.
  • High-Intensity Lighting and Hazard System: Dual front white headlights with OFF / ON / HAZARD flasher modes and white rear reverse indicator LED.
  • Dual-Microcontroller Architecture: Distributes wireless networking (ESP32) and real-time motor control (Arduino Uno) across dedicated hardware with hardware watchdog fail-safes.
  • Single Battery Supply (No Buck Converter): Runs on 2Γ— 18650 Li-ion cells (7.4V nominal) directly feeding the L298N motor driver and Arduino Uno VIN pin, with a 2200 Β΅F buffer capacitor preventing brownout resets.

System Architecture and Data Flow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          CLIENT DEVICE          β”‚
β”‚   (Phone / Tablet / Laptop)     β”‚
β”‚  http://192.168.4.1 [Browser]   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚
                 β”‚ 1. Wi-Fi 802.11b/g/n (SSID: RobotCar)
                 β”‚    - WebSocket ws://192.168.4.1/ws (Bidirectional Telemetry)
                 β”‚    - MJPEG Video Stream :81/stream (Sub-100ms Video)
                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚        ESP32-CAM MODULE         β”‚
β”‚   (Network & Telemetry Host)    β”‚
β”‚  - AI-Thinker OV2640 Camera     β”‚
β”‚  - Web & WebSocket Server       β”‚
β”‚  - High-Power Flash (IO4)       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚
                 β”‚ 2. Hardware UART Serial (38,400 Baud)
                 β”‚    - IO14 (TX, 3.3V) ──────► Arduino D3 (RX)
                 β”‚    - IO15 (RX, 3.3V) ◄────── 1k/2k Divider ◄── Arduino D2 (TX, 5V)
                 β”‚    - Checksum Protected Packets: M,left,right*XX
                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         ARDUINO UNO R3          β”‚
β”‚    (Deterministic Real-Time)    β”‚
β”‚  - Real-Time Ultrasonic Echo    β”‚
β”‚  - Hardware Fail-Safe Watchdog  β”‚
β”‚  - Smooth PWM Motor Slew Rampingβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚              β”‚
        β–Ό              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ L298N DRIVER β”‚ β”‚ SENSORS & IO β”‚
β”‚ 4x TT Motors β”‚ β”‚ HC-SR04 Sonarβ”‚
β”‚ Dual H-Bridgeβ”‚ β”‚ Active Buzzerβ”‚
β”‚ PWM Speed    β”‚ β”‚ 4x LEDs      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Electrical Wiring and Schematic

The robot car uses a single 7.4V battery pack (2Γ— 18650 cells in series) without requiring an external buck converter. The battery directly powers the L298N motor driver and the Arduino Uno VIN pin. The Arduino Uno's onboard linear regulator produces the 5V logic bus for all sensors and the ESP32-CAM, buffered by a 2200 Β΅F 16V low-ESR capacitor.

Comprehensive Assembly Wiring

Complete Wiring Diagram

Click diagram to open the step-by-step wiring guide.

Complete Circuit Schematic

Complete Schematic Diagram

Mechanical Layout and 3D Assembly

The vehicle is built on a double-decker acrylic 4WD chassis with dedicated spatial separation between high-current inductive components and sensitive radio-frequency electronics:

Chassis Layout Diagram

Zero-Install Web Application

No app store downloads or native compilation required. Connect to the car's Wi-Fi network and open http://192.168.4.1 in Safari, Chrome, Firefox, or Edge.

Mobile Driver Interface (Portrait)

Mobile Portrait Driving Mode
Mobile Driver Interface (Landscape)

Mobile Landscape Driving Mode
Classroom Observation Viewer (/view)

Classroom PC Viewer
Real-Time Settings and Calibration Panel

Vehicle Settings Panel

Hardware Bill of Materials (BOM)

For complete shopping links and price estimates, see docs/01_BOM.md and docs/pdf/Shopping_List_Robot_Car.pdf.

Microcontroller Camera Module Motor Driver Distance Sensor
Arduino Uno ESP32-CAM L298N HC-SR04
Arduino UNO R3 ESP32-CAM Module L298N Dual H-Bridge HC-SR04 Ultrasonic
Power Source TT Gear Motors Breadboard & Rails Active Buzzer
18650 Battery TT DC Motor Breadboard Active Buzzer
2Γ— 18650 Li-ion + Case 4Γ— TT Motors (1:48) 400-Point Breadboard 5V Active Buzzer
LEDs & Indicators Filter Capacitor Resistors & Divider Power Switch
LEDs Electrolytic Capacitor Resistors Power Switch
Headlights & Tail LEDs 2200 Β΅F 16V Low-ESR 220 Ξ©, 1 kΞ©, 2 kΞ© SPST Rocker Switch

Complete Pinout Mapping

Arduino UNO Pin Subsystem Connected Device Logic Voltage Function
D2 Telemetry TX 1k/2k Divider β†’ ESP32-CAM IO15 5.0V TTL Transmits telemetry and heartbeat to ESP32
D3 Telemetry RX ESP32-CAM IO14 (TX) 3.3V CMOS Receives drive commands from ESP32
**D6 ~** Motor Right L298N ENB 5.0V PWM Right motor pair speed PWM (0–255)
D7 Motor Right L298N IN4 5.0V Digital Right motor pair direction bit 2
D8 Motor Right L298N IN3 5.0V Digital Right motor pair direction bit 1
D9 Motor Left L298N IN2 5.0V Digital Left motor pair direction bit 2
D10 Motor Left L298N IN1 5.0V Digital Left motor pair direction bit 1
**D11 ~** Motor Left L298N ENA 5.0V PWM Left motor pair speed PWM (0–255)
D12 Sonar Sensor HC-SR04 ECHO 5.0V Digital Ultrasonic pulse return input
D13 Sonar Sensor HC-SR04 TRIG 5.0V Digital Ultrasonic 10 Β΅s trigger pulse output
A0 Rear Alarm Red Warning LED (via 220 Ξ©) 5.0V Digital Flashing proximity alert indicator
A2 Rear Indicator White Reverse LED (via 220 Ξ©) 5.0V Digital Active reverse drive lamp
A3 Audio Alert 5V Active Acoustic Buzzer 5.0V Digital Parking beeper & acoustic horn
A4 Front Lighting 2Γ— White Headlights (2Γ— 220 Ξ©) 5.0V Digital Front headlights (Off / On / Hazard)
VIN Power Supply Switched Battery Positive (7.4V) Battery DC Feeds onboard 5V linear regulator
5V / GND System Bus Breadboard Power Rails 5.0V DC Master logic power distribution

Quick Start and Firmware Upload Guide

1. Arduino IDE Setup

  1. Install Arduino IDE 2.x from arduino.cc.
  2. Add ESP32 package repository in Preferences β†’ Additional boards manager URLs:
    https://espressif.github.io/arduino-esp32/package_esp32_index.json
    
  3. Install esp32 by Espressif Systems from the Boards Manager.

2. Flashing the Controllers

  • Arduino UNO: Open firmware/uno_controller/uno_controller.ino, select Board: Arduino Uno, and click Upload.
  • ESP32-CAM: Open firmware/esp32cam_robot/esp32cam_robot.ino, select Board: AI Thinker ESP32-CAM, set Partition Scheme: Huge APP (3MB No OTA), and click Upload via the ESP32-CAM-MB daughterboard.

3. Connect and Drive

  1. Turn on the vehicle battery switch.
  2. Connect your mobile phone or PC to Wi-Fi SSID RobotCar (Password: 12345678).
  3. Open http://192.168.4.1 to drive, or http://192.168.4.1/view for classroom observation!

Progressive Hardware Diagnostic Tests

The project includes six progressive diagnostic test sketches in the tests/ directory to systematically verify each component before full operation:

tests/
β”œβ”€β”€ 01_motor_test/            # Tests L298N H-Bridge and 4x TT DC motors independently
β”œβ”€β”€ 02_ultrasonic_test/       # Calibrates HC-SR04 sonar distance sensor via Serial Monitor
β”œβ”€β”€ 03_buzzer_led_test/       # Tests active buzzer, headlights, reverse light, and warning LED
β”œβ”€β”€ 04_link_test/             # Verifies hardware UART link between Arduino Uno and ESP32-CAM
β”œβ”€β”€ 05_esp32cam_test/         # Standalone camera, Wi-Fi stream, and flash LED verification
└── 06_parking_alarm_bench/   # Bench validation of obstacle distance thresholds & auto-brake

PDF Handbooks Library

The docs/pdf/ directory contains complete, classroom-ready illustrated documentation:

Document File Path Scope & Content
Complete Handbook docs/pdf/00_Robot_Car_Complete_Handbook.pdf Comprehensive student manual (all modules combined)
Shopping and Parts List docs/pdf/Shopping_List_Robot_Car.pdf Complete parts bill with specifications and supplier links
Illustrated Wiring Guide docs/pdf/02_Wiring_Guide.pdf Step-by-step visual wiring walkthrough
Large Wiring Poster docs/pdf/Robot_Car_Wiring_Poster.pdf High-resolution printable A3 workbench wiring poster
Assembly Guide docs/pdf/03_Assembly_Guide.pdf Mechanical chassis assembly and component layout
Software and App Guide docs/pdf/04_Software_and_App_Guide.pdf Arduino IDE setup, firmware upload, and web app operation
Testing and Troubleshooting docs/pdf/05_Testing_and_Troubleshooting.pdf Bench testing protocols and fault diagnosis
Technical Reference docs/pdf/06_Technical_Reference.pdf Protocol specifications, math, and code architecture
Arduino Warm-Up Lessons docs/pdf/07_Warm_Up_Learn_Arduino.pdf Introductory programming lessons for beginners

Repository Structure

robot-car/
β”œβ”€β”€ README.md                      # Primary project overview & documentation hub
β”œβ”€β”€ LICENSE                        # Open-source MIT License
β”œβ”€β”€ .gitignore                     # Git exclusion rules
β”œβ”€β”€ firmware/
β”‚   β”œβ”€β”€ uno_controller/            # Real-time motor, sonar, and alarm controller (Arduino UNO)
β”‚   └── esp32cam_robot/            # Camera streaming, Wi-Fi AP, and WebSocket server (ESP32-CAM)
β”œβ”€β”€ web/
β”‚   β”œβ”€β”€ index.html                 # Mobile driving web app interface
β”‚   └── view.html                  # Classroom observation dashboard
β”œβ”€β”€ tests/                         # 6 progressive hardware diagnostic sketches
β”œβ”€β”€ tools/
β”‚   β”œβ”€β”€ build_ui.py                # Compiles web/ assets into C header files for ESP32
β”‚   β”œβ”€β”€ 3d/make_3d_model.py        # Generates 3D STL, 3MF, and HTML CAD models
β”‚   β”œβ”€β”€ diagrams/make_diagrams.py  # Generates SVG wiring and chassis diagrams
β”‚   └── pdf/build_pdfs.py          # Builds printable PDF handbooks
└── docs/
    β”œβ”€β”€ 01_BOM.md                  # Detailed Bill of Materials
    β”œβ”€β”€ 02_WIRING.md               # Step-by-step wiring instructions
    β”œβ”€β”€ 03_ASSEMBLY.md             # Mechanical assembly instructions
    β”œβ”€β”€ 04_SOFTWARE_SETUP.md       # Arduino IDE and flashing guide
    β”œβ”€β”€ 05_PROTOCOL.md             # WebSocket & UART protocol specification
    β”œβ”€β”€ 06_TROUBLESHOOTING.md      # Testing and diagnosis procedures
    β”œβ”€β”€ 3d/                        # Interactive 3D HTML viewer, STL, and 3MF models
    β”œβ”€β”€ images/                    # Wiring diagrams, schematics, and UI screenshots
    └── pdf/                       # Printable student handbooks and posters

License

This project is licensed under the permissive MIT License. You are free to study, build, modify, distribute, and integrate this project for educational and commercial purposes.

About

πŸš— 4WD ESP32-CAM & Arduino Robot Car with Live Video, Phone Web App, PC Viewer, Rear Parking Radar, and Auto-Brake

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages