Searching \ for '[PIC] measuring negative voltage with 16f877 ADC ?' 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=adc
Search entire site for: 'measuring negative voltage with 16f877 ADC ?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] measuring negative voltage with 16f877 ADC ?'
2005\01\25@182521 by Loper, Chris

flavicon
face
I've built a triple variable power supply with two 0...+21V outputs and
one 0...-21V outputs. I want to finish it with a dedicated triple
voltmeter,
using an 16f877 and a 2x40 character LCD.

I'll use a voltage divider to get each supply into the + or -5V range
and then multiply in software to get the actual value to display.
Just one problem - how to change the minus voltage to positive voltage,
so that I can measure all three sources using a single 16f877?
(Each 16f877 ADC input must be 0...+5V.)

I have a 7660 which converts positive voltage to negative nicely.
The minus output follows the positive input to within .01V.

But I couldn't find any part to do the reverse job (minus to positive).
If I were to reverse the inputs (connect the power supply Ground to the
7660 V+
and the power supply V- to the 7660 Ground), then the minus voltage
coming out
would be relative to the -V input, not the Ground.
(For example -4V in, results in -8V out with respect to the system
ground
which is also the 16f877 Ground.

I wish I could run it "backwards", but applying minus voltage to the
7660 V-
output did not produce positive voltage at the 7660 V+ input ;)

I think there must be a simple solution, but I'm just a beginner.
Any ideas would be appreciated.

  0...21V ---                        
             |
             \
             /                          
             \ (0...5V)
             |------------------------  
             /                        |
             \                       AN0
             |                       --------
  Gnd ------------------------------| 16f877 |-- +5V
             |                       --------
             \                       AN2
             /                        |
             |--------------------- ????? (magical - to + voltage
inverter)
             / (0...-5V)                  (using 7660 or ?)
             /
             \
             |
  0...-21V --



2005\01\25@184018 by Harold Hallikainen

face picon face
Tie the top end of your voltage divider to +5V instead of to ground. When
your supply is at -21V, you'll have 26V across the voltage divider.
Calculate the resistor between +5V and the PIC A/D when you have -21V on
the supply to give you 5V. When the supply goes to 0V, you'll have 5V -
5/26 V across the resistor between +5V and the A/D input. The full range
on the input to the voltage divider would be:

+5V = ADC Full Scale
-21V = ADC Zero

Do the rest in software!

Harold


{Quote hidden}

--
FCC Rules Updated Daily at http://www.hallikainen.com

2005\01\25@191002 by Rob Young

picon face
You have dual rails, just use an opamp connected in its inverting
configuration.  Shift and scale appropriately to match your ADCs input
range.

2005\01\25@212421 by Kenneth Lumia

picon face
This is OK, but it assumes that the power supply voltages ramp
up/down in such a way that the +5V rail is valid before and after
the -21V supply is turned on/off.  If not, you will have a
negative voltage on the pin, that will cause the protection
diodes to turn on and conduct into an unknown
impedance.  Depending on the design, you could even put a
negative bias on the 5V rail.  Be careful and think about the
transition states, especially concern yourself with loading
on the -21V line.

In a previous design, I used a LM358 op amp running
off of  +5 and ground to squeeze a +/-15v input into a
0 to 5V range output.  It added complexity, however
the input circuits of the LM358 can take the -15V and
not do anything bad, even if 5V isn't present (bipolar input
transistors were reverse biased).

Ken
spam_OUTklumiaTakeThisOuTspamadelphia.net

{Quote hidden}

2005\01\25@213803 by Bob Axtell

face picon face
You can't insert an optical isolator input into the -21V output? You'll
need to get a fairly linear output; if I recall the H11D1 is fairly
linear. Then calibrate the H11D1 and the A/D converter, and attach the
H11D1 to a pullup resistor and GND.

Pretty cheap design.

--Bob

Kenneth Lumia wrote:

{Quote hidden}

--
Note: To protect our network,
attachments must be sent to
attachspamKILLspamengineer.cotse.net .
1-866-263-5745 USA/Canada
http://beam.to/azengineer

2005\01\25@220800 by Kenneth Lumia

picon face
I like this, however I'm not sure he could get a usable output at a
very small negative voltage and yet not saturate the output at the
worst case -21V.  The opto would need to be carefully biased to
make sure the diode is actually on at a very small neg voltage.
As you stated, reasonably linear is fine; a simple lookup and
interpolation would do the software job.  Multiple units
would, however, need their own calibrations and perhaps
modification to the diode bias resistance.

Ken
.....klumiaKILLspamspam.....adelphia.net

From: "Bob Axtell" <EraseMEengineerspam_OUTspamTakeThisOuTcotse.net>
To: "Microcontroller discussion list - Public." <piclistspamspam_OUTmit.edu>
Sent: Tuesday, January 25, 2005 9:37 PM
Subject: Re: [PIC] measuring negative voltage with 16f877 ADC ?


> You can't insert an optical isolator input into the -21V output? You'll
> need to get a fairly linear output; if I recall the H11D1 is fairly
> linear. Then calibrate the H11D1 and the A/D converter, and attach the
> H11D1 to a pullup resistor and GND.
>
> Pretty cheap design.
>
> --Bob


2005\01\25@225015 by Bob Axtell

face picon face
I am sure you could arrange a resistor bridge or something to affect the
range.

Its the only simple idea I have.

--Bob

Kenneth Lumia wrote:

{Quote hidden}

--
Note: To protect our network,
attachments must be sent to
spamBeGoneattachspamBeGonespamengineer.cotse.net .
1-866-263-5745 USA/Canada
http://beam.to/azengineer

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