Started by September 8, 2005
It seems to me that the 10-bit ADC range can be extended (without
increasing the resolution, which remains 10 bits) by manipulating Aref,
the analog reference voltage on 8535 processor pin 29. Ultimately
limited by noise, the low end of the BX-24's analog input range can be
extended another six, or even eight, bits pretty easily.

Aref is normally tied to Vcc so, typically, Aref = 5.0V and the ADC
range is the 10 bits of values below 5.0V with a unit resolution of
5.0/1024 ~= 4.88mV. By lifting pin 29, Aref can be supplied by another
source. If that source provides voltages lower than Vcc, the effective
ADC range is the 10 bits of values below that voltage. For example, if
Aref = 2.5V, the unit resolution is 2.5/1024 (one bit below ~4.88mV)
~=2.44mV. If Aref = 1.25V, the unit resolution is ~1.22mV, etc.

BasicX provides a mechanism to generate these reference voltages under
program control, functions DACPin() and PutDAC(). The functions produce
an 8-bit PWM burst on an output pin that will, properly treated, yield
an analog voltage in the range 0 to 5.0*255/256V, or one-bit less than
5.0V. It is, then, possible to generate 5.0*128/256 = 2.5V, 5.0*64/256
= 1.25V, and so forth, down to 5.0*1/256 ~.5mV. If Aref = 5.0*1/256,
the theoretical unit resolution of the ADC will be 5.0*1/256/1024 ~=
19uV. That is an eight bit extension of the ADC's low-end range. A
six-bit extension - yielding a convenient 16-bit value - will have a
unit resolution of about 76uV. Such sensitivity will very likely be
problematic due to noise, but slow signals might well be sampled
successfully at 16 or 18 bits using this method.

An iterative procedure could shift the reference voltage down until the
ADC MSB is set - or six loops, whichever occurs first - providing 10
bits of accuracy over a 16-bit range below 5.0 volts. Tom

That's fine Tom, but I presume the 5.0v ref for the PWM is the on-board
5v regulator, so ultimately the Vref for the A/D will be only as good as
the 5v regulator?
neil

Tom Becker wrote:

> It seems to me that the 10-bit ADC range can be extended (without
> increasing the resolution, which remains 10 bits) by manipulating Aref,
> the analog reference voltage on 8535 processor pin 29. Ultimately
> limited by noise, the low end of the BX-24's analog input range can be
> extended another six, or even eight, bits pretty easily.
>
> Aref is normally tied to Vcc so, typically, Aref = 5.0V and the ADC
> range is the 10 bits of values below 5.0V with a unit resolution of
> 5.0/1024 ~= 4.88mV. By lifting pin 29, Aref can be supplied by another
> source. If that source provides voltages lower than Vcc, the effective
> ADC range is the 10 bits of values below that voltage. For example, if
> Aref = 2.5V, the unit resolution is 2.5/1024 (one bit below ~4.88mV)
> ~=2.44mV. If Aref = 1.25V, the unit resolution is ~1.22mV, etc.
>
> BasicX provides a mechanism to generate these reference voltages under
> program control, functions DACPin() and PutDAC(). The functions produce
> an 8-bit PWM burst on an output pin that will, properly treated, yield
> an analog voltage in the range 0 to 5.0*255/256V, or one-bit less than
> 5.0V. It is, then, possible to generate 5.0*128/256 = 2.5V, 5.0*64/256
> = 1.25V, and so forth, down to 5.0*1/256 ~.5mV. If Aref = 5.0*1/256,
> the theoretical unit resolution of the ADC will be 5.0*1/256/1024 ~=
> 19uV. That is an eight bit extension of the ADC's low-end range. A
> six-bit extension - yielding a convenient 16-bit value - will have a
> unit resolution of about 76uV. Such sensitivity will very likely be
> problematic due to noise, but slow signals might well be sampled
> successfully at 16 or 18 bits using this method.
>
> An iterative procedure could shift the reference voltage down until the
> ADC MSB is set - or six loops, whichever occurs first - providing 10
> bits of accuracy over a 16-bit range below 5.0 volts. > Tom >
> >. >
>

> ... ultimately the Vref for the A/D will be only as good as the 5v regulator?

Yes, that's true, but either it can be supplied from a better source to pin 21, or Aref can be supplied from an external source to pin 29.

It could be that this is more trouble than a proper external 16-bit ADC, but it's a thought. Tom

THe usual technique is to use some extra hardware. I do not
understand the technicalities. Something about precision band-gap.
I think it has something to do with the forward voltage drop of
diodes. That drop is a fixed value despite the working voltage.
This can then be referenced to ARef, with a little extra noise
filtering.

I would think that PWM signal would be just so choppy that getting
it clean enough would be more trouble than the recommended technique
by Atmel.

-Tony

--- In basicx@basi..., Tom Becker <gtbecker@r...> wrote:
> It seems to me that the 10-bit ADC range can be extended (without
> increasing the resolution, which remains 10 bits) by manipulating
Aref,
> the analog reference voltage on 8535 processor pin 29. Ultimately
> limited by noise, the low end of the BX-24's analog input range
can be
> extended another six, or even eight, bits pretty easily.
>
> Aref is normally tied to Vcc so, typically, Aref = 5.0V and the
> range is the 10 bits of values below 5.0V with a unit resolution
of
> 5.0/1024 ~= 4.88mV. By lifting pin 29, Aref can be supplied by
another
> source. If that source provides voltages lower than Vcc, the
effective
> ADC range is the 10 bits of values below that voltage. For
example, if
> Aref = 2.5V, the unit resolution is 2.5/1024 (one bit below
~4.88mV)
> ~=2.44mV. If Aref = 1.25V, the unit resolution is ~1.22mV, etc.
>
> BasicX provides a mechanism to generate these reference voltages
under
> program control, functions DACPin() and PutDAC(). The functions
produce
> an 8-bit PWM burst on an output pin that will, properly treated,
yield
> an analog voltage in the range 0 to 5.0*255/256V, or one-bit less
than
> 5.0V. It is, then, possible to generate 5.0*128/256 = 2.5V,
5.0*64/256
> = 1.25V, and so forth, down to 5.0*1/256 ~.5mV. If Aref =
5.0*1/256,
> the theoretical unit resolution of the ADC will be 5.0*1/256/1024
~=
> 19uV. That is an eight bit extension of the ADC's low-end range.
A
> six-bit extension - yielding a convenient 16-bit value - will have
a
> unit resolution of about 76uV. Such sensitivity will very likely
be
> problematic due to noise, but slow signals might well be sampled
> successfully at 16 or 18 bits using this method.
>
> An iterative procedure could shift the reference voltage down
until the
> ADC MSB is set - or six loops, whichever occurs first - providing
10
> bits of accuracy over a 16-bit range below 5.0 volts. > Tom

> ... I would think that PWM signal would be just so choppy...

Smoothing PWM to a virtual flat line is easy, Tony. It's just a
matter of RC and time. Take a look at raw DACPin() output with a
scope, then hang a long RC on the pin and look at the capacitor voltage. Tom

Well, in that case using a variable (and hopefully predictable) VRef
for the ADC by a PWM signal sounds like a great way to gain effective
resolution!

-Tony

--- In basicx@basi..., "Tom Becker" <gtbecker@r...> wrote:
>
> > ... I would think that PWM signal would be just so choppy...
>
> Smoothing PWM to a virtual flat line is easy, Tony. It's just a
> matter of RC and time. Take a look at raw DACPin() output with a
> scope, then hang a long RC on the pin and look at the capacitor
voltage.
>
>
> Tom

--- In basicx@basi..., "arhodes19044" <spamiam@c...> wrote:
> Well, in that case using a variable VRef for the ADC by a PWM signal
> sounds like a great way to gain effective resolution!

If the expected input range is 0 to 2.5 volts, you can also get better
resolution by using the internal 2.56 volt reference. As with using
the Aref input, you would need to manage the conversion manually using
CPU registers.

> ... using the internal 2.56 volt reference...

In the ATmega8535, yes. I don't see that facility in the AT90S8535. Tom