Chapter 24 Ultrasonic Ranging
Component Knowledge
Ultrasonic ranging module use the principle that ultrasonic will reflect when it encounters obstacles. Start
counting the time when ultrasonic is transmitted. And when ultrasonic encounters an obstacle, it will reflect
back. The counting will end after ultrasonic is received, and the time difference is the total time of ultrasonic
from transmitting to receiving. Because the speed of sound in air is constant, and is about v=340m/s. So we
can calculate the distance between the model and the obstacle: s=vt/2.
Ultrasonic module integrates a transmitter and a receiver. The transmitter is used to convert electrical signals
(electrical energy) into sound waves (mechanical energy) and the function of the receiver is opposite. The
object picture and the diagram of HC SR04 ultrasonic module are shown below:
Technical specs:
Working voltage: 5V Working current: 12mA
Minimum measured distance: 2cm Maximum measured distance: 200cm
Instructions for use: output a high-level pulse in Trig pin lasting for least 10uS. Then the module begins to
transmit ultrasonic. At the same time, the Echo pin will be pulled up. When the module receives the returned
ultrasonic, the Echo pin will be pulled down. The duration of high level in Echo pin is the total time of the
ultrasonic from transmitting to receiving, s=vt/2.