Measuring Distances with an Ultrasonic Sensor

Measuring distances automatically and continuously comes in handy in many situations. Think of a robot that autonomously tries to find its way or of an automatic burglar alarm that rings a bell or calls the police whenever someone is too near your house or the Mona Lisa. All this is possible with Arduino. But before you can create that burglar alarm or robot, you need to understand some key concepts.

Many different types of sensors for measuring distances are available, and the Arduino plays well with most of them. Some sensors use ultrasound, while others use infrared light or even laser. But in principle all sensors work the same way: they emit a signal, wait for the echo to return, and measure ...

Get Arduino: A Quick-Start Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.