A smart obstacle avoidance robot with dual operation modes: autonomous navigation and manual web-based control via WiFi.
- 🤖 Auto Mode: Autonomous obstacle avoidance using ultrasonic and IR sensors
- 🎮 Manual Mode: Web-based remote control from any smartphone/tablet
- 📱 Responsive Web UI: Touch-optimized interface for mobile devices
- ⚡ PWM Speed Control: Adjustable motor speed (0-255)
- 📊 Real-time Sensor Data: Live sensor readings on web interface
- 🔄 Mode Switching: Seamless switching between Auto and Manual modes
- ESP32 Development Board
- HC-SR04 Ultrasonic Sensor (1x)
- IR Obstacle Sensor Modules (2x - front and back)
- L298N Motor Driver (or similar with EN pins)
- DC Motors (2x)
- Robot Chassis
- Power Supply (suitable for motors and ESP32)
| Component | ESP32 Pin |
|---|---|
| HC-SR04 TRIG | GPIO 25 |
| HC-SR04 ECHO | GPIO 26 |
| Front IR Sensor | GPIO 15 |
| Back IR Sensor | GPIO 5 |
| Left Motor IN1 | GPIO 13 |
| Left Motor IN2 | GPIO 12 |
| Right Motor IN1 | GPIO 14 |
| Right Motor IN2 | GPIO 27 |
| Left Motor EN (PWM) | GPIO 18 |
| Right Motor EN (PWM) | GPIO 19 |
SSID: ObstacleBot
Password: robot123
- Mount all sensors and motors on the robot chassis
- Connect components according to the pin configuration table above
- Ensure proper power distribution to motors and ESP32
- Double-check all connections before powering on
- Install Arduino IDE and ESP32 board support
- Install required libraries (already included in ESP32 core):
- WiFi.h
- WebServer.h
- Open
obstacle_avoidance_bot.ino - Select your ESP32 board from Tools > Board
- Select the correct COM port
- Upload the sketch to your ESP32
- Power on the robot
- Open Serial Monitor (115200 baud) to see startup messages
- Note the Access Point IP address (typically
192.168.4.1)
-
Connect to WiFi
- On your phone/tablet, go to WiFi settings
- Connect to network:
ObstacleBot - Enter password:
robot123
-
Open Web Interface
- Open browser and navigate to:
http://192.168.4.1 - The control panel will load automatically
- Open browser and navigate to:
- Bot autonomously avoids obstacles
- Uses ultrasonic sensor for distance detection
- IR sensors for close-range detection
- Automatically navigates around obstacles
- Full manual control via web interface
- Directional buttons: Forward, Backward, Left, Right
- Hold buttons to move, release to stop
- Real-time control with immediate response
- Adjust speed slider (0-255)
- Changes apply immediately to both Auto and Manual modes
- Default speed: 200
- Lower speeds for precision, higher for faster movement
- Distance: Ultrasonic sensor reading (cm)
- Front IR: Obstacle detection status
- Back IR: Rear obstacle detection status
- Current Speed: Active motor speed value
- Optimized for mobile phones and tablets
- Touch-friendly button sizes
- Prevents accidental page scrolling
- Works on all modern browsers
▲ (Forward) ◄ ■ ► (Left, Stop, Right) ▼ (Backward) - Sensor data refreshes every 500ms
- Immediate command execution
- Visual feedback for mode changes
- Ensure ESP32 is powered on
- Check Serial Monitor for AP IP address
- Try forgetting network and reconnecting
- Verify password is correct:
robot123
- Check motor driver connections
- Verify EN pins (18, 19) are connected
- Test in Manual mode first
- Check power supply to motors
- Verify sensor pin connections
- Check sensor power (VCC/GND)
- View sensor data in web interface
- Check Serial Monitor for debug output
- Verify WiFi connection
- Use correct IP:
192.168.4.1 - Try different browser
- Check Serial Monitor for errors
Edit in the sketch:
const char* AP_SSID = "ObstacleBot"; const char* AP_PASSWORD = "robot123";Modify pin definitions at the top of the sketch to match your wiring.
const int DISTANCE_THRESHOLD_CM = 20; // Obstacle detection distance const unsigned long BACKUP_TIME_MS = 400; // Backup duration const unsigned long TURN_TIME_MS = 450; // Turn durationIf your IR sensors are active HIGH:
const bool FRONT_IR_ACTIVE_LOW = false; const bool BACK_IR_ACTIVE_LOW = false;- Always test in a safe, open area first
- Keep emergency stop accessible (Manual mode > Stop button)
- Monitor battery levels to prevent motor driver damage
- Start with lower speeds when testing
- Ensure proper motor driver heat dissipation
- v1.0 - Initial release with Auto/Manual modes and web control
Open source - modify and use as needed for your projects!
For issues or questions, check:
- Serial Monitor debug output (115200 baud)
- Web interface sensor readings
- Pin connection verification
Enjoy your obstacle avoidance bot! 🤖