C
ChrisGibboGibson
- Jan 1, 1970
- 0
I was bored so.........
Worth trying for fun.
Only read further if you're into uP programming.
Uncannily accurate (slow) A/D can be got from this for next to nothing .......
The first implementation was for a battery volt meter (therefore full range of
zero to full scale is *not* required).
First thing you need is an accurate ramp generator. I used a precision constant
current into a cap.
You also need two precision V refs, one exactly twice the voltage of the other
(any other ranges can be used but this just makes the maths easier). I used a
2.5 V (now called LoRef1) and a 5 V
Use a uP output to reset the ramp, release the ramp then in software wait till
it reaches the 2.5V ref (hint use the comparator feeding a uP input). Now start
a timer.
Wait til it reaches the 5 volt reference. Count the time it took. Store it.
Call this T1. You now have an accurate measurement of how long your particular
ramp took to get from 2.5 volts to 5 volts.
Now do the same with the input you wish to measure. ie reset the ramp, wait for
the ramp to reach the 2.5 V reference then start the timer. Now wait til the
ramp reaches your input voltage and stop the timer. Call this interval T2
Your measured voltage is now ((T1 + T2)/T1)* LoRef
This is a no brainer for any uP
If you do one immediately after the other then it kinda cancels out any drinft
in your ramp generator from one measurement to the other.
Dead simple. The more accurate you make the Vrefs the more accurate your result
will be. The slower you clock up the timer, the better resolution you will get.
For slow A/D conversion this really takes some beating, 24 bit resolution A/D
for a few pence !
Gibbo
Worth trying for fun.
Only read further if you're into uP programming.
Uncannily accurate (slow) A/D can be got from this for next to nothing .......
The first implementation was for a battery volt meter (therefore full range of
zero to full scale is *not* required).
First thing you need is an accurate ramp generator. I used a precision constant
current into a cap.
You also need two precision V refs, one exactly twice the voltage of the other
(any other ranges can be used but this just makes the maths easier). I used a
2.5 V (now called LoRef1) and a 5 V
Use a uP output to reset the ramp, release the ramp then in software wait till
it reaches the 2.5V ref (hint use the comparator feeding a uP input). Now start
a timer.
Wait til it reaches the 5 volt reference. Count the time it took. Store it.
Call this T1. You now have an accurate measurement of how long your particular
ramp took to get from 2.5 volts to 5 volts.
Now do the same with the input you wish to measure. ie reset the ramp, wait for
the ramp to reach the 2.5 V reference then start the timer. Now wait til the
ramp reaches your input voltage and stop the timer. Call this interval T2
Your measured voltage is now ((T1 + T2)/T1)* LoRef
This is a no brainer for any uP
If you do one immediately after the other then it kinda cancels out any drinft
in your ramp generator from one measurement to the other.
Dead simple. The more accurate you make the Vrefs the more accurate your result
will be. The slower you clock up the timer, the better resolution you will get.
For slow A/D conversion this really takes some beating, 24 bit resolution A/D
for a few pence !
Gibbo