dompasch Posted December 31, 2020 at 01:03 PM Posted December 31, 2020 at 01:03 PM Hi all, some time ago I bought two IR 2.0 distance sensors (10-80cm). Now when I employed them I noticed that the resolution is quite poor, and I am not sure whether this is intended behaviour. Here is a demonstration using brickv. I started with my hand very close to the sensor, slowly moved it away and then slowly back in front of the sensor. This is the result: At around 50cm there is already a very noticeable staircase effect which roughly "discretizes" the values at a resolution of around 1cm. That staircase becomes ever more pronounced the larger the measured distance, as can be seen on the far right where I put my hand away and the sensor measures the distance to the ceiling: here the margin between two steps is roughly 3cm. By the way, this effect also occurs at a higher moving average length and regardless of the sensor type chosen on the bottom right. I also took a look at the raw values retrieved over the C API and noticed the same effect (with a different measurement but the same motion of hand): (x-axis: chronological samples, y-axis: analog value reported) So is this relatively poor resolution intrinsic to these sensors? Or is there something I could adjust in my setup to overcome this problem? There does seem to be some additional information, at least some noise, on top of these staircase values, and that confuses me a bit. For my application I need a resolution of at least around 1mm within a considerable range (e.g. 10-40cm, not necessarily over the entire range), so I had hoped for better accuracy. If this is indeed a limitation of the hardware, do you maybe know of any other distance sensors which would match my requirement? Any help is appreciated. Thanks! Quote
borg Posted January 5, 2021 at 11:23 AM Posted January 5, 2021 at 11:23 AM This is unfortunately how these sharp sensors work. They output an analog voltage, but the voltage gets updated in "steps", as you see in the chart above. You can increase the moving average to get a bit of a measurement in-between if it oscillates between two of the steps. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.