Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Nano Controlled Dual DC Motor Driver Circuit

View and Edit Project In Cirkit DesignerImage of Arduino Nano Controlled Dual DC Motor Driver Circuit

Circuit Documentation

Summary

This circuit is designed to control two DC Mini Metal Gear Motors using an Arduino Nano microcontroller and an L298N DC motor driver. The motors are powered by a lipo battery with a capacity of 2200mAh and a discharge rate of 30C. The Arduino Nano is programmed to turn on the motors and set them to move forward upon powering up the system.

Component List

Arduino Nano

L298N DC Motor Driver

DC Mini Metal Gear Motor (x2)

Lipo Battery 2200mAh 30C

Wiring Details

Arduino Nano

L298N DC Motor Driver

DC Mini Metal Gear Motor 1

DC Mini Metal Gear Motor 2

Lipo Battery 2200mAh 30C

Documented Code

/*
 * This Arduino sketch controls two DC motors using an L298N motor driver.
 * The motors are powered on and set to move forward when the Arduino is
 * powered on.
 */

// Define motor control pins
const int motor1Pin1 = 2; // IN1 on L298N
const int motor1Pin2 = 4; // IN2 on L298N
const int motor2Pin1 = 6; // IN3 on L298N
const int motor2Pin2 = 8; // IN4 on L298N

void setup() {
  // Set all motor control pins to output
  pinMode(motor1Pin1, OUTPUT);
  pinMode(motor1Pin2, OUTPUT);
  pinMode(motor2Pin1, OUTPUT);
  pinMode(motor2Pin2, OUTPUT);

  // Turn on motors to move forward
  digitalWrite(motor1Pin1, HIGH);
  digitalWrite(motor1Pin2, LOW);
  digitalWrite(motor2Pin1, HIGH);
  digitalWrite(motor2Pin2, LOW);
}

void loop() {
  // No need to do anything in the loop for this task
}

The code is written for the Arduino Nano and is responsible for initializing the motor control pins as outputs and setting the motors to move forward by sending appropriate HIGH and LOW signals to the L298N motor driver. The setup() function is called once when the Arduino is powered on, and the loop() function runs continuously but is not used in this application.