Circuit Documentation
Summary of the Circuit
This circuit is designed to control two DC motors using an L298N DC motor driver, which is interfaced with an Arduino Nano microcontroller. The Arduino Nano also interfaces with an HC-SR04 Ultrasonic Distance Sensor to potentially provide input for motor control, although the specific logic for this is not detailed in the provided code. The circuit is powered by a 9V battery, which supplies power to both the motor driver and the Arduino Nano. The ground connections are shared across all components to complete the circuit.
Component List
L298N DC Motor Driver
- Description: A motor driver module capable of driving 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.
DC Motor (x2)
- Description: Standard DC motors for converting electrical energy into mechanical motion.
- Pins: pin 1, pin 2.
Battery 9V
- Description: A 9V battery providing the power source for the circuit.
- Pins: VCC, GND.
HC-SR04 Ultrasonic Distance Sensor (Wokwi Compatible)
- Description: A sensor for measuring distance via ultrasonic sound waves.
- Pins: VCC, TRIG, ECHO, GND.
Arduino Nano
- Description: A small, complete, and breadboard-friendly microcontroller board based on the ATmega328P.
- Pins: D1/TX, D0/RX, RESET, GND, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11/MOSI, D12/MISO, VIN, 5V, A7, A6, A5, A4, A3, A2, A1, A0, AREF, 3V3, D13/SCK.
Wiring Details
L298N DC Motor Driver
- OUT1 connected to DC Motor 2 pin 2
- OUT2 connected to DC Motor 2 pin 1
- 12V connected to Battery 9V VCC and Arduino Nano VIN
- GND connected to Battery 9V GND, Arduino Nano GND, and HC-SR04 GND
- OUT3 connected to DC Motor 1 pin 2
- OUT4 connected to DC Motor 1 pin 1
- IN1 connected to Arduino Nano D7
- IN2 connected to Arduino Nano D6
- IN3 connected to Arduino Nano D5
- IN4 connected to Arduino Nano D4
DC Motor 1
- pin 1 connected to L298N DC motor driver OUT4
- pin 2 connected to L298N DC motor driver OUT3
DC Motor 2
- pin 1 connected to L298N DC motor driver OUT2
- pin 2 connected to L298N DC motor driver OUT1
Battery 9V
- VCC connected to L298N DC motor driver 12V
- GND connected to L298N DC motor driver GND
HC-SR04 Ultrasonic Distance Sensor
- VCC connected to Arduino Nano 5V
- TRIG connected to Arduino Nano D10
- ECHO connected to Arduino Nano D9
- GND connected to L298N DC motor driver GND
Arduino Nano
- VIN connected to Battery 9V VCC and L298N DC motor driver 12V
- GND connected to Battery 9V GND, L298N DC motor driver GND, and HC-SR04 GND
- D7 connected to L298N DC motor driver IN1
- D6 connected to L298N DC motor driver IN2
- D5 connected to L298N DC motor driver IN3
- D4 connected to L298N DC motor driver IN4
- 5V connected to HC-SR04 VCC
- D10 connected to HC-SR04 TRIG
- D9 connected to HC-SR04 ECHO
Documented Code
Arduino Nano Code (sketch.ino)
void setup() {
}
void loop() {
}
Note: The provided code is a template and does not contain any functional logic for controlling the motors or reading from the ultrasonic sensor. Additional code is required to implement the desired functionality.