Circuit Documentation
Summary of the Circuit
This circuit integrates an Arduino UNO microcontroller with a Servomotor SG90 and an HC-SR04 Ultrasonic Distance Sensor. The Arduino UNO serves as the central processing unit, controlling the servomotor's position and reading distance measurements from the ultrasonic sensor. The servomotor is powered directly from the Arduino's 5V output, and the ultrasonic sensor is interfaced with the Arduino through digital pins for triggering and receiving echo signals. The circuit is designed to perform tasks that require distance sensing and actuation based on the sensed distance.
Component List
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0-A5, SCL, SDA, AREF, D0-D13.
- Purpose: Acts as the central controller for the circuit, interfacing with the sensor and controlling the servomotor.
Servomotor SG90
- Description: A small and lightweight servo for RC (Radio Control) and robotics applications.
- Pins: SIG (Signal), VCC (Power), GND (Ground).
- Purpose: Provides precise control of angular position.
HC-SR04 Ultrasonic Distance Sensor (Wokwi Compatible)
- Description: An ultrasonic ranging module that provides 2cm to 400cm non-contact measurement functionality.
- Pins: VCC (Power), TRIG (Trigger), ECHO (Echo), GND (Ground).
- Purpose: Measures distances by emitting ultrasonic waves and detecting the reflected signal.
Wiring Details
Arduino UNO
- 5V connected to Servomotor SG90 VCC and HC-SR04 VCC.
- GND connected to Servomotor SG90 GND and HC-SR04 GND.
- D10 connected to HC-SR04 ECHO.
- D9 connected to HC-SR04 TRIG.
- D3 connected to Servomotor SG90 SIG.
Servomotor SG90
- VCC connected to Arduino UNO 5V.
- GND connected to Arduino UNO GND.
- SIG connected to Arduino UNO D3.
HC-SR04 Ultrasonic Distance Sensor
- VCC connected to Arduino UNO 5V.
- TRIG connected to Arduino UNO D9.
- ECHO connected to Arduino UNO D10.
- GND connected to Arduino UNO GND.
Documented Code
void setup() {
}
void loop() {
}
File: sketch.ino
The provided code is a template with empty setup()
and loop()
functions, which are the standard structure for Arduino sketches. The setup()
function is intended for code that needs to run once when the microcontroller is reset or powered on, such as pin initialization. The loop()
function contains code that runs continuously as long as the Arduino is powered.
Additional code would be required to initialize the pins connected to the HC-SR04 sensor and the servomotor, as well as to implement the logic for distance measurement and motor control.