Working With Ultrasonic Sensor


In this article, we are going to learn how to work with ultrasonic Sensor in Arduino Compatible Transducer device which emits and receive Ultrasonic waves. Ultrasonic sensor acts as an artificial hearing apparatus for gadgets. Ultrasonic sensor has 4 pins, the first pin and second pins are power supply pins and the third pin acts as a trigger and the fourth pin acts as an echo pin to send and receive ultrasonic waves.
  1. Arduino(UNO)
  2. Ultrasonic Sensor
  3. Buzzer
  1. The circuit connections are made as per the Circuit Diagram.
  2. Upload the codings and place the ultrasonic sensor as per your requirements.
  3. When any object passes in the range or path ( in our case we are considering 90cm.), the buzzer will get ON.
  4. We can change the Range of the ultrasonic sensor as per the buzzer requirements.
  5. This can be modified with the use of the Relay Module to use in our home and Office.
Steps to follow,
Step 1
Open the Arduino IDE software.
Step 2
Declare the Pins used in the Arduino UNO Board in the void setup, and also declare the initialization of Serial Monitor of Arduino UNO.
Code the looping conditions in the void loop of Arduino.
Step 4
Make connections as per the circuit diagram.
Step 5
Upload the coding.
Step 6
Open Serial Monitor and Check the working.
Step 7
Check the working of the project by placing your hand or any objects.


In this article, we learned how to work with an ultrasonic sensor and buzzer, by creating a simple alarm project using ATMega328 microcontroller development kit (that is Arduino UNO). This alarm can be further developed to produce accurate results, which can be done by adding a PIR sensor to it which we will learn about in upcoming articles.