Arduino-Controlled Dual Motor Driver with MPU-6050 Integration
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to control two hobby gearmotors using an L298N DC motor driver, which is interfaced with an Arduino UNO microcontroller. The MPU-6050 sensor is included for motion tracking, and a 12V battery powers the system through a toggle switch. The Arduino UNO manages the motor driver inputs and communicates with the MPU-6050 via I2C.
Component List
L298N DC Motor Driver
- Description: A motor driver module capable of driving two DC motors or one stepper motor.
- 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.
Hobby Gearmotor with 48:1 Gearbox
- Description: A DC motor with a gearbox for increased torque.
- Pins: pin 1, pin 2.
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0.
Battery 12V
- Description: A 12V power source for the circuit.
- Pins: +, -.
MPU-6050
- Description: A motion tracking device with a 3-axis gyroscope and a 3-axis accelerometer.
- Pins: VCC, GND, SCL, SDA, XDA, XCL, AD0, INT.
Toggle Switch SPST
- Description: A single-pole single-throw switch to control the power supply.
- Pins: L1, COM.
Wiring Details
L298N DC Motor Driver
- 5V: Connected to Arduino UNO Vin.
- GND: Common ground with Arduino UNO and 12V battery.
- 12V: Connected to COM of Toggle Switch SPST.
- ENA: Connected to Arduino UNO D11.
- ENB: Connected to Arduino UNO D10.
- IN1: Connected to Arduino UNO D7.
- IN2: Connected to Arduino UNO D6.
- IN3: Connected to Arduino UNO D5.
- IN4: Connected to Arduino UNO D4.
- OUT1: Connected to Gearmotor 1 pin 2.
- OUT2: Connected to Gearmotor 1 pin 1.
- OUT3: Connected to Gearmotors 2 and 3 pin 2.
- OUT4: Connected to Gearmotors 2 and 3 pin 1.
Hobby Gearmotor with 48:1 Gearbox
- Gearmotor 1: Connected to L298N OUT1 and OUT2.
- Gearmotor 2: Connected to L298N OUT3.
- Gearmotor 3: Connected to L298N OUT4.
Arduino UNO
- 5V: Connected to MPU-6050 VCC.
- GND: Common ground with MPU-6050, L298N, and 12V battery.
- Vin: Connected to L298N 5V.
- A4 (SDA): Connected to MPU-6050 SDA.
- A5 (SCL): Connected to MPU-6050 SCL.
- D11: Connected to L298N ENA.
- D10: Connected to L298N ENB.
- D7: Connected to L298N IN1.
- D6: Connected to L298N IN2.
- D5: Connected to L298N IN3.
- D4: Connected to L298N IN4.
Battery 12V
- +: Connected to L1 of Toggle Switch SPST.
- -: Common ground with L298N and Arduino UNO.
MPU-6050
- VCC: Connected to Arduino UNO 5V.
- GND: Common ground with Arduino UNO.
- SDA: Connected to Arduino UNO A4.
- SCL: Connected to Arduino UNO A5.
Toggle Switch SPST
- L1: Connected to 12V battery +.
- COM: Connected to L298N 12V.
Documented Code
Arduino UNO Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Note: The provided code is a template and does not contain any functional code to control the motors or read from the MPU-6050 sensor. This will need to be implemented based on the specific requirements of the project.