Sharp infrared sensor GP2D12
areal
Posts: 5
Hi,
I'm currently working on a school project which i need to use a Sharp infrared sensor to measure distance. I was told that i need to calibrate my sensor reading. Although i've read the information from www.acroname.com·but i don't understand how i should do it. Can someone pls explain(more detail..pls)·how·to calibrate the sensor reading for accurate measurement? Thanks much.
magdalene
I'm currently working on a school project which i need to use a Sharp infrared sensor to measure distance. I was told that i need to calibrate my sensor reading. Although i've read the information from www.acroname.com·but i don't understand how i should do it. Can someone pls explain(more detail..pls)·how·to calibrate the sensor reading for accurate measurement? Thanks much.
magdalene
Comments
Analog·output voltage. (indication of 10-80cm,·4 to 32·in.)
Post Edit:
1) You're going to need to interface an analog signal to a digital input (via ADC, other means)
2) The output of the D12 is "non-linear".· Save some EEPROM space for a·"look-up" table.
3) What degree of "accuracy"?
[noparse][[/noparse] Corrected a mistake in my metric to English conversion. ]
Post Edited (PJ Allen) : 11/26/2006 8:42:32 PM GMT
What should i do with the "non-linear" curve? I couldn't really get the distance values as shown by the curve. How should i calibrate this? Besides, in the excel file provided by acroname, there's a cell named "voltage", does it mean the reference voltage supplied to the adc?
Initially i intend to convert the adc readings to distance readings by using the equation of the non-linear curve generated from excel "display curve equation"·function, but PBasic can only read integer. The equation generated involves floating points like 0.000037x^4+...+3.2236883. I got stuck here and don't know how can i calibrate it properly...
Kindly·pls advise, if possible·can describe a bit more in detail pls? Thanks!!!
magdalene
If you have a voltmeter, you should be able to hook up the sensor itself on a protoboard and·monitor·its output voltage as you place/move an object before the sensor, without a Stamp, or anything else, just to get a feel for what's happening.
Then·I'd program the Stamp to just read the ADC and display that value using DEBUG.· Then I'd place an object before the sensor and note the values·returned by DEBUG, in 5cm steps,·in the range you are to measure (the range is 10-80cm, 70cm, that's 14 data points.)· With those values you could make up a·reference table in EEPROM.·
So, later, when you need the Stamp to determine a distance, you'd have it read the ADC and compare it to your previously stored values.
madlabs.info/gp2d12/sharp_gp2d12.shtml
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
Can i know in the excel spreadsheet u mentioned, what is the input for supply V? is it 5V supplied from Basic Stamp Vdd pin or the voltage supplied to the reference pin of the ADC?
Thanks!!
mag
If you are asking what 5v supply to use to power the Sharp, use an outboard regulator (like the regulator on a BOE) not the Vdd supplied by a Stamp (which I don't think will handle the current needed by the sharp).
If you are asking about reference voltage, you need to divide 5v for reference. I would check documenation for your ADC.
You can always check the actual voltage output of the Sharp by connecting a voltmeter to the sharp output pin and measuring it -- the closer you are the higher the voltage will be.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
Sorry for my unclear message. The supply V i meant is actually the value which we are required to input in the spreadsheet which you mentioned. I've attached the pic for your reference. So is this supply V 5V or reference voltage?
Thanks!!
mag
You can just use the second table down on the left and enter your actual readings that you SHIFTIN from the ADC and the corresponding cm. values for your tests and the spreadsheet will generate your constants.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
The above might be handy -- it's got circuit for setting up an ADC8031, the Sharp, and some test code. I would still use the spreadsheet and your own readings to get your 3 constants -- in my experience every IR ranger is slightly different, and wire lengths, your circuit, etc. can influence the exact readings you get on your own rig.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST