Introduction
An ultrasonic sensor uses sound to detect objects and measure their distance. It is a proximity sensor that works on time of flight.
How it works
- the main element is an electroacoustic transducer, often a piezoelectric ceramic
- the same transducer sends and receives the sound
- the sound energy must damp out fast, so that the sensor can detect objects at close range
- the sensor sends a short ultrasonic burst. The speed of sound in the medium is known
- the time between the outgoing pulse and the returning echo gives the distance

For example, the Polaroid ultrasonic ranging system uses a 1 ms burst of 56 pulses at four frequencies: 50, 53, 57 and 60 kHz.
Time window
A time window is used to tell the outgoing pulse apart from the returning echo. The window sets the working range of the sensor:
- is the minimum detection time, so it sets the minimum distance
- is the maximum detection time, so it sets the maximum distance
The timing signals are:
- A: gating signal to control transmission
- B: output signal and echo signal
- C: pulses from transmission or reception
- D: time window
- E: set when an echo is received and D is high. Reset at the end of the transmission pulse in A
- F: set on the positive edge of a pulse in E. Reset when E is low and a pulse occurs in A

Example
An ultrasonic sensor detects objects within 0.5 m. At the transducer is pulsed for 0.1 ms. Resonances in the transducer take 0.2 ms to die out, and echoes in the environment take 10 ms to die out. Sound travels at 344 m/s.
- What time window should you use?
- What is the minimum distance the device can detect?

1. Time window
Open the window after the resonances in the device have died out:
Close the window when the sound has gone 0.5 m and back (1 m in total):
The window is 0.3 ms to 3 ms.
2. Minimum distance
The sound must go and come back within the time from the start of the pulse to the end of the resonances: