Reference

The article delves into ultrasonic sensor technology, explaining how sound waves are used for distance measurement, the role of LED lights in visualizing data, and how these sensors can detect obstacles effectively.

Principle

As the speed of ultrasound in air is known, ultrasonic sensors can transmit sound waves toward a target and then calculate its distance by measuring the time between transmitting and receiving the reflected sound signal. During a measurement, the sensor emits ultrasonic waves in a certain direction and starts timing at the same time. The ultrasonic wave returns immediately when it encounters an obstacle on the way during transmission, and the ultrasonic receiver immediately stops timing when it receives the reflected wave. The speed of ultrasonic waves in air at 15°C is 340m/s. According to the time recorded by the timer, the distance between the emitter and the obstacle can be calculated. The LED lights on the sensor can intuitively show the distance changes.

Other Supplementary Information

Usage Description

Obstacle detection: the farther away from the detected object, the smaller the analog value; otherwise, the larger the analog value.
Distance detection: the farther away from the detected object, the larger the analog value; otherwise, the smaller the analog value.

Usage Description

  • Display distance by onboard LED lights

Place the ultrasonic distance sensor toward the object to be measured. When the sensor measures the distance of the object, it will light up the corresponding number of LEDs and output the actual measured distance. The measurement distance of the sensor is 0cm-100cm. And the relationship between the measured distance and the number of lit LED is shown in the figure below:

Relationship between the measured distance and the number of LED to be on

Distance Number of LED
0≤D<10 0
10≤D<20 1
20≤D<40 2
40≤D<60 3
60≤D<80 4
80≤D<100 5
  • Relationship between analog signal output and distance

The distance is proportional to the analog value, that is: the distance value of 0cm-100cm corresponds to the analog value of 0-1023 Distance=AnalogData×(100/1023) (cm).

Was this article helpful?

TOP