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. The document includes a list of components, wiring details, and the embedded code used in the microcontroller.
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
- TRIG: Connected to Arduino UNO D8
- ECHO: Connected to Arduino UNO D7
- GND: Connected to Arduino UNO GND
Arduino UNO
- 5V: Connected to HC-SR04 Ultrasonic Sensor VCC
- D8: Connected to HC-SR04 Ultrasonic Sensor TRIG
- D7: Connected to HC-SR04 Ultrasonic Sensor ECHO
- GND: Connected to HC-SR04 Ultrasonic Sensor GND
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 runs continuously after the setup is complete. In this template, no specific functionality is implemented yet.