How to use Ultrasonic sensor  (HC-SR04) using Arduino Uno to detect any nearby object

Ultrasonic sensor(HC-SR04)

What is Ultrsonic sensor

This sensor is used to identify the presence of near by object without making physical connection.

Range

HC-SR04 is widely used for distance measurement and object identification. It has a typical working range from 2 cm to 400 cm (1 inch to 13 feet)

Formula

Distance =(0.034*travel time)/2

Distance between sensor and object can be calculated using given formula:

How to use ultrasonic sensor using  Arduino UNO

Required Components:

Ultrasonic sensor (HC-SR04)

Arduino Uno board

Few jumper wires

1.

2.

3.

Connection Diagram

Get the code in Github

Ultrasonic sensor has 4 oins: 1. VCC 2. GND 3. TRIG 4. ECHO

Output

Check out the output Video to understand the working of the ultrasound sensor using Arduino Uno