By using Ultrasonic sensor and buzzer make your own security system which alerts with sound according to distance set in your code. We can also add other components for switching Electrical devices.
Components used for ultrasonic sensor buzzer
- Arduino uno Board
- Ultrasonic Sensor
- 220 ohm Resistor
- Jump Wires
In this Arduino Tutorial we will learn how the HC-SR04 Ultrasonic Sensor works and how to use it with Buzzer and LED.
The HC-SR04 Ultrasonic Module has 4 pins, Ground, VCC, Trig and Echo.
This is a simple alarm system made with help of buzzer, LED and an Ultrasonic sensor . One can stop the buzzer by pressing the button.
Min Required – 30 min
Lines of code
- Take a Breadboard.
- Connect the +5V and GND of Arduino UNO to the breadboard.
- For LED: Connect the cathode (Shorter pin of LED) to ground and the Anode (longer pin of LED) with a 330 or 220 ohm resistor. Connect the second pin of resistor with pin 6 of the Arduino as shows in schematics.
- For Buzzer: Connect the Positive terminal with pin 8 of Arduino and negative terminal to GND.
- For Ultrasonic Sensor: Connect the VCC and GND . Connect the Trigger pin to pin 12 and Echo pin to pin 13 of Arduino.