Introduction:
The HC-SR04 sensor has become very popular among users of Arduino, because its easy implementation, is one of the most used modules in robotics. The HC-SR04 sensor is an ultrasonic sensor that detects obstacles in front of him, from a minimum distance of 2cm to 4m, operating at a frequency of 40Khz, has a measuring angle of about 15 degrees. It has an entry called TRIG this is the entrance for a 5V TTL pulse with a period of 10uS, which indicate to the module that should start sending a signal burst of 40Khz, and activates the reception of pulses to detect crash the burst with their environment.
The sensor sends a burst of ultrasound which detected the rebound, depending on the time delay in the signal return is possible to determine how far the obstacle is, logically this distance must not exceed the maximum distance of detection sensor.
Below is a picture of the pulses that should get the module for activation and sends pulses once received the order of detection:
Note that the width of the pulse generated on pin Echo, depends on the distance that lies toured the blast of sound that was sent, so once the burst is sent echo pin put its output to 5V and lasts well until it detects that the blast was remanded and then echo back its output pin to a state of 0v.