Starter Guide
www.adeept.com
- 111 -
Lesson 31 Ultrasonic module
Introduction
In this lesson, let’s learn about the ultrasonic module.
Ultrasonic module
Trig
sending end
Echo
receiving end
VCC
3.3V
GND
GND
This recipe uses the popular Parallax PING ultrasonic distance sensor to
measure the distance of an object ranging from 2 cm to around 3 m.
Ultrasonic sensors provide a measurement of the time it takes for sound to
bounce off an object and return to the sensor. The “ping” sound pulse is
generated when the pingPin level goes HIGH for two micro-seconds. The
sensor will then generate a pulse that terminates when the sound returns.
The width of the pulse is proportional to the distance the sound traveled and
the sketch then uses the pulseIn function to measure that duration. The
speed of sound is 340 meters per second, which is 29 microseconds per
centimeter. The formula for the distance of the round trip is: RoundTrip =
microseconds / 29.
So, the formula for the one-way distance in centimeters is: microseconds /
29 / 2