Arduino Nano Controlled Dual Motor Driver with Joystick Interface
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to control a pair of DC motors using an Arduino Nano as the microcontroller and an L298N as the motor driver. The motors are powered by an 18650 Li-Ion battery, and the power flow is controlled by a rocker switch. A KY-023 Dual Axis Joystick Module is used to provide input to the Arduino Nano, which then processes the input and controls the speed and direction of the motors through the L298N driver.
Component List
Arduino Nano
- Microcontroller board based on the ATmega328P
- It has a variety of digital and analog I/O pins.
18650 Li-Ion Battery
- Rechargeable battery providing the power source for the circuit.
L298N DC Motor Driver
- A module capable of driving two DC motors with control over speed and direction.
Rocker Switch
- A simple on-off switch to control the power supply to the circuit.
KY-023 Dual Axis Joystick Module
- An input device with two axes of control and a pushbutton switch.
Motor Amarillo Motorreductor Hobby (x2)
- DC gear motors used for applications requiring torque and simple rotation.
Wiring Details
Arduino Nano
D5- Connected to ENA on the L298N motor driver for motor speed control.D6- Connected to IN1 on the L298N motor driver for motor direction control.D7- Connected to IN2 on the L298N motor driver for motor direction control.D8- Connected to IN3 on the L298N motor driver for motor direction control.D9- Connected to IN4 on the L298N motor driver for motor direction control.D10- Connected to ENB on the L298N motor driver for motor speed control.VIN- Connected to the +5V pin on the KY-023 Joystick and 5V on the L298N motor driver.GND- Common ground with the KY-023 Joystick, L298N motor driver, and 18650 Li-Ion battery.A1- Connected to VRx on the KY-023 Joystick for X-axis input.A0- Connected to VRy on the KY-023 Joystick for Y-axis input.
18650 Li-Ion Battery
Positive- Connected to pin 2 on the Rocker Switch.Negative- Common ground with the Arduino Nano, L298N motor driver, and KY-023 Joystick.
L298N DC Motor Driver
ENAandENB- Connected to Arduino Nano for motor speed control.IN1toIN4- Connected to Arduino Nano for motor direction control.OUT1toOUT4- Connected to the DC motors for driving them.12V- Connected to pin 1 on the Rocker Switch for power input.5V- Connected to the +5V pin on the KY-023 Joystick and VIN on the Arduino Nano.GND- Common ground with the Arduino Nano, KY-023 Joystick, and 18650 Li-Ion battery.
Rocker Switch
1- Connected to the 12V input on the L298N motor driver.2- Connected to the positive terminal of the 18650 Li-Ion battery.
KY-023 Dual Axis Joystick Module
+5V- Connected to the 5V output on the L298N motor driver and VIN on the Arduino Nano.GND- Common ground with the Arduino Nano, L298N motor driver, and 18650 Li-Ion battery.VRx- Connected to A1 on the Arduino Nano for X-axis input.VRy- Connected to A0 on the Arduino Nano for Y-axis input.
Motor Amarillo Motorreductor Hobby
vcc- Connected to OUT2 and OUT4 on the L298N motor driver for power.GND- Connected to OUT1 and OUT3 on the L298N motor driver for ground.
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:
}
Additional Notes (documentation.txt)
No additional code documentation was provided for the Arduino Nano.