Jump to content

Increase the resolution of IR distance detector


Recommended Posts



I see that the tinkerforge uses an ADC (12 bit range: Not Disclosed) converter on the IR distance sensor.  This seems to be a poor match with the performance specs on the sensor (http://www.sharp.co.jp/products/device/doc/opto/gp2y0a21yk_e.pdf).  Has anyone used a better ADC with this product?  eg.


For a 0-5 V ADC at 16 bit:

  • resolution = 5/2^16 ​​ V/bit = 7.6 x 10-5​​ V/bit
  • linear range of IR sensor document (i.e. 100 mm to 500 mm) =  50 mm / 1.55 V = 32.2 mm/V
  • so for 0-5V 16bit resolution ADC: the resolution should be 2.46 x 10-3​​ mm/bit


From this calculation the current resolution seems poor (maybe because tinkerforge is trying to save money and not concerned to much with resolution).  Even with a  0-5 V ADC at 12 bit resolution: (0.0407 mm/bit) 


Has anyone used a different ADC with the IR displacement sensor?


Thanks in advance,


Link to comment
Share on other sites

Beside resolution you also have to look at precision and accuracy



We indeed have plenty resolution with the 12 bit ADC for 1mm steps, but the sharp sensors unfortunately does neither have enough precision nor accuracy to make any smaller steps useful.

Link to comment
Share on other sites

Thank you for the clarification, Borg.


Does SHARP provide a more in depth calibration curve than Fig.2 in http://www.sharp.co.jp/products/device/doc/opto/gp2y0a21yk_e.pdf ?


Something that indicates some sort of noise within the signal?  Say, something to quantify the precision and accuracy as detailed in the diagram below?




How is the digital signal converted to displacement?  Or is this all a black box that is only minorly detailed in the block diagram as the "signal processing circuit" of the PSD?



Link to comment
Share on other sites

There is no detailed calibration curve from sharp, the differences between the sensors are in the range of +-2cm full-scale depending on the distance in our tests.


We took one sensor per type and made a distance/voltage lookup table. You can find the table here (for the 2Y0A21 for example): https://raw.githubusercontent.com/Tinkerforge/distance-ir-bricklet/master/software/calibration/2Y0A21.txt


The Bricklet does a simple linear approximation with this table and does some averaging over the analog values to remove as much noise as possible.


You can upload a new table to the Bricklet if you want to calibrate for your specific sensor: https://www.tinkerforge.com/de/doc/Hardware/Bricklets/Distance_IR.html#verfugbare-spannung-distanz-abbildung


As far as i know there are no noise figures from sharp (which is a good indication that there is lots of noise).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...