This repository contains the code for controlling an autonomous robot with obstacle detection and line-following capabilities.
- Arduino Uno
- Infrared (IR) sensors
- Ultrasonic sensor
- DC Motors
- Right motor:
- Enable pin: 6
- Pin 1: 7
- Pin 2: 8
- Left motor:
- Enable pin: 5
- Pin 1: 9
- Pin 2: 10
- IR Sensors:
- Right sensor: A1
- Left sensor: A3
- Middle sensor: A2
- Ultrasonic sensor:
- Trigger pin: 3
- Echo pin: 11
- Connect the components according to the wiring mentioned above.
- Upload the provided code to your Arduino Uno board.
- Open the serial monitor to observe the output.
The robot is programmed to perform the following tasks:
- Line-following: It uses the IR sensors to detect black lines on the ground and adjust its path accordingly.
- Obstacle detection: It uses the ultrasonic sensor to detect obstacles in its path and stop or change direction accordingly.
- Ensure that the environment has black lines for the robot to follow.
- Place obstacles within the detection range of the ultrasonic sensor.
- Power on the robot and observe its behavior.
- Adjust the motor speed (
MOTOR_SPEED
) as per your requirements. - Ensure proper calibration of sensors for accurate detection.
- This code serves as a basic framework and can be expanded upon for more complex behaviors.