Education, Electronics

Ultrasonic sensor

1 min read

The ultrasonic sensor works on the same principles as a radar system. An ultrasonic sensor can convert electrical energy into acoustic waves and vice versa. The acoustic signal is an ultrasonic wave moving at a frequency above 18kHz. The famous HC SR04 ultrasonic sensor generates ultrasonic waves at a frequency of 40kHz.

In general, a microcontroller is used to communicate with an ultrasonic sensor. To start measuring the distance, the microcontroller sends a trigger signal to the ultrasonic sensor. The duty cycle of this trigger signal is 10µS for the HC-SR04 ultrasonic sensor. When triggered, the ultrasonic sensor generates eight bursts of acoustic waves (ultrasonic) and triggers a time counter. As soon as the reflected signal (echo) is received, the counter stops. The output of the ultrasonic sensor is a high pulse of the same duration as the time difference between the transmitted ultrasonic bursts and the received echo signal.

Representation of trigger signal, acoustic bursts, reflected signal and output of echo pin
Representation of trigger signal, acoustic bursts, reflected signal and output of echo pin

The microcontroller interprets the time signal into distance using the following functions:

Theoretically, the distance can be calculated using the TRD (time/rate/distance) measurement formula. Since the calculated distance is the distance travelled between the ultrasonic transducer and the object – and vice versa – it is a two-way trip. By dividing this distance by 2, you can determine the actual distance between the transducer and the object. Ultrasonic waves travel at the speed of sound (343 m/s at 20°C).

The distance between the object and the transducer is equal to half the distance travelled by the sound wave.

The following equation can be used to calculate the distance of an object placed in front of an ultrasonic sensor:
distance=(travel time*speed of sound)/2


Leave a Reply

Your email address will not be published. Required fields are marked *

Sign up for our Newsletter

Join our newsletter and get resources, curated content, and design inspiration delivered straight to your inbox.

error: Content is protected!!