[Ultrasonic sensors](https://www.onzuu.com/category/ultrasonic-receivers-transmitters) measure distance by using sound waves—specifically, high-frequency sound above human hearing (>20 kHz). Here's how they work:

**Basic Principle: Time of Flight (ToF)**
1. Transmit: The [sensor](https://www.ampheo.com/c/sensors) emits a short burst of ultrasonic sound (typically 40 kHz) from a transmitter (TX).
2. Reflect: The sound wave travels through the air, hits an object, and reflects back.
3. Receive: A receiver (RX) detects the echo of the sound.
4. Calculate Distance:
The sensor measures the time it takes for the echo to return and uses this formula:
Distance=(Time of Flight×Speed of Sound)/2
(Divided by 2 because the sound travels to the object and back)
At room temperature, the speed of sound ≈ 343 m/s ≈ 0.0343 cm/µs
**Example:**
If the time between sending and receiving the echo is 1,000 µs:
Distance=(1000×0.0343)/2=17.15cm
**Common Sensor: [HC-SR04](https://www.ampheo.com/product/hc-sr04-26835950)**
* Trigger pin: Input to start a measurement (send pulse)
* Echo pin: Output high for the duration of echo return time
* Range: ~2 cm to 400 cm
* Accuracy: ±3 mm (approx.)
**Applications**
* Robot obstacle detection
* Liquid level sensing
* Parking [sensors](https://www.ampheoelec.de/c/sensors)
* Smart garbage bins