Arduino UNO and HC-SR04 Ultrasonic Sensor Distance Measurement System
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This document provides a detailed overview of a circuit that integrates an HC-SR04 Ultrasonic Sensor with an Arduino UNO microcontroller. The circuit is designed to measure distance using ultrasonic waves and process the data using the Arduino UNO.
Component List
HC-SR04 Ultrasonic Sensor
- Description: The HC-SR04 is an ultrasonic sensor used for distance measurement. It emits an ultrasonic wave and measures the time it takes for the echo to return, allowing it to calculate the distance to an object.
- Pins: VCC, TRIG, ECHO, GND
Arduino UNO
- Description: The Arduino UNO is a microcontroller board based on the ATmega328P. It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
Wiring Details
HC-SR04 Ultrasonic Sensor
- VCC: Connected to Arduino UNO 5V
- GND: Connected to Arduino UNO GND
- TRIG: Connected to Arduino UNO D9
- ECHO: Connected to Arduino UNO D10
Arduino UNO
- 5V: Connected to HC-SR04 Ultrasonic Sensor VCC
- GND: Connected to HC-SR04 Ultrasonic Sensor GND
- D9: Connected to HC-SR04 Ultrasonic Sensor TRIG
- D10: Connected to HC-SR04 Ultrasonic Sensor ECHO
Code Documentation
Arduino UNO Code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
This code is a basic template for the Arduino UNO. The setup() function is where you initialize settings, and the loop() function is where the main code runs repeatedly. You can add the necessary code to control the HC-SR04 Ultrasonic Sensor and process the distance measurements within these functions.