ADC LV-maxsonar Ez1 range finder o/p voltage

satanas
@satanas-wIiiPN • Oct 26, 2024

hi friends,

please have a look at the following specs and help me out!

specs: The LV-MaxSonar detects objects from 0-inches to 254-inches (6.45-meters) and provides sonar range information from 6-inches out to 254-inches with 1-inch resolution.

when using the analogue pin:

AN –
Outputs analog voltage with a scaling factor of (Vcc/512) per inch. A supply of 5V yields ~9.8mV/in. and 3.3V yields ~6.4mV/in. The output is buffered and corresponds to the most recent range data.​

the output voltage at a range of 10 inches = 98 mV. Am using an 8-bit ADC and when using the formula X= ( Vin/Vf.s) * 2^n - 1, at 254 inches the digital output is 127!! shouldn't it be 255?? i mean 5V --> 254 inches (full range) --> 255 (n=8bits).. ​


so if i use it as it is, taking the output at 10 inches, X = (98mV/5) * 255 = 4.998=5.. what will be the consequence?? should the output be amplified?

the microcontroller being used is PIC 16F877A.​




please reply soon!

thanks,
satanas​

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Stephen_c

    @stephen-c-oHT7Ug • May 22, 2010

    well according to me... u are dividing your vcc by 512 for each inch...as a result you are getting 9.8mV/inch but if u consider the range of 254 inch the max output voltage u will get is 9.8mV/inch*254 which is abt 2.499V . try to use scaling factor of 254 which will simplify your adc values.. also X = (98mV/5) * 255 = 4.998=5 is not right. ..at 98 mV you have distance of 10 inch.. so if you use scaling factor of 254 than you will get value of 10. Hope this helps

  • satanas

    @satanas-wIiiPN • May 22, 2010

    hi stephen,

    the scaling factor of Vcc/512 is an "in-built" one.. it's not me who decide on the factor.. so u see the problem.. the idea of dividing by 256 is similar to amplifying the analog o/p by a factor of 2 but i can't really divide by 256. anyone used this sensor before??
    please help!

    satanas

  • Stephen_c

    @stephen-c-oHT7Ug • May 22, 2010

    so max output u will get is 2.5 volts.. either u configure your adc to accept 2.5 volt as high value or use an op-amp to convert value to 5V.. also the value in the adc resiostor can be dsigned ot have values corresponding to voltages ... for e.g. for 1 volt input value should be x than for 2 volt input value should be y.. i dont know how the register allocation in uC work.. but i hope this helps