Circuit Documentation
Summary
This circuit is designed to control multiple DC motors using an Arduino UNO microcontroller and an L298N DC motor driver. The circuit also includes IR sensors for input, which can be used for various sensing applications such as obstacle detection or line tracking. The Arduino UNO is powered by a 12V battery, which also supplies power to the motor driver. The IR sensors are powered by the 5V output from the Arduino UNO.
Component List
Arduino UNO
- Microcontroller board based on the ATmega328P
- It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button.
L298N DC Motor Driver
- A dual H-bridge motor driver capable of driving two DC motors or one stepper motor.
- It has 2 H-bridges with 2 inputs and 1 enable pin for each bridge.
DC Motors
- Four identical DC motors used for motion applications.
- Each motor has two pins for connecting to the motor driver.
12V Battery
- Provides power to the circuit.
- Has a positive and negative terminal for power supply.
IR Sensors
- Three IR sensors used for detecting obstacles or for line tracking.
- Each sensor has an output, ground, and VCC pin.
Wiring Details
Arduino UNO
- 5V pin is connected to the VCC pins of all IR sensors.
- GND pin is connected to the ground of the 12V battery and the GND pins of all IR sensors.
- Vin pin is connected to the 5V pin on the L298N motor driver.
- Digital Pins D11, D10, D9, D8, D7, D6, D5, D4, D3 are used to interface with the L298N motor driver and IR sensors.
L298N DC Motor Driver
- GND pin is connected to the ground of the 12V battery.
- 12V pin is connected to the positive terminal of the 12V battery.
- 5V pin is connected to the Vin pin on the Arduino UNO.
- IN1, IN2, IN3, IN4 pins are connected to Arduino UNO digital pins D11, D10, D9, D6 respectively.
- ENA, ENB pins are connected to Arduino UNO digital pins D3, D5 respectively.
- OUT1, OUT2, OUT3, OUT4 pins are connected to the DC motors.
DC Motors
- Two motors are connected to OUT1 and OUT2 of the L298N motor driver.
- Two motors are connected to OUT3 and OUT4 of the L298N motor driver.
IR Sensors
- VCC pins are all connected to the 5V pin on the Arduino UNO.
- GND pins are all connected to the GND pin on the Arduino UNO.
- OUT pins are connected to Arduino UNO digital pins D8, D7, D4 respectively.
12V Battery
- Positive (+) terminal is connected to the 12V pin on the L298N motor driver.
- Negative (-) terminal is connected to the GND pin on the L298N motor driver and the GND pin on the Arduino UNO.
Documented Code
Arduino UNO Code (sketch.ino)
void setup() {
}
void loop() {
}
The provided code is a template with empty setup()
and loop()
functions. The setup()
function is intended for initialization code that runs once at the start of the program, while the loop()
function contains code that runs continuously.
Additional Notes
- The code for the Arduino UNO is currently a placeholder and needs to be completed with the logic for controlling the DC motors via the L298N motor driver and reading the IR sensors.
- The IR sensors' outputs are connected to digital pins D8, D7, and D4, which can be set up as inputs in the
setup()
function.
- The motor driver's input pins (IN1, IN2, IN3, IN4) and enable pins (ENA, ENB) are connected to digital pins D11, D10, D9, D6, D3, and D5, respectively, which should be set up as outputs in the
setup()
function.
- The
loop()
function should contain the logic to read the IR sensors and control the motors accordingly.