1 Working Principle
The ultrasonic range detector operates on a working principle similar to echolocation and can detect the presence of an object while measuring the distance to it without making physical contact. The entire process is based on the piezoelectric effect, with the ultrasonic sensor representing a piezoelectric transducer. This type of device is capable of converting electrical signals into mechanical vibrations and vice versa. The distance measurement is accomplished by generating and emitting ultrasonic pulses, which are then reflected back to the sensor by some object that is within the field of view of the sensor. The effective range in air can vary from a few centimeters to several meters, depending on the sensor and object's characteristics, as well as environmental conditions.
The procedure of ultrasonic range detection is a time-of-flight (ToF) measurement based on the sound’s propagation time through a particular medium, typically air. The transducer can obtain the time delta between the transmitted ultrasonic signal and its corresponding received echo. The acquired time for the round trip is then used to compute the distance between the sensor and the object considering that the speed of sound is known beforehand. It should also be noted that the velocity of sound through air varies with temperature. For example, the speed of sound is 343 m/s in dry air at 20°C (68°F). The following formula is used to calculate the distance:
Within the field of transducer topologies, when considering short-range requirements, two main options exist: monostatic and bistatic configurations. In the monostatic topology, a single transducer serves the dual role of transmitting an impulse and receiving returning echoes. However, the monostatic transducer topology does come with certain limitations, such as the excitation ringing-decay phenomenon, inherent to the sensor. This leads to the creation of a blind zone, effectively imposing a constraint on the minimum detection range. To mitigate this issue, a damping resistor can be incorporated into the monostatic setup, effectively reducing the blind zone. This application note will focus on the bistatic topology as an alternative to eliminate the ringing decay. In this configuration, two separate transducers are utilized, one dedicated to transmission and the other for reception. Figure 1-1 provides an explanatory diagram illustrating this bistatic setup.
An inherent issue associated with ultrasonic transducers is their tendency to continue oscillating (ringing) even after the drive signal is removed. This post-drive ringing is a consequence of the transducer's resonant mechanical behavior. When the transducer is driven, it is tuned to ring at its designated ultrasonic frequency. Subsequently, it requires a brief period to dampen out the oscillations after the drive ceases. During the ringing phase, the transmitted signal can couple through the PCB or travel through the air between the transmitter and the receiver. To ensure that only the reflected pulse signal is received, and any other interfering signals are avoided, a delay is necessary before activating the receiver. This delay allows sufficient time for the ringing to dampen out completely. Therefore, the minimum detectable distance of the receiver is directly influenced by the time it takes for the ringing to dampen out.
In the current implementation, a bistatic topology was chosen. Two alternating fixed 40 kHz PWM signals are generated to drive the transducer periodically, thus creating the desired ultrasonic pulse. After the transmitter sensor produces a pulse, the system starts a timer and implements a hardware delay to avoid post-drive ringing, waiting for the oscillation to dampen out completely. When the echo is received by the other transducer and its amplitude value meets the threshold requirements, the timer stops, effectively acquiring the time needed for the round trip. Finally, the distance between the sensor and the target object is computed using the known speed of sound and the obtained time measurement. It should also be noted that if no echo is received, the system ignores the current measurement and moves on to the next one.