Arduino UNO with HC-SR04 Ultrasonic Sensor and Buzzer Alert System
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary of the Circuit
This circuit consists of an Arduino UNO microcontroller, an HC-SR04 Ultrasonic Distance Sensor, and a Buzzer. The Arduino UNO is used as the central processing unit to control the operation of the ultrasonic sensor and the buzzer. The HC-SR04 sensor is used to measure distances by emitting ultrasonic waves and receiving the reflected signal. The Buzzer is used as an output device to provide an audible alert based on the distance measured by the sensor.
Component List
HC-SR04 Ultrasonic Distance Sensor (Wokwi Compatible)
- Pins: VCC, TRIG, ECHO, GND
- Description: This sensor is used to measure distances by emitting and receiving ultrasonic waves.
Arduino UNO
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0-A5, SCL, SDA, AREF, D0-D13
- Description: A microcontroller board based on the ATmega328P, used as the main controller for the circuit.
Buzzer
- Pins: POSITIVE, NEGATIVE
- Description: An audible signaling device that emits a tone when powered.
Wiring Details
HC-SR04 Ultrasonic Distance Sensor
- VCC: Connected to the 5V pin on the Arduino UNO.
- TRIG: Connected to digital pin D9 on the Arduino UNO.
- ECHO: Connected to digital pin D10 on the Arduino UNO.
- GND: Connected to a GND pin on the Arduino UNO.
Arduino UNO
- 5V: Provides power to the HC-SR04 sensor.
- D9: Sends trigger signal to the HC-SR04 sensor.
- D10: Receives echo signal from the HC-SR04 sensor.
- GND: Common ground for the circuit.
- D8: Connected to the positive pin of the Buzzer.
Buzzer
- POSITIVE: Connected to digital pin D8 on the Arduino UNO.
- NEGATIVE: Connected to a GND pin on the Arduino UNO.
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 with empty setup() and loop() functions. The setup() function is intended to contain initialization code that runs once when the microcontroller is powered on or reset. The loop() function is meant to contain the main logic of the program, which runs repeatedly as long as the microcontroller is powered.
To complete this circuit's functionality, the code needs to be written to initialize the HC-SR04 sensor and the buzzer in the setup() function, and to implement the logic for measuring distance and triggering the buzzer based on the distance in the loop() function.