Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino UNO Based Ultrasonic Distance Detector with Piezo Buzzer Alert

Image of Arduino UNO Based Ultrasonic Distance Detector with Piezo Buzzer Alert

Circuit Documentation

Summary of the Circuit

This circuit integrates an Arduino UNO microcontroller with an HC-SR04 Ultrasonic Sensor and a Piezo Buzzer. The Arduino UNO is used as the central processing unit to control the ultrasonic sensor for distance measurement and to drive the piezo buzzer based on the sensor's readings. The ultrasonic sensor is powered by the Arduino and sends distance information back to it, while the piezo buzzer is activated by the Arduino to provide an audible alert.

Component List

Arduino UNO

  • Description: A microcontroller board based on the ATmega328P.
  • Purpose: Acts as the central controller for the circuit, interfacing with the ultrasonic sensor and controlling the piezo buzzer.
  • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0-A5, SCL, SDA, AREF, D0-D13.

HC-SR04 Ultrasonic Sensor

  • Description: An ultrasonic distance sensor capable of measuring distances from 2cm to 400cm.
  • Purpose: Measures the distance to an object and sends this information to the Arduino UNO.
  • Pins: VCC, TRIG, ECHO, GND.

Piezo Buzzer

  • Description: An electronic device that emits a tone when voltage is applied.
  • Purpose: Provides an audible alert when triggered by the Arduino UNO.
  • Pins: pin 1, pin 2.

Wiring Details

Arduino UNO

  • 5V connected to HC-SR04 VCC and Piezo Buzzer pin 1.
  • GND connected to HC-SR04 GND.
  • D13 connected to HC-SR04 ECHO.
  • D12 connected to HC-SR04 TRIG.
  • D8 connected to Piezo Buzzer pin 2.

HC-SR04 Ultrasonic Sensor

  • VCC connected to Arduino UNO 5V.
  • TRIG connected to Arduino UNO D12.
  • ECHO connected to Arduino UNO D13.
  • GND connected to Arduino UNO GND.

Piezo Buzzer

  • pin 1 connected to Arduino UNO 5V.
  • pin 2 connected to Arduino UNO D8.

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 for initialization code that runs once when the Arduino is powered on or reset. The loop() function contains the main logic of the program, which runs repeatedly as long as the Arduino is powered.

For this circuit, the setup() function would typically be used to initialize the pins connected to the HC-SR04 sensor's TRIG and ECHO pins as output and input, respectively. The loop() function would handle triggering the ultrasonic sensor, reading the distance, and then using that information to determine whether to activate the piezo buzzer.

Note: The actual implementation code for the Arduino UNO to interact with the HC-SR04 Ultrasonic Sensor and the Piezo Buzzer is not provided in the input and would need to be developed based on the specific requirements of the circuit's application.