Sensor sends an ultrasound pulse and listens for the echo. It returns the distance to a target by how long the echo took to return.
Sonar uses sound to detect objects. It can be used to measure distance to an object.
The distance from the sensor to the object can be calculated by measuring the time sound takes to return to the sensor after a pulse.
A HC-SR04-compatible sensor module has a speaker and microphone; one sends an ultrasonic pulse of sound, the other receives it. By measuring the difference between the pulse and echo, the distance to the object can be calculated.
There are four pins:
Searching Amazon or eBay for
HC-SR04 will reveal many examples of these sensors. They’re around £1 each.
Hook up the sensor as follows:
|HC-SR04 Sensor||Microbit Pin|
Published: December 23, 2016 Updated: December 23, 2016
Acknowledgements: Teaser image by Sparkfun (CC-BY). Sonar diagram by Georg Wiora CC-BY-SA-2.5