Arduino UNO with HC-SR04 Ultrasonic Sensor Distance Measurement
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary of the Circuit
This circuit consists of an Arduino UNO microcontroller board interfaced with an HC-SR04 Ultrasonic Sensor. The Arduino UNO is responsible for controlling the sensor and processing the distance measurements. The HC-SR04 sensor is used to measure distances by emitting ultrasonic waves and measuring the time it takes for the echo to return. The circuit is powered by the 5V output from the Arduino UNO, and the sensor's trigger and echo signals are connected to digital pins on the Arduino for control and data acquisition.
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 controlling the HC-SR04 Ultrasonic Sensor and processing the distance measurements.
HC-SR04 Ultrasonic Sensor
- Description: An ultrasonic distance sensor capable of measuring distances from 2cm to 400cm.
- Pins: VCC, TRIG, ECHO, GND.
- Purpose: To measure the distance to an object by emitting ultrasonic pulses and detecting the reflected signals.
Wiring Details
Arduino UNO
- 5V connected to HC-SR04 VCC.
- GND connected to HC-SR04 GND.
- D11 connected to HC-SR04 TRIG.
- D10 connected to HC-SR04 ECHO.
HC-SR04 Ultrasonic Sensor
- VCC connected to Arduino UNO 5V.
- GND connected to Arduino UNO GND.
- TRIG connected to Arduino UNO D11.
- ECHO connected to Arduino UNO D10.
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 include the logic for controlling the HC-SR04 Ultrasonic Sensor. The user is expected to fill in the setup and loop functions with the appropriate code to initialize the sensor and to read distance measurements in the loop function.