⚡ 4-Step Visual System Flow
No Text Walls • 1-Glance Architecture
Step 1
📡
Forward Sonar Scan
HC-SR04 Sonar
Measures distance to approaching walls or obstacles.
Step 2
🧠
Obstacle Avoidance
Distance < 20cm Rule
Rover detects dead-end and initiates evasive reverse turn.
Step 3
⚡
DRV8833 Dual H-Bridge
IN1–IN4 Direction Pins
Reverses coil current polarity with 1.5A per channel.
Step 4
🤖
Differential Steering
Left & Right Gear Motors
Left wheel reverse + right wheel forward spins rover free!
1
🧰 Real Rover Components





2
🎛️ Live DRV8833 Steering Simulator & Pinout
Sonar Distance:
35 cm
AIN1:1 AIN2:0 | BIN1:1 BIN2:0
DRV8833 Motor Power (VM)
Red Wire to 4x AA Battery (+) Rail (4.8V – 6V)
Common Ground (GND)
Black Wire connecting Battery (-) and ESP32 GND
Left Motor IN1 (Forward)
Blue Jumper Wire to DRV8833 IN1
Left Motor IN2 (Reverse)
Blue Jumper Wire to DRV8833 IN2
Right Motor IN3 (Forward)
Orange Jumper Wire to DRV8833 IN3
Right Motor IN4 (Reverse)
Orange Jumper Wire to DRV8833 IN4
3
⚡ Verified Codes (Click "⚡ Open in IDE" — Auto Board + Code!)
step1_motor_test.ino
ESP32-S3
47 lines
/*
* Session 6 - Step 1: DRV8833 Dual Motor Direction Test
* Wiring: Left Motor -> AIN1=GPIO 4, AIN2=GPIO 5 | Right Motor -> BIN1=GPIO 6, BIN2=GPIO 7
*/
#define AIN1 4
#define AIN2 5
#define BIN1 6
#define BIN2 7
✅ Output: Tests Forward ➔ Reverse ➔ Left ➔ Right! Swap motor wires if a wheel spins backward.
step2_pwm_speed.ino
ESP32-S3
37 lines
/*
* Session 6 - Step 2: Smooth PWM Speed Control on DRV8833 (ESP32 Core 3.x)
* Ramps both motors smoothly from 0% to 100% and back down!
*/
#define AIN1 4
#define AIN2 5
#define BIN1 6
#define BIN2 7
✅ Output: Smoothly ramps both wheels from slow to full speed via ESP32 Core 3.x ledcAttach!
step3_obstacle_rover.ino
ESP32-S3
67 lines
/*
* Session 6 - Final Project: 2WD Autonomous Obstacle Avoidance Rover
* DRV8833: AIN1=4, AIN2=5, BIN1=6, BIN2=7 | Sonar: TRIG=12, ECHO=13 | Radar Servo: 14
*/
#define AIN1 4
#define AIN2 5
#define BIN1 6
#define BIN2 7
✅ Output: Drives forward, stops <24cm, looks Left & Right with servo, and turns to clear path!