Arduino UNO-Based Line Following Robot with IR Obstacle Detection
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to interface an Arduino UNO with various sensors and a motor driver to control two DC Mini Metal Gear Motors. The sensors include a Line Sensor, an IR sensor, and two TCRT-5000 IR sensors. The L298N DC motor driver is used to drive the motors, and the entire system is powered by two 18650 Li-ion batteries. The Arduino UNO serves as the central processing unit, reading sensor inputs and controlling the motor outputs.
Component List
Arduino UNO
- Microcontroller board based on the ATmega328P
- It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button.
Line Sensor
- An array sensor with multiple IR emitting and detecting elements.
- It is typically used for line following robots.
IR Sensor
- A simple infrared sensor with an output pin that goes high when an object is detected.
TCRT-5000 IR Sensor (x2)
- Reflective IR sensor with both analog and digital outputs.
- Commonly used for obstacle detection and line tracking.
L298N DC Motor Driver
- A high-power motor driver capable of driving up to 2A per channel.
- It can drive two DC motors or one stepper motor.
DC Mini Metal Gear Motor (x2)
- A compact geared DC motor with a high torque output.
- Suitable for robotics and automation projects.
18650 Li-ion Battery x 2
- Rechargeable lithium-ion batteries.
- Commonly used for portable electronics and electric vehicles.
Wiring Details
Arduino UNO
5VandGNDare used to power the Line Sensor, IR sensor, and both TCRT-5000 IR sensors.Vinis connected to the 5V output of the L298N motor driver to power the Arduino.- Analog pins
A0toA5are connected to the Line Sensor for reading the line position. - Digital pins
D2,D5toD10,D12, andD13are used to interface with the IR sensor, motor driver, and TCRT-5000 sensors.
Line Sensor
- Powered by the Arduino's
5VandGND. - Outputs connected to Arduino's analog inputs
A0toA5.
IR Sensor
- Powered by the Arduino's
5VandGND. - Output connected to Arduino's digital pin
D2.
TCRT-5000 IR Sensors
- Both sensors are powered by the Arduino's
5VandGND. - Digital outputs connected to Arduino's digital pins
D12andD13.
L298N DC Motor Driver
- Powered by the 18650 Li-ion batteries
12VandGND. 5Voutput used to power the Arduino UNO'sVin.- Motor driver inputs
IN1,IN2,IN3,IN4,ENA, andENBare controlled by Arduino digital pinsD5toD10.
DC Mini Metal Gear Motors
- Motors are driven by the L298N motor driver outputs
OUT1,OUT2,OUT3, andOUT4. - Control inputs for each motor come from the L298N driver.
18650 Li-ion Batteries
- Provide power to the L298N motor driver.
- Connected to the
12VandGNDinputs of the motor driver.
Documented Code
Arduino UNO Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
This is the template code for the Arduino UNO. The setup() function is called once when the microcontroller is powered on or reset. It is used to initialize the pins and set up the initial state of the program. The loop() function is called repeatedly and contains the main logic of the program. It will read sensor inputs, process them, and control the motor outputs accordingly.
Additional Notes
- The provided code is a template and does not contain any specific logic for sensor reading or motor control.
- The actual implementation should include initialization of the pins as inputs or outputs, reading sensor values, and writing control signals to the motor driver.
- The
documentation.txtfile is empty and does not contain any additional information.