This project implements a smart robot that can move using voice commands (via serial input) and intelligently avoid obstacles using an ultrasonic sensor and IR sensor. The robot is controlled using an Adafruit Motor Shield, and features a servo-based head to visually indicate turns.
- ๐ค Voice control via serial commands
- ๐งญ Obstacle avoidance using ultrasonic sensor (NewPing)
- ๐ 4-wheel drive using AFMotor
- ๐ฆพ Servo-based directional head movement
- ๐ Bidirectional motion (forward + reverse)
- ๐ฆ IR sensor safety for backward movement
- ๐ Auto-stop when obstacle detected
| Component | Quantity |
|---|---|
| Arduino Uno / Mega | 1 |
| Adafruit L293D Motor Shield | 1 |
| DC Motors (TT gear or BO) | 4 |
| Ultrasonic Sensor (HC-SR04) | 1 |
| IR Sensor (for reverse) | 1 |
| Servo Motor (SG90) | 1 |
| Battery Pack (9V or 12V) | 1 |
| Jumper Wires + Chassis | - |
Install these libraries via Arduino Library Manager:
| Command | Action |
|---|---|
move forward |
Move forward while checking distance |
move backward |
Move backward (uses IR safety) |
left / turn left |
Turn left with servo indicator |
right / turn right |
Turn right with servo indicator |
stop |
Stop all motors immediately |
๐ฃ๏ธ Voice commands are sent via Serial Monitor (9600 baud) or Bluetooth module (e.g., HC-05).
- ๐ง Robot listens for a voice command (via Serial).
- ๐ฏ For
move forward, it checks ultrasonic distance:- If distance < 10cm โ Stop
- Else โ Drive forward
- ๐งผ For
move backward, it checks IR sensor:- If object detected โ Stop
- Else โ Drive backward
- โช๏ธ For left/right, it:
- Turns servo to look left/right
- Rotates wheels accordingly
- ๐ After obstacle, resets servo and motor state.
AFMotorcontrols all 4 DC motors.NewPingreads distance from HC-SR04.Servorotates head to show turning direction.- Commands are matched from
Serial.readString().
๐งช Includes safety: robot stops if obstacle is too close or IR detects danger when reversing.