Arduino Leonardo-Based Line Following Robot with IR Sensors and L298N Motor Driver
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This document provides a detailed overview of a circuit that includes an Arduino Leonardo microcontroller, an L298N DC motor driver, multiple TCRT-5000 IR sensors, a rocker switch, and DC Mini Metal Gear Motors. The circuit is designed to control the motors based on sensor inputs, with power supplied by a 7.4V battery.
Component List
Arduino Leonardo (Rev3b)
- Description: A microcontroller board based on the ATmega32u4.
- Pins: D0/RX, D1/TX, D2/SDA, D3 PWM/SCL, D4/A6, D5 PWM, D6 PWM/A7, D7, n.c., IOREF, RESET, 3V3, 5V, GND, VIN, A0, A1, A2, A3, A4, A5, D8/A8, D9 PWM/A9, D10 PWM/A10, D11 PWM, D12/A11, D13 PWM, AREF, SDA, SCL
L298N DC Motor Driver
- Description: A dual H-Bridge motor driver that allows control of two DC motors.
- 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
7.4V Battery
- Description: A power source for the circuit.
- Pins: +, -
TCRT-5000 IR Sensor
- Description: An infrared sensor used for detecting objects.
- Pins: 5V, GND, D0, A0
Rocker Switch
- Description: A switch to control the power supply.
- Pins: output, input
DC Mini Metal Gear Motor
- Description: A small DC motor with metal gears.
- Pins: IN1, IN2
Wiring Details
Arduino Leonardo (Rev3b)
- 5V: Connected to 5V pins of all TCRT-5000 IR sensors and L298N DC motor driver.
- GND: Connected to GND pins of all TCRT-5000 IR sensors and L298N DC motor driver.
- D5 PWM: Connected to ENA pin of L298N DC motor driver.
- D6 PWM/A7: Connected to ENB pin of L298N DC motor driver.
- A1: Connected to A0 pin of TCRT-5000 IR sensor.
- A2: Connected to A0 pin of another TCRT-5000 IR sensor.
- A3: Connected to A0 pin of another TCRT-5000 IR sensor.
- A4: Connected to A0 pin of another TCRT-5000 IR sensor.
- A5: Connected to A0 pin of another TCRT-5000 IR sensor.
- D9 PWM/A9: Connected to IN4 pin of L298N DC motor driver.
- D10 PWM/A10: Connected to IN3 pin of L298N DC motor driver.
- D11 PWM: Connected to IN2 pin of L298N DC motor driver.
- D12/A11: Connected to IN1 pin of L298N DC motor driver.
L298N DC Motor Driver
- 5V: Connected to 5V pin of Arduino Leonardo and 5V pins of all TCRT-5000 IR sensors.
- GND: Connected to GND pin of Arduino Leonardo and GND pins of all TCRT-5000 IR sensors.
- ENA: Connected to D5 PWM pin of Arduino Leonardo.
- ENB: Connected to D6 PWM/A7 pin of Arduino Leonardo.
- IN1: Connected to D12/A11 pin of Arduino Leonardo.
- IN2: Connected to D11 PWM pin of Arduino Leonardo.
- IN3: Connected to D10 PWM/A10 pin of Arduino Leonardo.
- IN4: Connected to D9 PWM/A9 pin of Arduino Leonardo.
- OUT1: Connected to IN2 pin of one DC Mini Metal Gear Motor.
- OUT2: Connected to IN1 pin of the same DC Mini Metal Gear Motor.
- OUT3: Connected to IN1 pin of another DC Mini Metal Gear Motor.
- OUT4: Connected to IN2 pin of the same DC Mini Metal Gear Motor.
- 12V: Connected to input pin of rocker switch.
7.4V Battery
- +: Connected to output pin of rocker switch.
- -: Connected to GND pin of L298N DC motor driver.
TCRT-5000 IR Sensor
- 5V: Connected to 5V pin of Arduino Leonardo and L298N DC motor driver.
- GND: Connected to GND pin of Arduino Leonardo and L298N DC motor driver.
- A0: Connected to A1, A2, A3, A4, and A5 pins of Arduino Leonardo (one sensor per pin).
Rocker Switch
- input: Connected to 12V pin of L298N DC motor driver.
- output: Connected to + pin of 7.4V battery.
DC Mini Metal Gear Motor
- IN1: Connected to OUT2 pin of L298N DC motor driver (first motor) and OUT3 pin of L298N DC motor driver (second motor).
- IN2: Connected to OUT1 pin of L298N DC motor driver (first motor) and OUT4 pin of L298N DC motor driver (second motor).
Documented Code
Arduino Leonardo (Rev3b) Code
sketch.ino
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
documentation.txt