Searching \ for '[PIC]: Better to offset & scale analog input or se' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=analog
Search entire site for: 'Better to offset & scale analog input or se'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Better to offset & scale analog input or se'
2002\01\23@030526 by Rick Mann

flavicon
face
I'm using a PIC 16F877 to sense temperature using an LM335. Since the output
voltage range of the sensor is about 0.5 V, somewhere between 2 & 3 V, I
need to either a) offset and scale the sensor's output, or b) set
appropriate Vref+ and Vref- voltages, probably using two (different) zener
voltage refs. I prefer the latter option, if it can work, because it seems
to use cheaper parts.

I'd like people's feedback on the two methods, and why one might be better
than another.

And, if you don't mind, can you CC me on the reply, as I don't get the
digest but once per day.

TIA,

--
Rick

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\01\23@082232 by Dave Dilatush

picon face
Rick Mann <spam_OUTrmannTakeThisOuTspamLATENCYZERO.COM> wrote...

>I'm using a PIC 16F877 to sense temperature using an LM335. Since the output
>voltage range of the sensor is about 0.5 V, somewhere between 2 & 3 V, I
>need to either a) offset and scale the sensor's output, or b) set
>appropriate Vref+ and Vref- voltages, probably using two (different) zener
>voltage refs. I prefer the latter option, if it can work, because it seems
>to use cheaper parts.

You'd be much better off using a large Vref (such as a well-regulated 5V
supply) and offsetting/scaling the sensor's output with an opamp so that
the temperature range of interest produces a 0 - 5 volt output.  This
will minimize conversion noise and other errors.  The PIC A/D converter
doesn't do well with small reference voltages.

Also, unless I'm mistaken, I don't think you can offset the PICs analog
input range by using an elevated Vref- voltage (the Vref- pin is there
so it can be connected to a "quiet" analog ground, as I understand it).

In other words, I believe the PIC A/D converter's transfer function is

0...1023 = Vin / (Vref+ - Vref-) , not
0...1023 = (Vin - Vref-) / (Vref+ - Vref-) .
In any case, zener diodes are really crappy references; they're
inaccurate and they drift with temperature.

>I'd like people's feedback on the two methods, and why one might be better
>than another.
>
>And, if you don't mind, can you CC me on the reply, as I don't get the
>digest but once per day.

Done.

Hope this helps...

Dave Dilatush

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\01\24@072416 by Vasile Surducan

flavicon
face
On Wed, 23 Jan 2002, Dave Dilatush wrote:

> You'd be much better off using a large Vref (such as a well-regulated 5V
> supply) and offsetting/scaling the sensor's output with an opamp so that
> the temperature range of interest produces a 0 - 5 volt output.  This
> will minimize conversion noise and other errors.  The PIC A/D converter
> doesn't do well with small reference voltages.

Oh, yes it does. Depends at how small you are thinking at, the safe
interval for references are:
0 < |-Vref| < +2.5V and
+2.5V < +Vref < +5V
The maximum adc gain  without resolution loss is obtained for
|+Vref| - |-Vref| = 2.5V...3V

So, an 1.5...2V input swing, riding on a constant DC of about 2V is
perfect for the  PIC AD.


>
> Also, unless I'm mistaken, I don't think you can offset the PICs analog
> input range by using an elevated Vref- voltage (the Vref- pin is there
> so it can be connected to a "quiet" analog ground, as I understand it).
>
 You wrong here, any reference with small output impedance is quiet
exactly like an analogic ground. ( sometime better because of PSRR )
Vref- can be set from -0.5V to +2.5V very well.

Vasile

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\01\24@172932 by Dave Dilatush

picon face
Vasile Surducan wrote...

>On Wed, 23 Jan 2002, Dave Dilatush wrote:
>
>> You'd be much better off using a large Vref (such as a well-regulated 5V
>> supply) and offsetting/scaling the sensor's output with an opamp so that
>> the temperature range of interest produces a 0 - 5 volt output.  This
>> will minimize conversion noise and other errors.  The PIC A/D converter
>> doesn't do well with small reference voltages.
>
>Oh, yes it does. Depends at how small you are thinking at, the safe
>interval for references are:
>0 < |-Vref| < +2.5V and
>+2.5V < +Vref < +5V
>The maximum adc gain  without resolution loss is obtained for
> |+Vref| - |-Vref| = 2.5V...3V
>
>So, an 1.5...2V input swing, riding on a constant DC of about 2V is
>perfect for the  PIC AD.

My remark that the PIC A/D converter "doesn't do well with small
reference voltages" was in response to the OP's statement that he wanted
to achieve a total analog input span of about 500 millivolts.

The PIC16F87x data sheet states (Table 15-12, parameter A20) that to
ensure full 10-bit accuracy of the A/D converter, (Vref+ - Vref-) must
be at least 2.0 volts.  But a 500 millivolt span would be only a quarter
of that recommended minimum input span; hence my comment.

Dave

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\01\24@182423 by Bob Ammerman
picon face
You CAN offset the range the PIC A/D by increasing Vref-, however, you must
remain a minimum value for (Vref+) - (Vref-) to get full accuracy from the
converter.

The correct transfer function is indeed  0...1023 = (Vin - Vref-) / (Vref+ -
Vref-) .

It is a good idea to make sure that both Vref- and Vref+ are well decoupled
and 'clean'.

Bob Ammerman
RAm Systems


{Original Message removed}

2002\01\24@194805 by Dave Dilatush

picon face
Bob Ammerman wrote...

>You CAN offset the range the PIC A/D by increasing Vref-, however, you must
>remain a minimum value for (Vref+) - (Vref-) to get full accuracy from the
>converter.
>
>The correct transfer function is indeed  0...1023 = (Vin - Vref-) / (Vref+ -
>Vref-) .
>
>It is a good idea to make sure that both Vref- and Vref+ are well decoupled
>and 'clean'.

Wow, that's pretty interesting; that would allow the Vref- pin on the
PIC16F877 to work along with an analog input pin to form a fully
differential input (assuming, of course, that you can rig up a floating
voltage reference between Vref- and Vref+).  If so, that's a pretty neat
feature.  Wonder why Microchip doesn't advertise it?

I'm going to go do a little testing...

Dave

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\01\24@213432 by Bob Ammerman

picon face
No, that won't work because as Vref- moves up and down the total range will
change and thus the scaling), not just the relative value between the AI and
the Vref- value.

Bob Ammerman
RAm Systems

{Original Message removed}

2002\01\25@040128 by Vasile Surducan

flavicon
face
No one said than you can't keep the Vref- to ground and apply the variable
to Vref+ and one analogic input. The ADC gain ( and output )  will be
proportional with the diferential inputs as you choose.
But it's not working only above some DC limits and only one AD input may
be used, however sometime may be usefull.
There are many tings that aren't written in Microchip data sheet, but are
treated well in AD methods theory.

regards, Vasile

On Thu, 24 Jan 2002, Bob Ammerman wrote:

> No, that won't work because as Vref- moves up and down the total range will
> change and thus the scaling), not just the relative value between the AI and
> the Vref- value.
>
> Bob Ammerman
> RAm Systems
>
> {Original Message removed}


'[PIC]: Better to offset & scale analog input or se'
2002\02\02@232029 by Mark Newland
flavicon
face
The best way (space permitting) would be to use an op-amp with a gain of 10 with
the proper offset on the op-amps input.  You could configure the op-amp so that
a voltage of 2.0V to 2.5 volts on the input will give you 0.0V to 5.0V on the
output.  This would allow for the maximum resolution within your 0.5V range.
This is assuming you need/want the extra resolution.

Rick Mann wrote:

{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...