Ultrasonic Sensor Log

From Open Source Ecology
Jump to: navigation, search

Fri Aug 26, 2016

Hi Marcin,

My experience with the low cost sensors is you can achieve 1mm resolution (not accuracy) and if calibrated for a given temperature accuracy can approach 3mm too, there are some repeatability problems though. For example, if you move the object out of the transducers line of site and then bring it back, stability problems means that it does not always come back to the same place, but then the distance between movements is still measured accurately. This can be overcome by taking a reference reading and using that as a zero reference in the software.

The transducer has no effect on accuracy it’s all about signal processing and detection.

The advantage of the Hc-Sr04 Modules is they generate a uniform pulse of sound to the transducer and time of flight is then measured by Arduino, but the time to poll the input pin gives some jitter and therefore accuracy problems, which can be averaged out with many readings rather than just one so that there is a statically averaged outcome, I have not done that in my code, but relatively easy to do, even a simple average would reduce reading noise.

Then you have the problem of temperature and humidity and the effect on the speed of sound and therefore accuracy, but luckily the relationships between sound and air temperature/humidity are well known, so to really improve accuracy a temp and humidity needs to be added. In both cases (temp and humi) the difference is low orders of %, perhaps 1-2% in reading accuracy.

So all this can be relatively easily factored into the measurement, perhaps via a look-up table and I’d envisage the HC-SR04 module, a BOSCH BME280 for accurate temperature and humidity and an Arduino, sensor costs would be about UK £5 no more.

A better approach might be to use light, which removes the speed of medium uncertainties and adjustments, there are some sensors on the market: https://www.proto-pic.co.uk/sparkfun-tof-range-finder-sensor-vl6180.html and given light takes ~3.3nS to travel 1M then these units are doing some seriously fast edge detection work to measure down to the close range that they are capable of, much too fast for an Arduino but an ESP8266 is getting closer if operated at 160MHz and an interrupt edge detection scheme was used.

In the sensor you cited: - http://www.cnccontrols.com/thcontrol.asp they must be doing the signal processing in the module. These are interesting: http://www.aliexpress.com/item/Integrated-Ultrasonic-Module-Distance-Measuring-Sensor-Module-Reversing-Radar-Waterproof/32312190912.html?spm=2114.30010308.3.134.FJESom&ws_ab_test=searchweb201556_0,searchweb201602_4_10057_10056_10065_10037_10055_10054_301_10059_10058_10032_10017_107_10060_10061_10052_414_10062_10053_10050_10051,searchweb201603_4&btsid=893a97b1-e89d-4615-b2b2-69bebe2439d1 but they quote 5mm resolution, which seems a bit low to me.

These laser measurement modules look interesting too: http://www.aliexpress.com/item/Diffuse-reflection-laser-sensor-JG-FS-1M-1-100cm-Laser-Distance-Sensor-Module-Optical-Rangefinder-For/32612692885.html?spm=2114.30010308.3.1.xC2gHC&ws_ab_test=searchweb201556_0,searchweb201602_4_10057_10056_10065_10037_10055_10054_301_10059_10058_10032_10017_107_10060_10061_10052_414_10062_10053_10050_10051,searchweb201603_4&btsid=119708c6-7211-4c2d-be80-f3622a4a3b50

Hope all this helps



Thu Aug 25, 2016


My name is Marcin, I founded the Open Source Ecology project, and we are building a CNC Torch Table automatic height controller using an ultrasonic sensor.

Just saw your nice video - https://www.youtube.com/watch?v=-1SDVVepaP8

It implies accuracy is 3mm at 15 cm or better, which is quite good.

We need that kind of resolution.

I saw this professional version - http://www.cnccontrols.com/thcontrol.asp - but that is too expensive

Do you think that this sensor would work for sensing height from the surface of the metal that we are cutting? Would you be interested in advising us on building an open source CNC torch height controller?

Thanks, Marcin