Circuit Documentation
Summary of the Circuit
This circuit is designed to interface an Arduino UNO with an HC-SR04 Ultrasonic Sensor and a Servomotor SG90. The Arduino UNO acts as the central processing unit, controlling the sensor and the servomotor. The HC-SR04 is used to measure distance via ultrasonic waves, and the SG90 servomotor is used to actuate a mechanism based on the sensor's readings. The circuit is powered by a 9V battery connected to the Arduino, which also distributes power to the other components.
Component List
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Purpose: Acts as the central controller for the circuit, interfacing with the sensor and servomotor.
HC-SR04 Ultrasonic Sensor
- Description: An ultrasonic distance sensor capable of measuring distances from 2cm to 400cm.
- Purpose: Provides distance measurements to the Arduino.
Servomotor SG90
- Description: A small and lightweight servo motor capable of precise angular positioning.
- Purpose: Actuates a mechanism in response to commands from the Arduino.
9V Battery
- Description: A standard 9V battery.
- Purpose: Provides power to the Arduino and, indirectly, to the other components in the circuit.
Wiring Details
Arduino UNO
- 5V pin is connected to:
- VCC pin of the HC-SR04 Ultrasonic Sensor
- VCC pin of the Servomotor SG90
- GND pin is connected to:
- GND pin of the Servomotor SG90
- GND pin of the HC-SR04 Ultrasonic Sensor
- "-" pin of the 9V battery
- Vin pin is connected to:
- "+" pin of the 9V battery
- D7 pin is connected to:
- SIG pin of the Servomotor SG90
- D6 pin is connected to:
- ECHO pin of the HC-SR04 Ultrasonic Sensor
- D5 pin is connected to:
- TRIG pin of the HC-SR04 Ultrasonic Sensor
HC-SR04 Ultrasonic Sensor
- VCC pin is connected to the 5V pin of the Arduino UNO.
- TRIG pin is connected to the D5 pin of the Arduino UNO.
- ECHO pin is connected to the D6 pin of the Arduino UNO.
- GND pin is connected to the GND pin of the Arduino UNO.
Servomotor SG90
- SIG pin is connected to the D7 pin of the Arduino UNO.
- VCC pin is connected to the 5V pin of the Arduino UNO.
- GND pin is connected to the GND pin of the Arduino UNO.
9V Battery
- + pin is connected to the Vin pin of the Arduino UNO.
- - pin is connected to the GND pin of 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 code to control the HC-SR04 Ultrasonic Sensor or the Servomotor SG90. The user is expected to implement the setup and loop functions to initialize the sensor and motor and to define the interaction between them based on the sensor's readings.
