An ultrasonic sensor is the best solution when space is limited. It is suitable for applications in which the sensor is used for distance or similar measurements. The ultrasonic sensor features many benefits compared to optical sensor: e.g., the former is insensitive to dirt, dust and even water. This way, it provides you with reliable operation and accurate measurements also in the harsh environments. Ultrasonic sensor also detects objects regardless of their structure and color.
While the inductive sensor detects only metals, the ultrasonic sensor detects any medium. This also applies to plastics, making the ultrasonic sensor a step ahead of capacitive sensor. Like the optical sensor, the capacitive sensor is much more susceptible to dirt compared to the ultrasonic sensor.