Maker Pro
Maker Pro

Something to ponder

  • Thread starter ChrisGibboGibson
  • Start date
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
 
K

Ken Smith

Jan 1, 1970
0
I was bored so.........

Worth trying for fun.

How about this:

R R ! \
Vin -/\/\/\-------/\/\/\---------------!+ \
! ! ! ------- TooHi to CPU
!!- ---C ---!- /
Ton ----!! --- ! ! /
!!- ! !
! ! REF
GND GND


Loop forever;

TempBit := TooHi;
Ton := TempBit;
Answer := Answer + TempBit - Answer / 65536;
Display Answer;
end;


if the time canstant is long enough, the "answer" value settles to:

65536 * Vin / (2 * Vref)


You can make the main loop of the code do it.
 
C

ChrisGibboGibson

Jan 1, 1970
0
Subject: Re: Something to ponder
From: [email protected] (Ken Smith)
Date: 10/3/04 3:07 AM GMT Daylight Time
Message-id: <[email protected]>



How about this:

R R ! \
Vin -/\/\/\-------/\/\/\---------------!+ \
! ! ! ------- TooHi to CPU
!!- ---C ---!- /
Ton ----!! --- ! ! /
!!- ! !
! ! REF
GND GND


Loop forever;

TempBit := TooHi;
Ton := TempBit;
Answer := Answer + TempBit - Answer / 65536;
Display Answer;
end;


if the time canstant is long enough, the "answer" value settles to:

65536 * Vin / (2 * Vref)


You can make the main loop of the code do it.

But mine's actually sensible and serves a useful purpose !

Or did I miss something in your post ?

Gibbo
 
J

John Larkin

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


One of the old National appnotes does a single-slope ADC at 20 or 24
bits or something.

One interesting thing about this technique is the the differential
linearity is essentially perfect. That can be handy for stuff like
nuclear detector histogramming or electric meters.

John
 
S

Spehro Pefhany

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

Okay, why don't you explain what limits the accuracy (including
linearity) and repeatability of ramp ADC?



Best regards,
Spehro Pefhany
 
C

ChrisGibboGibson

Jan 1, 1970
0
Spehro said:
Okay, why don't you explain what limits the accuracy (including
linearity) and repeatability of ramp ADC?



Best regards,
Spehro Pefhany

That's the fun part. The linearity of the ramp is *all* that matters.
Repeatability over time and temperature isn't so important as it effectively is
recalibrated every time it's used (llok at the S/W). Use it once to get a
calibration reading, then immediately afterwards to take the actual
measurement. A few tens of mS at most. It looks stupid. But look at it again
without a sceptical eye.

That was the basis of my post a few days ago regarding a highly accurate CC
generator.

Until I actually tried this (with Fred's CC generator) I couldn't believe the
accuracy that could be got from such a small outlay.

Gibbo
 
C

ChrisGibboGibson

Jan 1, 1970
0
John said:
One of the old National appnotes does a single-slope ADC at 20 or 24
bits or something.

One interesting thing about this technique is the the differential
linearity is essentially perfect. That can be handy for stuff like
nuclear detector histogramming or electric meters.

I haven't seen that AN but after getting Fred's highly accurate CC generator a
few days back I simply ran that onto a standard 100nF ceramic cap for the ramp
generator.

Comparing the results with a 10 digit meter I got accuracy within 0.005% of the
Vrefs I was using. That's quite amazing for a dollars worth of comparator and
discretes.

Gibbo
 
C

ChrisGibboGibson

Jan 1, 1970
0
Spehro said:
AN260 January 1981. Like the one described by the OP, it's essentially
a serial single-slope converter, so the capacitor dielectric
absorption doesn't affect the linearity as it does in a dual-slope
converter, and the comparator sees the same dv/dt in the same
direction for reference and unknown measurement.


Doesn't take much leakage across the capacitor or current source to
reduce the linearity at midscale down to the 12-bit level though.

I might have known you'd spot the flaw!

At low scale or high scale the accuracy is absolutely remarkable. In between
these limits it's only amazing. Still fantasically good for the money (almost
none) though.

Gibbo
 
S

Spehro Pefhany

Jan 1, 1970
0
One of the old National appnotes does a single-slope ADC at 20 or 24
bits or something.

AN260 January 1981. Like the one described by the OP, it's essentially
a serial single-slope converter, so the capacitor dielectric
absorption doesn't affect the linearity as it does in a dual-slope
converter, and the comparator sees the same dv/dt in the same
direction for reference and unknown measurement.
One interesting thing about this technique is the the differential
linearity is essentially perfect. That can be handy for stuff like
nuclear detector histogramming or electric meters.

John

Doesn't take much leakage across the capacitor or current source to
reduce the linearity at midscale down to the 12-bit level though.



Best regards,
Spehro Pefhany
 
C

ChrisGibboGibson

Jan 1, 1970
0
Spehro said:
AN260 January 1981. Like the one described by the OP, it's essentially
a serial single-slope converter, so the capacitor dielectric
absorption doesn't affect the linearity as it does in a dual-slope
converter, and the comparator sees the same dv/dt in the same
direction for reference and unknown measurement.


Doesn't take much leakage across the capacitor or current source to
reduce the linearity at midscale down to the 12-bit level though.

And I'd also like to see any other *serious* contenders for A/D at sensible
accuracy levels for next to *no* outlay.

Gibbo
 
D

Dave VanHorn

Jan 1, 1970
0
Doesn't take much leakage across the capacitor or current source to
reduce the linearity at midscale down to the 12-bit level though.

Only 12 bits? Well damn.. :)

I did something like this for a printer.
We needed to read a thermistor, but didn't have an A/D
So, I used the thermistor through a diode to charge a cap, and a fixed
resistor through another diode to discharge the same cap. Cap value factors
out, and the diodes are mounted together, and track nicely. Worked well
enough.
 
N

nospam

Jan 1, 1970
0
And I'd also like to see any other *serious* contenders for A/D at sensible
accuracy levels for next to *no* outlay.

Two precision voltage references, a precision current source, a comparator,
3 way multiplexor and a microprocessor is next to no outlay?

If you use a MOSFET to reset the integrating capacitor to a 'good' 0v then
you can dispense with the 2.5v reference and only require a two way
multiplexor. Slightly better performance and a little closer to *no*
outlay.
 
S

Spehro Pefhany

Jan 1, 1970
0
Only 12 bits? Well damn.. :)

I did something like this for a printer.
We needed to read a thermistor, but didn't have an A/D
So, I used the thermistor through a diode to charge a cap, and a fixed
resistor through another diode to discharge the same cap. Cap value factors
out, and the diodes are mounted together, and track nicely. Worked well
enough.

A thermistor typically changes almost 5% per degree C. A 20%-accurate
ADC was probably good enough for limiting the duty cycle of a thermal
printhead. ;-) Sounds like an appropriate design.


Best regards,
Spehro Pefhany
 
M

Mac

Jan 1, 1970
0
On Sun, 03 Oct 2004 02:23:08 +0000, ChrisGibboGibson wrote:
[snip]
That was the basis of my post a few days ago regarding a highly accurate CC
generator.

Until I actually tried this (with Fred's CC generator) I couldn't believe the
accuracy that could be got from such a small outlay.

Gibbo

What exact circuit did you use for the CC generator? You were going to use
a source rather than a sink, weren't you?

--Mac
 
J

John Larkin

Jan 1, 1970
0
I haven't seen that AN but after getting Fred's highly accurate CC generator a
few days back I simply ran that onto a standard 100nF ceramic cap for the ramp
generator.

Ceramics have lots of dielectric absorption (which will curve the
ramp) and c/v coefficient (ditto) and bad tc's. TC may not sound like
an issue, but at hundreds of ppm/k and sub-ppm resolution, minute
temperature fluctuations start to matter, even for relatively quick
ramps. Nonlinear capacitances (from semiconductor junctions all over
the place) will get interesting, too. With a 100 nF ramp cap, each 100
fF in capacitance change is a 1 PPM error; your current source,
comparator, and whatever resets the ramp could easily have many pF of
delta-c over the ramp range.
Comparing the results with a 10 digit meter I got accuracy within 0.005% of the
Vrefs I was using. That's quite amazing for a dollars worth of comparator and
discretes.

10 digit DVM? Who makes that?

John
 
K

Ken Smith

Jan 1, 1970
0
Subject: Re: Something to ponder
From: [email protected] (Ken Smith) [...]
How about this:

R R ! \
Vin -/\/\/\-------/\/\/\---------------!+ \
! ! ! ------- TooHi to CPU
!!- ---C ---!- /
Ton ----!! --- ! ! /
!!- ! !
! ! REF
GND GND


Loop forever;

TempBit := TooHi;
Ton := TempBit;
Answer := Answer + TempBit - Answer / 65536;
Display Answer;
end;


if the time canstant is long enough, the "answer" value settles to:

65536 * Vin / (2 * Vref)
But mine's actually sensible and serves a useful purpose !

Or did I miss something in your post ?

Yes:

Very often the main task a uP is doing involves going around a loop at
some rate and doing stuff in that loop. The battery voltage measurement I
suggested can be added to such a loop.

It responds slowly but battery voltage is not going to change too quickly
anyway.

I have done exactly this type of voltage measurement in a product. It
works just fine. I used a time constant of 256 not the 65536 I suggested
above.
 
D

Dave VanHorn

Jan 1, 1970
0
A thermistor typically changes almost 5% per degree C. A 20%-accurate
ADC was probably good enough for limiting the duty cycle of a thermal
printhead. ;-) Sounds like an appropriate design.

No, and it was way closer than that, but I don't remember the specifics.
It's been a few years.
We also used it to correct the print density for head temperature.
 
J

John Larkin

Jan 1, 1970
0
And I'd also like to see any other *serious* contenders for A/D at sensible
accuracy levels for next to *no* outlay.

Gibbo


Delta-sigmas are getting awfully cheap, and they are very good. They
have superb linearity and good noise rejection, and integrate well.

I don't recall anyone making a single-slope DVM or anything like that.

John
 
M

me

Jan 1, 1970
0
And I'd also like to see any other *serious* contenders for A/D at
sensible accuracy levels for next to *no* outlay.

AN513 from Microchip, uses pic16c54. could work with most other micros...
 
J

Jeff

Jan 1, 1970
0
John Larkin said:
Ceramics have lots of dielectric absorption (which will curve the
ramp) and c/v coefficient (ditto) and bad tc's. TC may not sound like
an issue, but at hundreds of ppm/k and sub-ppm resolution, minute
temperature fluctuations start to matter, even for relatively quick
ramps. Nonlinear capacitances (from semiconductor junctions all over
the place) will get interesting, too. With a 100 nF ramp cap, each 100
fF in capacitance change is a 1 PPM error; your current source,
comparator, and whatever resets the ramp could easily have many pF of
delta-c over the ramp range.

The voltage references must also be very stable and very low noise, or the
results are going to be skewed quite a bit, and won't achieve anything
accurate near 24 bit resolution.
 
Top