Circuit Documentation
Summary
This circuit integrates an Arduino UNO microcontroller with an L298N DC motor driver to control two hobby motors. Additionally, an HC-SR04 Ultrasonic Sensor is included, likely for distance measurement or obstacle detection. The Arduino UNO is responsible for providing control signals to the L298N driver, which in turn drives the motors. The HC-SR04 sensor is interfaced with the Arduino for input. Power distribution is managed through the 5V and GND connections from the Arduino to both the motor driver and the ultrasonic sensor.
Component List
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Purpose: Acts as the central controller for the circuit, providing logic and control signals.
L298N DC Motor Driver
- Description: A module capable of driving two DC motors with up to 2A per channel.
- Purpose: Used to control the speed and direction of the motors.
Motor Amarillo Motorreductor Hobby (x2)
- Description: A yellow hobby gear motor.
- Purpose: Acts as the actuator in the circuit, driven by the motor driver.
HC-SR04 Ultrasonic Sensor
- Description: An ultrasonic distance sensor capable of measuring distances from 2cm to 400cm.
- Purpose: Provides distance measurements to the Arduino for processing.
Wiring Details
Arduino UNO
- 5V: Powers the L298N motor driver and the HC-SR04 ultrasonic sensor.
- GND: Common ground for the circuit.
- Vin: Connected to the 12V input of the L298N motor driver.
- D11: Sends control signal to IN1 on the L298N motor driver.
- D10: Sends control signal to IN2 on the L298N motor driver.
- D9: Sends control signal to IN3 on the L298N motor driver.
- D8: Sends control signal to IN4 on the L298N motor driver.
- D3: Receives the ECHO signal from the HC-SR04 ultrasonic sensor.
- D2: Sends the TRIG signal to the HC-SR04 ultrasonic sensor.
L298N DC Motor Driver
- 5V: Receives power from the Arduino UNO.
- GND: Connected to the common ground.
- 12V: Receives power from the Vin pin of the Arduino UNO.
- IN1, IN2, IN3, IN4: Receive control signals from the Arduino UNO to control the motors.
- OUT1, OUT2: Connected to one of the hobby motors.
- OUT3, OUT4: Connected to the other hobby motor.
Motor Amarillo Motorreductor Hobby
- vcc: Connected to OUT1 and OUT3 of the L298N motor driver for each motor respectively.
- GND: Connected to OUT2 and OUT4 of the L298N motor driver for each motor respectively.
HC-SR04 Ultrasonic Sensor
- VCC: Powered by the 5V output from the Arduino UNO.
- GND: Connected to the common ground.
- ECHO: Sends the echo signal to D3 on the Arduino UNO.
- TRIG: Receives the trigger signal from D2 on the 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:
}
Note: The provided code is a template and does not contain any functional logic. It needs to be populated with the appropriate setup and loop code to control the L298N motor driver and read data from the HC-SR04 ultrasonic sensor.
