Circuit Documentation
Summary
This circuit is designed to control two DC motors and a servomotor using an Arduino UNO microcontroller and an L298N DC motor driver. The Arduino UNO is responsible for generating control signals to the motor driver, which in turn drives the motors. A 9V battery provides power to the system. The servomotor is controlled directly by the Arduino UNO.
Component List
Arduino UNO
- Microcontroller board based on the ATmega328P
- It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button.
L298N DC Motor Driver
- A module that can control up to two DC motors with independent speed and direction control.
- It is equipped with two H-bridge drivers and is capable of driving a current of up to 2A per channel.
DC Motor (x2)
- Standard DC motors for general-purpose use in the circuit.
- Each motor has two connection pins for the motor terminals.
Servomotor SG90
- A small and lightweight servo motor capable of precise control.
- It has three connection pins: signal (SIG), power (VCC), and ground (GND).
Battery 9V
- A standard 9V battery providing the power source for the circuit.
Wiring Details
Arduino UNO
- 5V connected to L298N 5V and Servomotor SG90 VCC
- GND connected to Battery 9V GND, L298N GND, and Servomotor SG90 GND
- Vin connected to Battery 9V VCC
- D2 connected to Servomotor SG90 SIG
- D3 connected to L298N IN1
- D4 connected to L298N IN2
- D5 connected to L298N IN3
- D6 connected to L298N IN4
L298N DC Motor Driver
- 5V connected to Arduino UNO 5V
- GND connected to Arduino UNO GND and Servomotor SG90 GND
- IN1 connected to Arduino UNO D3
- IN2 connected to Arduino UNO D4
- IN3 connected to Arduino UNO D5
- IN4 connected to Arduino UNO D6
- OUT1 connected to DC Motor 1 pin 1
- OUT2 connected to DC Motor 1 pin 2
- OUT3 connected to DC Motor 2 pin 1
- OUT4 connected to DC Motor 2 pin 2
DC Motor 1
- pin 1 connected to L298N OUT1
- pin 2 connected to L298N OUT2
DC Motor 2
- pin 1 connected to L298N OUT3
- pin 2 connected to L298N OUT4
Servomotor SG90
- SIG connected to Arduino UNO D2
- VCC connected to Arduino UNO 5V
- GND connected to Arduino UNO GND
Battery 9V
- VCC connected to Arduino UNO Vin
- GND connected to Arduino UNO GND
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 servomotor. The user is expected to fill in the setup and loop functions with the appropriate control code.
