Arduino Nano-Based Line Following Robot with IR Sensor Array and DC Motors
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This document provides a detailed overview of a circuit that includes an Arduino Nano, a DC motor driver (L298N), two DC Mini Metal Gear Motors, a 5-channel IR array, and a 12V battery. The Arduino Nano is used to control the motors via the L298N motor driver, and the IR array is used for sensing. The 12V battery powers the entire circuit.
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
DC Mini Metal Gear Motor
- Description: A small DC motor with metal gears for increased durability and torque.
- Pins: IN1, IN2
5-channel IR Array
- Description: An array of 5 infrared sensors used for line following or object detection.
- Pins: A5, A4, A3, A2, A1, VCC, GND
Battery 12V
- Description: A 12V battery used to power the circuit.
- Pins: +, -
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
Wiring Details
Arduino Nano
- D5 connected to L298N DC motor driver IN4
- D6 connected to L298N DC motor driver IN3
- D9 connected to L298N DC motor driver IN2
- D10 connected to L298N DC motor driver IN1
- VIN connected to 5-channel IR array VCC and L298N DC motor driver 5V
- GND connected to 5-channel IR array GND, L298N DC motor driver GND, and battery 12v -
- A5 connected to 5-channel IR array A5
- A4 connected to 5-channel IR array A4
- A3 connected to 5-channel IR array A3
- A2 connected to 5-channel IR array A2
- A1 connected to 5-channel IR array A1
DC Mini Metal Gear Motor 1
- IN2 connected to L298N DC motor driver OUT1
- IN1 connected to L298N DC motor driver OUT2
DC Mini Metal Gear Motor 2
- IN2 connected to L298N DC motor driver OUT3
- IN1 connected to L298N DC motor driver OUT4
5-channel IR Array
- VCC connected to Arduino Nano VIN and L298N DC motor driver 5V
- GND connected to Arduino Nano GND, L298N DC motor driver GND, and battery 12v -
- A5 connected to Arduino Nano A5
- A4 connected to Arduino Nano A4
- A3 connected to Arduino Nano A3
- A2 connected to Arduino Nano A2
- A1 connected to Arduino Nano A1
Battery 12V
- + connected to L298N DC motor driver 12V
- - connected to Arduino Nano GND, L298N DC motor driver GND, and 5-channel IR array GND
L298N DC Motor Driver
- IN4 connected to Arduino Nano D5
- IN3 connected to Arduino Nano D6
- IN2 connected to Arduino Nano D9
- IN1 connected to Arduino Nano D10
- 5V connected to Arduino Nano VIN and 5-channel IR array VCC
- GND connected to Arduino Nano GND, 5-channel IR array GND, and battery 12v -
- OUT1 connected to DC Mini Metal Gear Motor 1 IN2
- OUT2 connected to DC Mini Metal Gear Motor 1 IN1
- OUT3 connected to DC Mini Metal Gear Motor 2 IN2
- OUT4 connected to DC Mini Metal Gear Motor 2 IN1
- 12V connected to battery 12v +
Code Documentation
Arduino Nano Code
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 Nano. The setup() function is where you initialize your components and settings, and the loop() function is where the main logic of your program runs repeatedly.