DrGFreeman / SharpDistSensor

A library for the Arduino IDE that helps interface with Sharp IR analog distance sensors.
MIT License
31 stars 11 forks source link

3V modules. #11

Closed kurtsik closed 6 years ago

kurtsik commented 6 years ago

Hello DrGFreeman. Do you know if will work accurately with 3V modules?

Thanks.

DrGFreeman commented 6 years ago

Hello @kurtsik, thank you for your interest in this library.

Currently none of the three pre-defined sensor models in the library are 3V models. You can nevertheless use the library with your custom calibration curve. The accuracy will depend of how good the calibration curve you define (polynomial or power curve) fits the calibration data.

You can define a custom calibration curve either using the sensor datasheet of by taking multiple measurement of an object at different known distances and noting the corresponding analog value returned by the Arduino. Once you have these distance (y) vs analog value (x) pairs, you can plot them in Excel and fit a polynomial or power "trend line" which will provide you the coefficients needed to define a custom calibration with the library (see the relevant example sketches in the library).

You may also find this tutorial useful: http://www.instructables.com/id/How-to-setup-a-Pololu-Carrier-with-Sharp-GP2Y0A60S/

If you get stuck along the way, please do not hesitate to reach me by email (address on the README page) and I'll do my best to reply as quickly as possible.