Raspberry Pi LESSON 22: Measuring Distance with the HC-SR04 Ultrasonic Sensor

In this lesson I will show how to do echolocation on the Raspberry Pi with the HC-SR04 Ultrasonic Sensor, from your Sunfounder Raphael kit. We show step-by-step instructions, and show how to code up the unit. We then show to to initiate a ping from the sensor, and how to detect its return, and measure the time of flight of the ping. I then show you how you can use the Ping Travel Time to calculate the distance between the sensor and a target. Enjoy!

Related Posts