FAQ about Ultrasonic Sensors

userHead Tonny12138 2023-04-18 16:16:40 1685 Views0 Replies

Q1: How to code an ultrasonic sensor in Arduino?

A1:The product's wiki contains corresponding usage instructions and sample codes. It is recommended to refer to the wiki for code writing and product use.

Taking the "Gravity: URM09 Analog Ultrasonic Sensor" (SKU: SEN0307) as an example, it uses an analog voltage output method and can be connected to the mainboard through the Gravity 3Pin analog sensor cable. The module is connected to the UNO through the A1 analog interface, as shown in the figure below.



Tutorial on Arduino programming ( Distance Measurement )

The module will output analog voltage proportional to distance. After ADC sampled and output these data, the distance value can be obtained with a simple processing step.


Sample Code


Q2: Which is a better sensor IR or ultrasonic?

A2: IR (Infrared Radiation, short for infrared), the IR sensor is a non-contact sensor that can detect the infrared radiation of an object, and determine the position and distance of the object by reflecting light waves. They are generally faster and more accurate than ultrasonic sensors, but require some visibility to measure distance and cannot measure transparent objects. In addition, IR sensors are very sensitive to the temperature and light conditions of the environment.


Ultrasonic sensors use an ultrasonic wave above 20kHz that cannot be heard by the human ear. According to the frequency band, ultrasonic waves can propagate in any medium such as gas, liquid, solid, etc., but the propagation speed depends on the acoustic impedance of the medium. Ultrasonic sensors can measure transparent objects and non-metallic objects, and can also be used in low-light environments. In addition, the ultrasonic sensor has strong anti-interference for the environment in which it is used, and is not affected by dust, dirt or high humidity levels, and can be used in any lighting environment.


To sum up, ultrasonic sensors are largely insensitive to obstructive factors such as: light, dust, smoke, mist, steam, lint. But ultrasound is not as good as infrared for defining the edges of an area. In addition, infrared sensors cannot work in dark environments, while ultrasonic sensors can. Therefore, which sensor to choose depends on the specific application scenario and needs. For scenarios that require high-precision measurements, IR sensors may be more suitable. For scenes that need to detect transparent or non-metallic objects, or scenes that are used in noisy environments, ultrasonic sensors are relatively better.



Q3: What is the detection range of the ultrasonic sensor?

A3: The detection range of an ultrasonic sensor depends on the wavelength and frequency it uses. The longer the wavelength and the smaller the frequency, the greater the detection distance. The following is the detection range of several popular products on our platform for your reference.



Q4: Will an ultrasonic sensor detect objects on a rainy day?

A4:The ultrasonic sensor is hardly affected by any environmental conditions, including smoky or rainy environments. However, if you want to use the ultrasonic ranging sensor outdoors for a long time, it is recommended to choose a waterproof ultrasonic sensor, such as the A02YYUW waterproof ultrasonic sensor  (SEN0311) or the waterproof ultrasonic ranging module (SEN0207).



Q5: Can ultrasonic detection work underwater?

A5:Yes. The speed of ultrasonic waves propagating in water is faster compared to that in air. Therefore, the use of ultrasonic sensors in underwater applications is feasible. In fact, many underwater measurement applications rely on ultrasonic sensors for distance measurement and object detection, such as underwater mapping, underwater robots, and underwater pipeline inspection.



Q6: Can ultrasonic sensor detect human beings?

A6:Yes. Ultrasonic sensors can emit ultrasonic waves and detect surrounding objects, including people, by receiving the reflected sound waves.



Q7: What environmental factors can affect the performance of ultrasonic sensors?

A7:Fluctuations in temperature can affect the speed of sound waves in an ultrasonic sensor. As temperature increases, the speed of sound waves also increases. While the target may not have moved, the sensor may detect it as being closer due to this increase in speed. In addition, airflow caused by pneumatic equipment or fans may deflect or disrupt the path of ultrasonic waves, which could lead to the sensor failing to recognize the correct position of the target.



Q8: Many ultrasonic sensors on the platform, how to choose?

A8: It is recommended to refer to this selection guide.



The following is the FAQ for a specific product:

A02YYUW Waterproof Ultrasonic Sensor FAQ【SEN0311】

ME007YS Waterproof Ultrasonic Sensor FAQ【SEN0312】