Basically HC-SR04 is a sonar technology based sensor which is used to calculate and determine the distance between object and sensor. If presents non contact detection functionality with stable reading. With high accuracy it has become a popular sensor. It is a combination of a ultrasonic transmitter and a receiver components modules. Two sensors one of them is transmitter sends ultrasonic wave to the coming object or wall anything, the wave travels in the air freely when it collided with any object in the coming in its way then wave goes back to the receiver end of the sensor. It is a common sensor used with any microcontroller like 8051, PIC Arduino, ARM.
It is a four pin module named Vcc, Echo, Trigger and Ground pin. This one of the most popular sensor for distance measuring and used most of the applications around the world. The sensor has two eyes types of sensors used as a transmitter and receiver. Following formula is applied while measuring distance.
Distance = Speed × Time
Specifications and Features
Specification and features of HC-SR04 sensor given below, you can download datasheet and read extensively. It works on 5V DC power supply as supply voltage and ground pin for negative.

Effectual Angle: <15°
Ranging Distance : 2cm – 400 cm/1″ – 13ft
Resolution : 0.3 cm
Measuring Angle: 30 degree
Trigger Input Pulse width: 10uS
Dimension: 45mm x 20mm x 15mm