Arduino UNO-Based Line Following Robot with Ultrasonic Obstacle Detection
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This document provides a detailed overview of a circuit that includes an Arduino UNO microcontroller, a 5-channel IR sensor, an L298N DC motor driver, two DC Mini Metal Gear Motors, an HC-SR04 Ultrasonic Distance Sensor, and a power supply from two 18650 Li-ion batteries. The circuit is designed to interface various sensors and actuators with the Arduino UNO for control and monitoring purposes.
Component List
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
5-channel IR Sensor
- Description: An infrared sensor module with 5 channels for detecting obstacles.
- Pins: VCC, GND, S1, S2, S3, S4, S5, CLP, Near
L298N DC Motor Driver
- Description: A dual H-bridge motor driver module.
- Pins: OUT1, OUT2, 12V, GND, 5V, OUT3, OUT4, 5V-ENA-JMP-I, 5V-ENA-JMP-O, +5V-J1, +5V-J2, ENA, IN1, IN2, IN3, IN4, ENB
18650 Li-ion Battery x 2
- Description: A pair of rechargeable lithium-ion batteries.
- Pins: +, -
DC Mini Metal Gear Motor
- Description: A small DC motor with metal gears.
- Pins: IN1, IN2
HC-SR04 Ultrasonic Distance Sensor
- Description: An ultrasonic sensor for measuring distance.
- Pins: VCC, TRIG, ECHO, GND
Wiring Details
Arduino UNO
- 3.3V connected to VCC of the 5-channel IR sensor.
- GND connected to GND of the 5-channel IR sensor, L298N DC motor driver, HC-SR04 Ultrasonic Distance Sensor, and 18650 Li-ion Battery.
- Vin connected to 5V of the L298N DC motor driver.
- A0 connected to S5 of the 5-channel IR sensor.
- A1 connected to S4 of the 5-channel IR sensor.
- A2 connected to S3 of the 5-channel IR sensor.
- A3 connected to S2 of the 5-channel IR sensor.
- A4 connected to S1 of the 5-channel IR sensor.
- D10 connected to ENA of the L298N DC motor driver.
- D9 connected to IN1 of the L298N DC motor driver.
- D8 connected to IN2 of the L298N DC motor driver.
- D7 connected to IN3 of the L298N DC motor driver.
- D6 connected to IN4 of the L298N DC motor driver.
- D5 connected to ENB of the L298N DC motor driver.
- D4 connected to TRIG of the HC-SR04 Ultrasonic Distance Sensor.
- D3 connected to ECHO of the HC-SR04 Ultrasonic Distance Sensor.
5-channel IR Sensor
- VCC connected to 3.3V of the Arduino UNO.
- GND connected to GND of the Arduino UNO.
- S1 connected to A4 of the Arduino UNO.
- S2 connected to A3 of the Arduino UNO.
- S3 connected to A2 of the Arduino UNO.
- S4 connected to A1 of the Arduino UNO.
- S5 connected to A0 of the Arduino UNO.
L298N DC Motor Driver
- GND connected to GND of the 18650 Li-ion Battery.
- 5V connected to Vin of the Arduino UNO and VCC of the HC-SR04 Ultrasonic Distance Sensor.
- 12V connected to + of the 18650 Li-ion Battery.
- ENA connected to D10 of the Arduino UNO.
- IN1 connected to D9 of the Arduino UNO.
- IN2 connected to D8 of the Arduino UNO.
- IN3 connected to D7 of the Arduino UNO.
- IN4 connected to D6 of the Arduino UNO.
- ENB connected to D5 of the Arduino UNO.
- OUT1 connected to IN2 of the first DC Mini Metal Gear Motor.
- OUT2 connected to IN1 of the first DC Mini Metal Gear Motor.
- OUT3 connected to IN2 of the second DC Mini Metal Gear Motor.
- OUT4 connected to IN1 of the second DC Mini Metal Gear Motor.
18650 Li-ion Battery x 2
- + connected to 12V of the L298N DC motor driver.
- - connected to GND of the L298N DC motor driver.
DC Mini Metal Gear Motor (First)
- IN1 connected to OUT2 of the L298N DC motor driver.
- IN2 connected to OUT1 of the L298N DC motor driver.
DC Mini Metal Gear Motor (Second)
- IN1 connected to OUT4 of the L298N DC motor driver.
- IN2 connected to OUT3 of the L298N DC motor driver.
HC-SR04 Ultrasonic Distance Sensor
- VCC connected to 5V of the L298N DC motor driver.
- GND connected to GND of the 18650 Li-ion Battery.
- TRIG connected to D4 of the Arduino UNO.
- ECHO connected to D3 of the Arduino UNO.
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 code is a basic template for the Arduino UNO. The setup() function is where you initialize your components and the loop() function is where you place the main logic that runs repeatedly.
Documentation (documentation.txt)
This file is empty and can be used to add further documentation or notes about the project.