Circuit Documentation
Summary
This circuit is designed to control two DC motors using an L298N DC motor driver, which is interfaced with an Arduino Nano microcontroller. The Arduino Nano also reads inputs from a 5 channel IR sensor. Power is supplied by a series connection of two 18650 Li-ion batteries, and a rocker switch is used to control the power flow to the motor driver. The motors are standard yellow hobby gear motors.
Component List
L298N DC Motor Driver
- Description: A module capable of driving 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.
5 Channel IR Sensor
- Description: An infrared sensor with 5 channels for line tracking or obstacle detection.
- Pins: VCC, GND, S1, S2, S3, S4, S5, CLP, Near.
Arduino Nano
- Description: A small, complete, and breadboard-friendly board based on the ATmega328.
- 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.
Motor Amarillo Motorreductor Hobby (2x)
- Description: A yellow hobby gear motor.
- Pins: VCC, GND.
Rocker Switch
- Description: A switch to control the power supply to the circuit.
- Pins: 1, 2.
18650 Li-ion Battery x 2
- Description: Two 18650 Li-ion batteries providing the power source for the circuit.
- Pins: +, -.
Wiring Details
L298N DC Motor Driver
- OUT1 connected to Motor 1 VCC
- OUT2 connected to Motor 1 GND
- 12V connected to Rocker Switch and Battery +
- GND connected to Arduino Nano GND, IR Sensor GND, and Battery -
- 5V connected to Arduino Nano VIN
- OUT3 connected to Motor 2 GND
- OUT4 connected to Motor 2 VCC
- ENA connected to Arduino Nano D7
- IN1 connected to Arduino Nano D9
- IN2 connected to Arduino Nano D10
- IN3 connected to Arduino Nano D11/MOSI
- IN4 connected to Arduino Nano D12/MISO
- ENB connected to Arduino Nano D8
5 Channel IR Sensor
- VCC connected to Arduino Nano 5V
- GND connected to Arduino Nano GND
- S1 connected to Arduino Nano D2
- S2 connected to Arduino Nano D3
- S3 connected to Arduino Nano D4
- S4 connected to Arduino Nano D5
- S5 connected to Arduino Nano D6
Arduino Nano
- GND connected to Motor Driver GND, IR Sensor GND, and Battery -
- VIN connected to Motor Driver 5V
- 5V connected to IR Sensor VCC
- D2 to D6 connected to IR Sensor S1 to S5 respectively
- D7 connected to Motor Driver ENA
- D8 connected to Motor Driver ENB
- D9 connected to Motor Driver IN1
- D10 connected to Motor Driver IN2
- D11/MOSI connected to Motor Driver IN3
- D12/MISO connected to Motor Driver IN4
Motor Amarillo Motorreductor Hobby
- Two motors with respective connections to the Motor Driver OUT1/OUT2 and OUT3/OUT4.
Rocker Switch
- Pin 1 connected to Battery +
- Pin 2 connected to Motor Driver 12V
18650 Li-ion Battery x 2
-
- connected to Rocker Switch
-
- connected to Arduino Nano GND, Motor Driver GND, and IR Sensor GND
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:
}
Note: The provided code is a template and does not contain any functional code to control the motors or read the IR sensor inputs. This will need to be implemented based on the specific requirements of the project.
