Arduino Nano-Based Line Following Robot with Dual DC Motors and IR Sensors
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 TB6612FNG Motor Driver, two DC Mini Metal Gear Motors, a 5-channel IR sensor, a Voltage Regulator, and a 7.4V power source. The circuit is designed to control the motors based on sensor inputs, with the Arduino Nano serving as the central microcontroller.
Component List
Arduino Nano
- 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
- Description: A small, complete, and breadboard-friendly board based on the ATmega328P.
- Purpose: Central microcontroller for the circuit.
TB6612FNG Motor Driver
- Pins: GND, B01, B02, A02, A01, VCC, VM, PWMB, BI2, BI1, STBY, AI1, AI2, PWMA
- Description: Dual motor driver capable of driving two DC motors.
- Purpose: Controls the DC motors based on signals from the Arduino Nano.
DC Mini Metal Gear Motor
- Pins: IN1, IN2
- Description: Small DC motor with metal gears for increased torque.
- Purpose: Provides mechanical movement.
5-channel IR sensor
- Pins: VCC, GND, S1, S2, S3, S4, S5, CLP, Near
- Description: Infrared sensor array for detecting line positions.
- Purpose: Provides sensor input to the Arduino Nano.
Voltage Regulator
- Pins: IN, GND, OUT
- Description: Regulates the voltage from the power source to a stable output.
- Purpose: Provides a stable voltage supply to the circuit components.
7.4V Power Source
- Pins: +, -
- Description: Provides power to the circuit.
- Purpose: Main power supply for the circuit.
Wiring Details
Arduino Nano
- D10: Connected to AI2 of the TB6612FNG Motor Driver
- A0: Connected to S1 of the 5-channel IR sensor
- D9: Connected to AI1 of the TB6612FNG Motor Driver
- A1: Connected to S2 of the 5-channel IR sensor
- D8: Connected to BI2 of the TB6612FNG Motor Driver
- A2: Connected to S3 of the 5-channel IR sensor
- D7: Connected to BI1 of the TB6612FNG Motor Driver
- A3: Connected to S4 of the 5-channel IR sensor
- A4: Connected to S5 of the 5-channel IR sensor
- D5: Connected to PWMB of the TB6612FNG Motor Driver
- D4: Connected to STBY of the TB6612FNG Motor Driver
- GND: Connected to GND of the TB6612FNG Motor Driver and GND of the 5-channel IR sensor
- VIN: Connected to VCC of the TB6612FNG Motor Driver and VCC of the 5-channel IR sensor
TB6612FNG Motor Driver
- AI2: Connected to D10 of the Arduino Nano
- AI1: Connected to D9 of the Arduino Nano
- BI2: Connected to D8 of the Arduino Nano
- BI1: Connected to D7 of the Arduino Nano
- PWMB: Connected to D5 of the Arduino Nano
- STBY: Connected to D4 of the Arduino Nano
- GND: Connected to GND of the Arduino Nano and GND of the 5-channel IR sensor
- VCC: Connected to VIN of the Arduino Nano and VCC of the 5-channel IR sensor
- VM: Connected to + of the 7.4V power source and IN of the Voltage Regulator
- A01: Connected to IN1 of the first DC Mini Metal Gear Motor
- A02: Connected to IN2 of the first DC Mini Metal Gear Motor
- B01: Connected to IN1 of the second DC Mini Metal Gear Motor
- B02: Connected to IN2 of the second DC Mini Metal Gear Motor
DC Mini Metal Gear Motor
- First Motor IN1: Connected to A01 of the TB6612FNG Motor Driver
- First Motor IN2: Connected to A02 of the TB6612FNG Motor Driver
- Second Motor IN1: Connected to B01 of the TB6612FNG Motor Driver
- Second Motor IN2: Connected to B02 of the TB6612FNG Motor Driver
5-channel IR sensor
- S1: Connected to A0 of the Arduino Nano
- S2: Connected to A1 of the Arduino Nano
- S3: Connected to A2 of the Arduino Nano
- S4: Connected to A3 of the Arduino Nano
- S5: Connected to A4 of the Arduino Nano
- GND: Connected to GND of the Arduino Nano and GND of the TB6612FNG Motor Driver
- VCC: Connected to VIN of the Arduino Nano and VCC of the TB6612FNG Motor Driver
Voltage Regulator
- IN: Connected to + of the 7.4V power source and VM of the TB6612FNG Motor Driver
- GND: Connected to - of the 7.4V power source
- OUT: Connected to VCC of the TB6612FNG Motor Driver, VIN of the Arduino Nano, and VCC of the 5-channel IR sensor
7.4V Power Source
- +: Connected to VM of the TB6612FNG Motor Driver and IN of the Voltage Regulator
- -: Connected to GND of the Voltage Regulator
Documented Code
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.