Arduino UNO and L298N Motor Driver Controlled Dual Gear Motor System with Integrated Encoders
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit involves an Arduino UNO microcontroller, an L298N DC motor driver, a 12V 5Ah battery, and two gear motors with integrated encoders. The Arduino UNO controls the motor driver, which in turn drives the gear motors. The encoders provide feedback to the Arduino for precise motor control.
Component List
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
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
12V 5Ah Battery
- Description: A rechargeable battery providing 12V power.
- Pins: 12v +, 12v -
Gear Motor with Integrated Encoder (Motor 1)
- Description: A DC gear motor with an integrated encoder for feedback.
- Pins: MOTOR -, MOTOR+, Encoder -, Encoder +, Encoder A, Encoder B
Gear Motor with Integrated Encoder (Motor 2)
- Description: A DC gear motor with an integrated encoder for feedback.
- Pins: MOTOR -, MOTOR+, Encoder -, Encoder +, Encoder A, Encoder B
Wiring Details
Arduino UNO
- 5V: Connected to 5V pin of L298N DC motor driver, 5V pin of Gear Motor with Integrated Encoder (Motor 1), 5V pin of Gear Motor with Integrated Encoder (Motor 2), and 12v + pin of 12V 5Ah Battery.
- GND: Connected to GND pin of L298N DC motor driver, Encoder - pin of Gear Motor with Integrated Encoder (Motor 1), Encoder - pin of Gear Motor with Integrated Encoder (Motor 2), and 12v - pin of 12V 5Ah Battery.
- D11: Connected to Encoder B pin of Gear Motor with Integrated Encoder (Motor 1).
- D10: Connected to ENB pin of L298N DC motor driver.
- D9: Connected to ENA pin of L298N DC motor driver.
- D8: Connected to Encoder A pin of Gear Motor with Integrated Encoder (Motor 1).
- D7: Connected to IN4 pin of L298N DC motor driver.
- D6: Connected to IN3 pin of L298N DC motor driver.
- D5: Connected to Encoder B pin of Gear Motor with Integrated Encoder (Motor 2).
- D4: Connected to Encoder A pin of Gear Motor with Integrated Encoder (Motor 2).
- D3: Connected to IN2 pin of L298N DC motor driver.
- D2: Connected to IN1 pin of L298N DC motor driver.
L298N DC Motor Driver
- 12V: Connected to 12v + pin of 12V 5Ah Battery.
- 5V: Connected to 5V pin of Arduino UNO.
- GND: Connected to GND pin of Arduino UNO.
- OUT1: Connected to MOTOR+ pin of Gear Motor with Integrated Encoder (Motor 2).
- OUT2: Connected to MOTOR - pin of Gear Motor with Integrated Encoder (Motor 2).
- OUT3: Connected to MOTOR - pin of Gear Motor with Integrated Encoder (Motor 1).
- OUT4: Connected to MOTOR+ pin of Gear Motor with Integrated Encoder (Motor 1).
- ENA: Connected to D9 pin of Arduino UNO.
- IN1: Connected to D2 pin of Arduino UNO.
- IN2: Connected to D3 pin of Arduino UNO.
- IN3: Connected to D6 pin of Arduino UNO.
- IN4: Connected to D7 pin of Arduino UNO.
- ENB: Connected to D10 pin of Arduino UNO.
12V 5Ah Battery
- 12v +: Connected to 12V pin of L298N DC motor driver and 5V pin of Arduino UNO.
- 12v -: Connected to GND pin of L298N DC motor driver and GND pin of Arduino UNO.
Gear Motor with Integrated Encoder (Motor 1)
- MOTOR+: Connected to OUT4 pin of L298N DC motor driver.
- MOTOR -: Connected to OUT3 pin of L298N DC motor driver.
- Encoder +: Connected to 5V pin of Arduino UNO.
- Encoder -: Connected to GND pin of Arduino UNO.
- Encoder A: Connected to D8 pin of Arduino UNO.
- Encoder B: Connected to D11 pin of Arduino UNO.
Gear Motor with Integrated Encoder (Motor 2)
- MOTOR+: Connected to OUT1 pin of L298N DC motor driver.
- MOTOR -: Connected to OUT2 pin of L298N DC motor driver.
- Encoder +: Connected to 5V pin of Arduino UNO.
- Encoder -: Connected to GND pin of Arduino UNO.
- Encoder A: Connected to D4 pin of Arduino UNO.
- Encoder B: Connected to D5 pin of Arduino UNO.
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:
}
Additional Documentation (documentation.txt)