Arduino-Controlled Dual Motor Robot with L298N Driver and Rocker Switch Power Control
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to control a pair of motors with wheels using an Arduino Uno R3 microcontroller and an L298N DC motor driver. The motors are powered by a 9V battery, which is connected through a rocker switch to control the power supply. The Arduino Uno R3 interfaces with the L298N motor driver to control the direction and speed of the motors.
Component List
Arduino Uno R3
- 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 a pair of DC motors or a stepper motor.
- It has 4 input pins for controlling the motors and 2 enable pins to enable or disable the motors.
Motor and Wheels (x2)
- DC motors connected to wheels, allowing for movement in a robot or vehicle setup.
Rocker Switch
- A simple on/off switch that controls the connection of the circuit to the power source.
9V Battery
- Standard 9V battery providing the power source for the circuit.
Wiring Details
Arduino Uno R3
- 5V connected to L298N 5V
- GND connected to L298N GND and 9V Battery -
- Digital Pin 2 connected to L298N IN1
- Digital Pin 3 connected to L298N IN2
- Digital Pin 4 connected to L298N IN3
- Digital Pin 5 connected to L298N IN4
L298N DC Motor Driver
- OUT1 connected to Motor and Wheels vcc (Motor 1)
- OUT2 connected to Motor and Wheels GND (Motor 1)
- OUT3 connected to Motor and Wheels GND (Motor 2)
- OUT4 connected to Motor and Wheels vcc (Motor 2)
- 12V connected to Rocker Switch Pin 2
- GND connected to Arduino Uno R3 GND
- 5V connected to Arduino Uno R3 5V
Motor and Wheels
- vcc connected to L298N OUT1 (Motor 1) and L298N OUT4 (Motor 2)
- GND connected to L298N OUT2 (Motor 1) and L298N OUT3 (Motor 2)
Rocker Switch
- Pin 1 connected to 9V Battery +
- Pin 2 connected to L298N 12V
9V Battery
- + connected to Rocker Switch Pin 1
- - connected to Arduino Uno R3 GND
Documented Code
Arduino Uno R3 Code (sketch.ino)
void setup() {
// Setup code here, to run once:
}
void loop() {
// Main code here, to run repeatedly:
}
L298N DC Motor Driver Code (sketch.ino)
void setup() {
// Setup code here, to run once:
}
void loop() {
// Main code here, to run repeatedly:
}
Note: The provided code for both the Arduino Uno R3 and the L298N DC motor driver is a template with no specific functionality. The actual implementation should include the initialization of the motor driver pins as outputs and the logic to control the motors' speed and direction.