Arduino Mega 2560 Controlled Dual DC Motor System with L298N Driver
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit involves an Arduino Mega 2560 microcontroller, an L298N DC motor driver, and two DC motors. The Arduino Mega 2560 controls the L298N motor driver, which in turn drives the two DC motors. The circuit is designed to allow the Arduino to control the speed and direction of the DC motors.
Component List
Arduino Mega 2560
- Description: A microcontroller board based on the ATmega2560.
- Pins: IOREF, RESET, 3V3, 5V, GND, VIN, A0-A15, D0-D53, PWM pins, AREF, SDA, SCL.
DC Motor (Motor 1)
- Description: A standard DC motor.
- Pins: pin 1, pin 2.
DC Motor (Motor 2)
- Description: A standard DC motor.
- Pins: pin 1, pin 2.
L298N DC Motor Driver
- Description: A dual H-Bridge motor driver that allows control of two DC motors.
- Pins: OUT1, OUT2, 12V, GND, 5V, OUT3, OUT4, 5V-ENA-JMP-I, 5V-ENA-JMP-O, +5V-J1, +5V-J2, ENA, IN1, IN2, IN3, IN4, ENB.
Wiring Details
Arduino Mega 2560
- 5V: Connected to L298N DC motor driver 5V.
- GND: Connected to L298N DC motor driver GND.
- VIN: Connected to L298N DC motor driver 12V.
- D2 PWM: Connected to L298N DC motor driver ENA.
- D3 PWM: Connected to L298N DC motor driver ENB.
- D4 PWM: Connected to L298N DC motor driver IN1.
- D5 PWM: Connected to L298N DC motor driver IN2.
- D6 PWM: Connected to L298N DC motor driver IN3.
- D7 PWM: Connected to L298N DC motor driver IN4.
DC Motor (Motor 1)
- pin 1: Connected to L298N DC motor driver OUT2.
- pin 2: Connected to L298N DC motor driver OUT1.
DC Motor (Motor 2)
- pin 1: Connected to L298N DC motor driver OUT4.
- pin 2: Connected to L298N DC motor driver OUT3.
L298N DC Motor Driver
- 5V: Connected to Arduino Mega 2560 5V.
- GND: Connected to Arduino Mega 2560 GND.
- 12V: Connected to Arduino Mega 2560 VIN.
- ENA: Connected to Arduino Mega 2560 D2 PWM.
- ENB: Connected to Arduino Mega 2560 D3 PWM.
- IN1: Connected to Arduino Mega 2560 D4 PWM.
- IN2: Connected to Arduino Mega 2560 D5 PWM.
- IN3: Connected to Arduino Mega 2560 D6 PWM.
- IN4: Connected to Arduino Mega 2560 D7 PWM.
- OUT1: Connected to DC Motor (Motor 1) pin 2.
- OUT2: Connected to DC Motor (Motor 1) pin 1.
- OUT3: Connected to DC Motor (Motor 2) pin 2.
- OUT4: Connected to DC Motor (Motor 2) pin 1.
Documented Code
Arduino Mega 2560 Code
File Name: sketch.ino
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
File Name: documentation.txt
This documentation provides a comprehensive overview of the circuit, including a summary, detailed component list, wiring details, and the code used for the Arduino Mega 2560.