HC-SR04 UltraSonic Sensor
HC-SR04 ultrasonic module can offer non-contact distance sensing function, the range of which is 2cm—400cm., and the range accuracy is up to 2mm; the module includes ultrasonic transmitter, receiver and control circuit.
The basic operation principle is below:
(1)use IO port TRIG to trigger ranging. It needs 10 us high level signal at least
(2)Module can send 8 pro 40 kz square wave automatically, and will test if there is any signal returned.
(3)If there is signal returned, output one high level signal via IO port ECHO. The duration of the high level signal is the time from transmitter to receiving with the ultrasonic.
Testing distance =duration of high level*voice velocity(340m/s) / 2
Refer to the wiring diagram below,
VCC supply 5V, and GND is ground wire. TRIG is trigger control signal input, ECHO is echo signal output.