Robotics Training LESSON 17: Measuring Distance to Obstacle using the HC-SR04


In this video lesson we show how to use the HC-SR04 ultrasonic sensor to detect the distance to obstacles in a robotic application. We use the sensor to measure the time it takes for a ping to travel from the sensor, to the target, and then back. We use this measured time, and the known speed of sound to calculate the distance to the target. This will be used in future lessons to keep the robot from running into an obstacle.