Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

Distance Sensor GPIO cont’d – Raspberry Pi and Python tutorials p.7

131.6K views on YouTube

In this Raspberry Pi tutorial, we’re going to introduce a new sensor, the HC-SR04 ultrasonic distance sensor, along with handling GPIO input.

The HC-SR04 distance sensor measures distance based on emitting a sound burst, and timing how long it takes to receive the echo back. Using the known constant that is the speed of sound, we can mathmematically determine the distance of any object in front of this sensor by simply measuring how much time passed while the sound waves were emitted, hit the object in front of the sensor, bounced back, and came back to the sensor.

Text-based version of this series: https://pythonprogramming.net/introduction-raspberry-pi-tutorials/

https://www.facebook.com/pythonprogramming.net/
https://plus.google.com/+sentdex