what is ultrasonic sensor?

What is an ultrasonic sensor, and how does it work?
An ultrasonic sensor uses sound waves above the human hearing range to detect objects or measure distance. This type of sensor commonly sends a short acoustic pulse, listens for the returning echo, and calculates the target distance from the elapsed time. The basic question is: “How long did the sound take to come back?”
Among the different sensor types, ultrasonics provides non-contact measurement. A photoelectric sensor uses light; an ultrasonic sensor uses sound. This can be useful for clear bottles, dark objects, and liquid surfaces. It does not mean that every material can be detected at every angle and under every condition.
Calculating distance: why divide by two?
Time of flight includes the journey to the target and back. Distance is therefore calculated as d = c × t / 2, where d is distance, c is the speed of sound, and t is the round-trip time. At approximately 20 °C, the speed of sound in air is about 343 m/s.
Worked example: An echo arrives after 5.83 ms. In seconds, this is 0.00583 s.
d = 343 × 0.00583 / 2 ≈ 1.00 m. The sound travelled approximately 2 metres in total; the target is approximately 1 metre from the sensor.
Ultrasonic sensor types and operating modes
Diffuse mode: The sensor transmits sound and evaluates the echo returned by the target itself. This is widely used for distance measurement and level monitoring. In many models, transmitting and receiving take place in the same sensor head.
Reflective barrier: The sensor monitors a fixed reference surface opposite it. An object entering the path is detected through a change or loss of the reference echo. A metal plate or suitable machine surface can provide the reference; an optical retroreflector is not required.
Through-beam barrier: A separate transmitter and receiver face each other. The output changes when an object interrupts the sound path. Its primary purpose is presence detection; it should not be confused with direct echo-based distance measurement.
Special-purpose devices: Dedicated ultrasonic sensors are available for double-sheet detection, label sensing, and web edge monitoring. Temperature compensation, short range, and long range are device characteristics rather than separate sensing principles. Flow, thickness, and Doppler velocity measurements require their own suitable instruments and methods.
Output signals and PLC integration
A switching output indicates object presence or whether a level threshold has been crossed. The choice between PNP and NPN must match the input circuit of the connected PLC. Check supply voltage, pin assignments, and output current against the manufacturer's wiring diagram.
For a continuous distance reading, select an analog signal output or a suitable digital interface. 0–10 V and 4–20 mA outputs connect to a compatible PLC input module. IO-Link models can transmit measurement and diagnostic data through a compatible master.
Scaling example: If a sensor is specifically configured for 0.20–2.00 m = 4–20 mA, a reading of 12 mA represents the midpoint: 1.10 m. A reversed output characteristic changes the interpretation. PLC scaling and the SCADA display must match the sensor configuration.
Blind zone and detection area
The blind zone is the close-range area where reliable measurement is unavailable. After transmission, the transducer needs time to stop ringing. For example, a model with a 100 mm minimum measuring distance should not be expected to measure a target at 50 mm. The limit is model-specific.
The sound cone describes a three-dimensional detection area, rather than a single thin laser line. Tank walls, filling pipes, or nearby machine parts can produce unwanted echoes. Read the manufacturer's detection diagram in relation to the target size and surface. A maximum range established with a large flat plate does not automatically apply to a small, angled object.
How is tank level calculated?
A sensor facing down from above first measures the empty distance to the surface. If H is the distance from the sensor reference plane to the tank bottom and d is the distance to the liquid surface, liquid height is h = H − d. With H = 2.00 m and d = 0.60 m, the liquid height is 1.40 m. The surface must remain outside the blind zone even at maximum fill level.
Continuous level measurement and threshold control using a liquid level relay serve different requirements. An ultrasonic sensor measures geometric height; calculating volume in litres requires the tank geometry and its height-to-volume relationship. Half the height does not necessarily mean half the volume.
Conditions that make measurement harder
Temperature changes affect the speed of sound. Many models use an internal temperature sensor for temperature compensation. Residual error can remain when the temperature at the sensor differs from that along the acoustic path. Dense vapour and changing gas composition also need consideration.
Foam, soft sponge, and some textiles can absorb sound. A smooth, angled surface can reflect the echo away from the sensor. Turbulent liquid or an agitator can make readings fluctuate. Closely spaced sensors may experience cross-talk; use suitable mounting distances or synchronization supported by the model.
An IP67 rating describes enclosure resistance to dust and water ingress under specified conditions. It does not guarantee reliable readings through foam, chemical resistance, or continuous underwater operation. Heavy deposits and water droplets on the sensing face can affect measurement.
When is ultrasonics a suitable choice?
Transparent packaging, products with changing colours, and non-contact liquid level monitoring are useful starting points. For close-range metal presence detection, consider an inductive sensor. For a level threshold with a suitable material and container, a capacitive sensor may also be appropriate.
A laser sensor may suit a small target or narrow measuring spot. A linear encoder provides direct machine-axis position feedback, while a rotary encoder suits shaft motion. A useful sensor comparison considers range, target properties, response time, accuracy, and the operating environment together.
Where should troubleshooting begin?
Start with the target and mounting: Is the target inside the blind zone, is its surface angled, or is a pipe or wall in the acoustic path? Check the configuration next: Are teach-in, the measuring window, filtering, and hysteresis appropriate? Then check the electrical side: Do the supply, pin connections, PNP/NPN interface, and analog scaling match? Finally, test the sensor on its own against a flat target at a known distance and compare the result with actual process conditions.