Arduino Nano-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 Nano microcontroller, an L298N DC motor driver, two DC Mini Metal Gear Motors, a 5-channel IR sensor, a 9V battery, and a Rocker Switch (SPST). The circuit is designed to control the motors based on sensor inputs, with power supplied by the 9V battery and controlled via the rocker switch.
Component List
Arduino Nano
- Description: A small, complete, and breadboard-friendly board based on the ATmega328P.
- Pins: D1/TX, D0/RX, RESET, GND, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11/MOSI, D12/MISO, VIN, 5V, A7, A6, A5, A4, A3, A2, A1, A0, AREF, 3V3, D13/SCK
L298N DC Motor Driver
- Description: A dual H-Bridge motor driver that allows speed and direction 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
DC Mini Metal Gear Motor
- Description: A small DC motor with metal gears for increased durability and torque.
- Pins: IN1, IN2
5-Channel IR Sensor
- Description: An infrared sensor array used for line following and object detection.
- Pins: VCC, GND, S1, S2, S3, S4, S5, CLP, Near
9V Battery
- Description: A standard 9V battery used to power the circuit.
- Pins: +, -
Rocker Switch (SPST)
- Description: A single-pole single-throw switch used to control the power supply.
- Pins: 1, 2
Wiring Details
Arduino Nano
- GND connected to GND of 5-Channel IR Sensor
- D3 connected to IN1 of L298N DC Motor Driver
- D4 connected to IN2 of L298N DC Motor Driver
- D5 connected to IN3 of L298N DC Motor Driver
- D6 connected to IN4 of L298N DC Motor Driver
- D9 connected to ENA of L298N DC Motor Driver
- D10 connected to ENB of L298N DC Motor Driver
- VIN connected to +5V-J1 of L298N DC Motor Driver
- 5V connected to VCC of 5-Channel IR Sensor
- A4 connected to S5 of 5-Channel IR Sensor
- A3 connected to S4 of 5-Channel IR Sensor
- A2 connected to S3 of 5-Channel IR Sensor
- A1 connected to S2 of 5-Channel IR Sensor
- A0 connected to S1 of 5-Channel IR Sensor
L298N DC Motor Driver
- IN1 connected to D3 of Arduino Nano
- IN2 connected to D4 of Arduino Nano
- IN3 connected to D5 of Arduino Nano
- IN4 connected to D6 of Arduino Nano
- ENA connected to D9 of Arduino Nano
- ENB connected to D10 of Arduino Nano
- +5V-J1 connected to VIN of Arduino Nano
- OUT1 connected to IN1 of DC Mini Metal Gear Motor
- OUT2 connected to IN2 of DC Mini Metal Gear Motor
- OUT3 connected to IN1 of second DC Mini Metal Gear Motor
- OUT4 connected to IN2 of second DC Mini Metal Gear Motor
- 12V connected to 2 of Rocker Switch (SPST)
- GND connected to - of 9V Battery
DC Mini Metal Gear Motor
- IN1 connected to OUT1 of L298N DC Motor Driver
- IN2 connected to OUT2 of L298N DC Motor Driver
Second DC Mini Metal Gear Motor
- IN1 connected to OUT3 of L298N DC Motor Driver
- IN2 connected to OUT4 of L298N DC Motor Driver
5-Channel IR Sensor
- GND connected to GND of Arduino Nano
- VCC connected to 5V of Arduino Nano
- S5 connected to A4 of Arduino Nano
- S4 connected to A3 of Arduino Nano
- S3 connected to A2 of Arduino Nano
- S2 connected to A1 of Arduino Nano
- S1 connected to A0 of Arduino Nano
9V Battery
- - connected to GND of L298N DC Motor Driver
- + connected to 1 of Rocker Switch (SPST)
Rocker Switch (SPST)
- 1 connected to + of 9V Battery
- 2 connected to 12V of L298N DC Motor Driver
Documented Code
Arduino Nano Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Additional Documentation (documentation.txt)