Society of Robots - Robot Forum

Software => Software => Topic started by: lcab on February 11, 2010, 07:39:03 PM

Title: need help programing adc to measure resistance
Post by: lcab on February 11, 2010, 07:39:03 PM
i am trying to write a program in c to measure the resistance across two terminals using my analog to digital converter on my microprocessor. We are using the a axon microprocessor can anybody help point me in the right direction because i am not sure how to approach this situation. i have read about the adc but still not to sure how it works.thanks
Title: Re: need help programing adc to measure resistance
Post by: waltr on February 12, 2010, 08:42:02 AM
Which microprocessor?

An ADC measures voltage and converts the voltage to a digital value that is dependent on the input voltage, the internal reference voltage and the number of bits of ADC resolution.
To measure a resistance you need to use Ohm's Law (E = I*R or R = E/I). So, apply a constant current (I) through the resistor and use the ADC to measure the voltage across the resistor then calculate the resistance.
Google will find tons of information on this.
Title: Re: need help programing adc to measure resistance
Post by: Admin on February 13, 2010, 10:54:08 PM
You'll need to make a voltage divider - two resistors in series.

Attach ground to one end, 5 volts to the other, and your ADC output in the center. The voltage measured, using Ohms law, will get you resistance.

Make sure you keep total current under 20mA, lower the better.

Use 10 bit ADC to get the best accuracy.