Circuit Documentation
Summary of the Circuit
This circuit consists of an Arduino UNO microcontroller board interfaced with an HC-SR04 Ultrasonic Distance Sensor. The Arduino UNO is responsible for controlling the sensor and processing the distance measurements. The HC-SR04 sensor is powered by the 5V output from the Arduino and uses two digital pins for triggering and receiving the ultrasonic pulses to measure 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 processing unit for the circuit, controlling the HC-SR04 sensor and processing the distance data.
HC-SR04 Ultrasonic Distance Sensor (Wokwi Compatible)
- Description: An ultrasonic distance measuring module compatible with Arduino.
- Pins: VCC, TRIG, ECHO, GND.
- Purpose: Measures distances by emitting ultrasonic waves and detecting the reflection back from objects.
Wiring Details
Arduino UNO
- 5V connected to HC-SR04 VCC.
- GND connected to HC-SR04 GND.
- D13 connected to HC-SR04 ECHO.
- D10 connected to HC-SR04 TRIG.
HC-SR04 Ultrasonic Distance Sensor
- VCC connected to Arduino UNO 5V.
- GND connected to Arduino UNO GND.
- ECHO connected to Arduino UNO D13.
- TRIG connected to Arduino UNO D10.
Documented Code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
The provided code is a template for the Arduino UNO microcontroller. The setup() function is intended to contain initialization code that runs once when the microcontroller is powered on or reset. The loop() function is designed to contain the main logic of the program, which will run repeatedly in an infinite loop.
To fully utilize the HC-SR04 sensor, the code needs to be completed with the initialization of the TRIG and ECHO pins as outputs and inputs, respectively, and the implementation of the logic to trigger the ultrasonic pulse and read the distance from the ECHO pin.
