Arduino-Controlled Dual DC Motor Robot with Ultrasonic and IR Sensors
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This document provides a detailed overview of a circuit designed to control two DC motors using an Arduino UNO microcontroller and an L298N DC motor driver. The circuit also includes two IR sensors and an ultrasonic sensor for input, and it is powered by a 12V battery. The Arduino UNO manages the sensors and motor driver to facilitate the desired operation of the motors.
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.
DC Motor (x2)
- An electric motor that runs on direct current (DC) electricity.
- It has two pins for power and ground.
L298N DC Motor Driver
- A dual H-bridge motor driver that can drive two DC motors or one stepper motor.
- It has pins for motor outputs, power supply, and control inputs.
Battery 12V
- A 12V battery to provide power to the circuit.
- It has a positive and a negative terminal.
Ultrasonic Sensor
- A sensor that measures distance by emitting ultrasonic waves and measuring the time taken for the echo to return.
- It has pins for VCC, Trigger, Echo, and Ground.
IR Sensor (x2)
- An infrared sensor that detects infrared radiation from objects in its field of view.
- It has pins for output, ground, and VCC.
Wiring Details
Arduino UNO
- 5V connected to the VCC of both IR sensors and the Ultrasonic Sensor.
- GND connected to the ground of both IR sensors, the Ultrasonic Sensor, and the L298N DC motor driver.
- Vin not connected in the provided net list.
- A1 connected to the output of one IR sensor.
- A2 connected to the output of the other IR sensor.
- D3 connected to the Trigger pin of the Ultrasonic Sensor.
- D5 connected to the Echo pin of the Ultrasonic Sensor.
- D6-D11 connected to the IN1-IN4, ENA, and ENB pins of the L298N DC motor driver for motor control.
DC Motor
- Pin 1 of the first DC Motor connected to OUT1 of the L298N DC motor driver.
- Pin 2 of the first DC Motor connected to OUT2 of the L298N DC motor driver.
- Pin 1 of the second DC Motor connected to OUT4 of the L298N DC motor driver.
- Pin 2 of the second DC Motor connected to OUT3 of the L298N DC motor driver.
L298N DC Motor Driver
- GND connected to the GND of the Arduino UNO and the negative terminal of the 12V battery.
- 12V connected to the positive terminal of the 12V battery.
- ENA, ENB, IN1, IN2, IN3, IN4 connected to the corresponding pins D10-D11 and D6-D9 on the Arduino UNO for motor control.
Battery 12V
- + connected to the 12V pin of the L298N DC motor driver.
- - connected to the GND pin of the L298N DC motor driver.
Ultrasonic Sensor
- +VCC connected to the 5V of the Arduino UNO.
- Trigger connected to D3 of the Arduino UNO.
- Echo connected to D5 of the Arduino UNO.
- GND connected to the GND of the Arduino UNO.
IR Sensor
- VCC connected to the 5V of the Arduino UNO.
- GND connected to the GND of the Arduino UNO.
- Out connected to A1 and A2 of the Arduino UNO (for each sensor respectively).
Documented Code
Arduino UNO 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 sensors. It needs to be completed with the appropriate setup and loop code to implement the desired functionality.