Skip to content

Latest commit

 

History

History
14 lines (8 loc) · 821 Bytes

hc-sr04README.md

File metadata and controls

14 lines (8 loc) · 821 Bytes

Demo: Reading a Distance Sensor (Variable Pulse Width Sensor)

You want to use a HC-SR04 Ultrasonic Range Sensor with BeagleBone Black.

The HC-SR04 Ultrasonic Range Sensor (shown in below) works by sending a trigger pulse to the Trigger input and then measuring the pulse width on the Echo output. The width of the pulse tells you the distance.

alt text

Wire the sensor as shown below. Note that the HC-SR04 is a 5 V device, so the banded wire (running from P9_7 on the Bone to VCC on the range finder) attaches the HC-SR04 to the Bone's 5 V power supply.

alt text

This code is more complex than others, because we have to tell the device when to start measuring and time the return pulse.