Hello. In this lesson we measure the distance by connecting the ultrasonic distance sensor HC-SR04 to our Raspberry Pi.
What is the ultrasonic distance sensor HC-SR04?
The ultrasonic distance sensor HC-SR04 is a very popular sensor that is involved in almost all robot projects. It is often preferred for its ease of use and low cost.
Operating principle of ultrasonic sensors:
The operating principle of the sensor is simple: When a signal is output from the TRIG pin, the sensor generates a sound wave at 40 kHz, and when this sound wave hits an object and returns, the ECHO pin becomes active. Since we know the speed of sound propagation in the air (343.2 m / s at sea level and at 21° C), we can easily calculate the distance between the EIGO pin according to the signal supplied to the TRIG pin until the ECHO pin is active.
Raspberry Pi – HC-SR04 Ultrasonic distance sensor circuit: