Ultrasonic Distance Sensor
Sensor
A sensor that measures distance by sending out ultrasonic sound waves and timing how long they take to reflect back.
What it looks like
Ultrasonic Distance Sensor
A typical sensor — exact shape, colour and markings vary between manufacturers.
Types & variants
Key specs
Operating voltage
VTypically 5V for most modules, check datasheet for exact requirements.
Range
cmMinimum to maximum detectable distance (usually 2cm to 400cm).
Resolution
mmSmallest detectable distance change (typically 1mm to 1cm).
Beam angle
degreesAngle of the ultrasonic cone (typically 15-30 degrees).
Trigger pulse
µsMinimum high pulse duration to initiate measurement (usually 10µs).
Response time
msTime between trigger and echo pulse (depends on distance).
Markings
Usually labeled with model number (e.g. 'HC-SR04'). VCC/Trig/Echo/GND pins marked on PCB. Some have range adjustment potentiometer.
Standard values
Operating voltage: 3.3V or 5V. Range: 2cm-4.5m (varies by model). Common trigger pulse: 10µs high.
How to choose
1) Check voltage compatibility (3.3V or 5V). 2) Select range based on your needs (2cm-4m for most). 3) Consider beam angle (narrower for focused detection). 4) Check interface type (digital/analog/I2C/SPI).
Pinout & package
HC-SR04 — 4-pin header
Check first: ECHO idles at 5 V, so on a 3.3 V board (ESP32, Pi) it needs a divider or level shifter. 3-pin variants (Ping))) ) share one trigger/echo line.
Typically 4 pins: VCC (power), Trig (trigger input), Echo (output pulse), GND. Packages: PCB module with mounting holes or breadboard-friendly pins.
Example circuits
- Distance measurement for robotics
- Parking assistance system
- Liquid level measurement in tanks
- People counter
- Obstacle avoidance for drones
Common failures
Water/damage to transducers causing weak/no echo. Internal electronics failure. Drift in timing measurements. Physical damage to transducer elements.
How to test
1) Connect VCC and GND. 2) Send 10µs high pulse to Trig. 3) Measure duration of high pulse on Echo pin. 4) Calculate distance: Distance = (duration × speed of sound) / 2. 5) Compare with known distance.
Substitutes
Laser rangefinders (more precise, more expensive), infrared distance sensors (shorter range, affected by color), time-of-flight sensors (more accurate, higher cost).