measuring voltage with PIC

V

Victor Nowecki

Guest
Hello
Im looking for a schematic on how to monitor a battery voltage using a
PIC16F871
which is connected to a LCD.

Battery is NiCad 12vdc.
Software I can get organised.

Many thanks
Victor
 
You simply need a voltage divider to scale the battery voltage to
whatever the PIC is running. If it's on 3.3V (for example), then taking
roughly 1/4 of the battery voltage would suffice (although a nominal
12V battery may well be somewhat above that).

A typical solution (to account for a battery of up to 14V) might be a
divider of 33K and 10K (33K connects to battery, 10K connects to 33K
and other end of 10K to ground, take the junction point to the A-D
input).

This yields a division ration of 4.3:1 for ADC readings (i.e. 12V on
the battery will give 2.79V at the ADC input).

Simply scale the data from the ADC accordingly.

All PIC ADC inputs have cautionary notes on their input impedance. In
this case, the input impedance would be roughly 7.7k from the divider
pair, assuming a small output impednace from the battery. You could put
a small cap (0.1uF) across the 10k, but this will increase the sample
switch required time. If you aren't worried about incredibly fast
conversions, that's no real issue.

Cheers

PeteS
 
victor
maybe this link might help
http://csold.cs.ucr.edu/content/esd/labs/a2d/a2d.html

Larry Keegan
 
PeteS wrote:
You simply need a voltage divider to scale the battery voltage to
whatever the PIC is running. If it's on 3.3V (for example), then taking
roughly 1/4 of the battery voltage would suffice (although a nominal
12V battery may well be somewhat above that).

A typical solution (to account for a battery of up to 14V) might be a
divider of 33K and 10K (33K connects to battery, 10K connects to 33K
and other end of 10K to ground, take the junction point to the A-D
input).

This yields a division ration of 4.3:1 for ADC readings (i.e. 12V on
the battery will give 2.79V at the ADC input).

Simply scale the data from the ADC accordingly.

All PIC ADC inputs have cautionary notes on their input impedance. In
this case, the input impedance would be roughly 7.7k from the divider
pair, assuming a small output impednace from the battery. You could put
a small cap (0.1uF) across the 10k, but this will increase the sample
switch required time. If you aren't worried about incredibly fast
conversions, that's no real issue.

Cheers

PeteS

One of my early circuit designs featured a battery voltage monitor going
to the uP. Of course I went _straight_ to the uP from the _battery_,
instead of that switch...

The uP kept trying to run from the current that was finding its way from
the battery voltage divider to VCC.

So pay attention to which side of the power switch you put things...

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
 

Welcome to EDABoard.com

Sponsor

Back
Top