Arduino Mega 2560 Controlled DC Motor System with L298N Drivers
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit involves an Arduino Mega 2560 microcontroller controlling four DC motors through two L298N DC motor drivers. The Arduino Mega 2560 provides the necessary control signals to the motor drivers, which in turn drive the DC motors. The circuit is powered by a 5V supply shared among the components.
Component List
Arduino Mega 2560
- Description: A microcontroller board based on the ATmega2560.
- Pins: IOREF, RESET, 3V3, 5V, GND, VIN, A0-A15, D0-D53, AREF, SDA, SCL
DC Motor
- Description: A simple 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 5V pin of both L298N DC motor drivers.
- GND: Connected to GND pin of both L298N DC motor drivers.
- D1 TX0: Connected to IN1 pin of the first L298N DC motor driver.
- D2 PWM: Connected to IN2 pin of the first L298N DC motor driver.
- D3 PWM: Connected to IN3 pin of the first L298N DC motor driver.
- D4 PWM: Connected to IN4 pin of the first L298N DC motor driver.
- D5 PWM: Connected to ENA pin of the first L298N DC motor driver.
- D6 PWM: Connected to ENB pin of the first L298N DC motor driver.
- D8 PWM: Connected to ENA pin of the second L298N DC motor driver.
- D9 PWM: Connected to IN1 pin of the second L298N DC motor driver.
- D10 PWM: Connected to IN2 pin of the second L298N DC motor driver.
- D11 PWM: Connected to IN3 pin of the second L298N DC motor driver.
- D12 PWM: Connected to IN4 pin of the second L298N DC motor driver.
- D13 PWM: Connected to ENB pin of the second L298N DC motor driver.
DC Motor 1
- pin 1: Connected to OUT1 pin of the second L298N DC motor driver.
- pin 2: Connected to OUT2 pin of the second L298N DC motor driver.
DC Motor 2
- pin 1: Connected to OUT1 pin of the first L298N DC motor driver.
- pin 2: Connected to OUT2 pin of the first L298N DC motor driver.
DC Motor 3
- pin 1: Connected to OUT3 pin of the second L298N DC motor driver.
- pin 2: Connected to OUT4 pin of the second L298N DC motor driver.
DC Motor 4
- pin 1: Connected to OUT3 pin of the first L298N DC motor driver.
- pin 2: Connected to OUT4 pin of the first L298N DC motor driver.
L298N DC Motor Driver 1
- 5V: Connected to 5V pin of the Arduino Mega 2560.
- GND: Connected to GND pin of the Arduino Mega 2560.
- IN1: Connected to D1 TX0 pin of the Arduino Mega 2560.
- IN2: Connected to D2 PWM pin of the Arduino Mega 2560.
- IN3: Connected to D3 PWM pin of the Arduino Mega 2560.
- IN4: Connected to D4 PWM pin of the Arduino Mega 2560.
- ENA: Connected to D5 PWM pin of the Arduino Mega 2560.
- ENB: Connected to D6 PWM pin of the Arduino Mega 2560.
- OUT1: Connected to pin 1 of DC Motor 2.
- OUT2: Connected to pin 2 of DC Motor 2.
- OUT3: Connected to pin 1 of DC Motor 4.
- OUT4: Connected to pin 2 of DC Motor 4.
L298N DC Motor Driver 2
- 5V: Connected to 5V pin of the Arduino Mega 2560.
- GND: Connected to GND pin of the Arduino Mega 2560.
- IN1: Connected to D9 PWM pin of the Arduino Mega 2560.
- IN2: Connected to D10 PWM pin of the Arduino Mega 2560.
- IN3: Connected to D11 PWM pin of the Arduino Mega 2560.
- IN4: Connected to D12 PWM pin of the Arduino Mega 2560.
- ENA: Connected to D8 PWM pin of the Arduino Mega 2560.
- ENB: Connected to D13 PWM pin of the Arduino Mega 2560.
- OUT1: Connected to pin 1 of DC Motor 1.
- OUT2: Connected to pin 2 of DC Motor 1.
- OUT3: Connected to pin 1 of DC Motor 3.
- OUT4: Connected to pin 2 of DC Motor 3.
Documented Code
Arduino Mega 2560 Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Documentation (documentation.txt)
This documentation provides a comprehensive overview of the circuit, including a summary, detailed component list, wiring details, and the code used in the microcontroller.