Programming instructions
ultrasonic sensor kit • 2
Inventor’s Guide insert
accessories
sensor accessories
accessories
ultrasonic sensor kit, continued
1 Technical overview
The ultrasonic sensor determines the distance to a reflective surface by
emitting high-frequency sound waves and measuring the time it takes for
the echo to be picked up by the detector.
The ultrasonic sensor actually consists of two parts: an emitter, which
produces a 40kHz sound wave; and a detector, which detects 40kHz
sound waves and sends an electrical signal back to the microcontroller.
In order to determine the distance to an object, it is necessary to
implement a timing loop in your microcontroller code to measure the
length of time required for the sound wave generated by the emitter to
traverse the distance to the object.
The distance to the object can then be calculated with the following
formulas:
Distance to object = ½ (speed of sound) X (round trip delay)
[Note: speed of sound varies with altitude and temperature. At sea level and room
temperature, it’s approximately 344.2 m/s or 1135 ft/s. It will increase with
temperature and decrease with altitude.]
Therefore
Distance in feet = 567.5 ft/s X (round trip delay)
or
Distance in meters = 172.1 m/s X (round trip delay)
Emit sound wave
Detect sound wave
The number of seconds
for the sound wave to be
detected = round trip delay
The ultrasonic sensor
can determine the
distance to an object
between 3cm
and 3m away; closer
than 3cm will result
in the sound waves
echoing back to the
sensor before the
detector is ready to
receive.
Go to Reference Links