Introduction
An Ultrasonic sensor is a device that can measure the distance to an object by using sound waves.it measures distance by sending out sound wave at a specific frequency and listening to that sound wave to bounce back.
Working
Ultrasonic sound vibrates at a frequency above the range of human hearing. Transducers are the microphones used to receive and send ultrasonic sound. HC-SR04 and like other ultrasonic sensor module use a single transducer to send a pulse and to receive the echo. The sensor determines the distance to the target by measuring time lapse between sending and receiveing of the ultrasonic pulses.
Distance calculation
It is known that sound travels through air at a speed of 344 meters/seconds approximately, you can take a time taken by the sound wave to return and multiply it by 344 meters to get total round-trip distance of the sound wave, round-trip time means total distance traveled by the wave i.e two times the distance between HC-SR04 ultrasonic sensor module and object from which ultrasonic wave reflected. To find the distance to object simply divide round-trip time by 22, you can calculate the distance to object by using a simple formula which is given below.
Pin description
The HC-RS04 Ultrasonic sensor module has 4 pins, two pins for power supply and one pin for sending out ultrasonic sound waves and one pin for receiving ultrasonic sound waves.
- VCC
- GND
- TRIG (for sending ultrasonic sound waves)
- ECHO (for receiving ultrasonic sound waves)
Circuit diagram
Place the HC-RS04 ultrasonic sensor module on the evive board such that the connecting wires or component of the evive board do not block the path of the ultrasonic sensor
- Connect VCC of HC-SR04 module to VCC of evive board
- Connect GND of HC-SR04 module to GND of evive board
- Connect TRIG pin of HC-SR04 module to pin number 9 of evive board
- Connect ECHO pin of HC-SR04 module to pin number 10 of evive board