PDA

View Full Version : Expanded Scale Voltmeter



Pic_User
- 7th February 2008, 05:50
The Problem
There is a limit to the Voltage allowed on PIC’s A/D input pin.
Generally limited to the supply Voltage (Vdd) of the PIC.
This is fine till we come to the problem of measuring a voltage higher than the allowed maximum.

A Solution
A resistance Voltage divider reduces the higher Voltage to less than the 5V maximum allowed.
See this thread: Voltage monitor for car battery
http://www.picbasic.co.uk/forum/showthread.php?t=6809

This circuit works to protect, the A/D input pin, from over voltage but it also divides all of the Voltage by four. That is okay but with batteries we are generally most interested in some portion of voltage near the high end of the range.

To read specifically the range of voltage that is within the permissible range that will not harm the battery. Suppose we want to monitor a “12Volt” battery.
For our purposes we might need to keep the range from 10.0V to 15.0V.

If we use a “simple Voltage divider” (Figure A) this would divide by 3 to protect the PIC. So 0V to 15V would divide to 0V to 5V.

More Problems
0V to 5V with the 10 bit (1024) input would increment 0.00488V per step (resolution). However we divided the Voltage by 3 so the steps at the battery end become 0.0146V per step. This may be okay for a lot of applications. Some need better resolution.

More Problems
See this thread: Stable Adc Reading Routine
http://www.picbasic.co.uk/forum/showthread.php?p=50499

Consider that we don’t expect our battery Voltage to fall below 10V or it will be damaged chemically. Now we are not using the bottom two thirds of the remaining resolution. So we only use one third of the available resolution.

That’s right, first we divided by 3 to get rid of the “top end” then we ignored the “bottom” two thirds of what we had left.

We can make an “Expanded Scale Voltmeter”.
See this thread: ADC - 2 channels but not same voltage reference - how to?
http://www.picbasic.co.uk/forum/showthread.php?t=7578

If we could find a way to loose the 10V (Figure C) that we consider our low end reading, we would not need to “resistance Voltage divide” by three. Also we would not need to ignore the bottom two thirds of the reading. So the whole 1024 steps would be used by the Voltage of interest. This “expands” the span of Voltage expected, to fit the whole resolution.

More Solutions
Of course Figure C would be difficult to couple to a PIC because, the “low side Voltage is floating 10V above the Negative terminal of the battery. Figure D is the same circuit with the components moved to allow the PIC common (Vss) at the same potential as the Negative terminal of the measured battery.

This circuit is not ideal, battery Voltages very near and below the Zener Knee will not display correctly
The Voltage on the reference Zener will vary slightly. Zener current changes, between 10V and 15V battery Voltage, this will affect the clamping Voltage. There are other ways to generate the 10V to subtract from the larger voltage. The Zener method has worked for me and I though you guy might like to try it.
<IMG SRC="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2335&stc=1&d=1202359395">

Any thoughts or improvements on this topic?

-Adam-

Acetronics2
- 7th February 2008, 09:12
Hi, Adam

I Think zener thresold changes too much with temp ( slope depends on the zener voltage... )

a test with a TL 431 should give some usable results.

Now, it would be simpler to tell us what's you've in mind ... just thinking a lead acid ( or else !!! ) batt. voltage is a non-negligible function of the ambiant temp ... ( around 20 mv/°C and cell ... from oooooooold my memory )

Alain

Pic_User
- 7th February 2008, 16:04
Hi Alain,

I have a LM431A, in a solderless bread board, sitting on my workbench. I wanted to test the parameters at the span of interest. So far the stability of the 431 is impressive. It is configured as the standard shunt like the Zener in Figure B.
<IMG SRC="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2340&stc=1&d=1202396289">
Reading the specs on the device is one thing, but seeing it perform; priceless.

You are correct about both points, Zener temperature stability and battery voltage being dependant upon temperature. Hmmmm, I will have to check the coefficients of each to see if physically tying the Zener to the battery might compensate for each other. lol


Now, it would be simpler to tell us what's you've in mind ...
Mostly just thinking "out loud", and wanted to throw this in for discussion. Lead acid is a good place to start. Later, maybe measure for the “signature” of an end of charge for Nickel-Metal Hydride (NiMH) or similar cells.
I can’t help with the programming, so this is my way of helping the discussion that is so great on the forum.

Melanie said it in the other thread:

Trouble is I can guarantee your 5v reference probably isn't 5.0000v (and are you using 0.1% Resistors?) so we're splitting hairs about millivolt ADC tollerances anyway.

This sounds right to me, so it looks like we have to be careful not to overrun REAL world limitations chasing down the wrong path!

The software, averaging and/or weeding out aberrations is a great idea. I like the “bomb proofing“ technique brought up by Melanie.

Thoughts:
So, after we stabilize the Voltage device, do we want to probe (measure) the battery temperature? Put the temp into a program for correction?

Any other thoughts on the matter?

-Adam-

Acetronics2
- 7th February 2008, 20:41
Hi Alain,

Thoughts:
So, after we stabilize the Voltage device, do we want to probe (measure) the battery temperature? Put the temp into a program for correction?

Any other thoughts on the matter?

-Adam-

Hi, Adam

On this point ... you're a bit late !!!

http://www.rc-cam.com/forum/index.php?showtopic=2331&st=0

see posts 15 and 16 ...

for you, PbP source could be available !!!

But note voltage has not been corrected with drawn current ( in this use, quite constant ) ... another fun point to solve !!!

Alain

Pic_User
- 7th February 2008, 21:23
Hi Alain,

Looks like the temperature measurement while reading Voltage idea has already been put to use. By you!

I was not allowed to view the PDF you listed on the other forum.
After joining the forum was still unable to look at it.
I am interested in the pbp code and the PDF.

Are the batteries in those RC models high amps?

-Adam-

Acetronics2
- 8th February 2008, 10:11
Hi, Adam

The batteries in the models are supposed ( LOL !!! ) to be High Amp ... for the voltage not to "swing" too much when servos draw current.

That's why AA High cap. NiMh cells are NOT to use ( too high internal resistance )

You're right, we must register to download files at Mr CAM's ... some kind of courtesy !!!

For the files ... I think you got the scheme, I do not know why happend, but the Hex file is no more downloadable ( Forum doesnot bear .bas and .hex anymore !!! ) so, ... find the source here !!!

This program has been designed for low amp use ( Tx batt survey ), and the current is quite constant.

For Rx side ... things are much more complicated as current drawn can reach 2 or 3 amps for short periods, and the "quiescent" current is around 50 - 100 mA.

A not too false approach, is to move all plane control surfaces ON THE GROUND ... and see if buzzer ... buzzes ! ( current is then 1 - 1.5 Amp - so voltage has to be fixed for such current )
If it buzzes ... it means it's a good thing to charge batts ...


You'll find the Current / Voltage curves in the thread I gave you the address ... but those curves are for the Batts used in Txs ... ( 2000 - 2500 mAh LiPos )
You have to take YOUR BATT dedicated curve ...

Don't hesitate to Ask for any help ... the batt world is a Wild world !!!

Alain

Pic_User
- 8th February 2008, 21:32
Hi Alain,

I have been reading some of the stuff on the rc-cam.com forum. It is really interesting.
At first they wouldn’t allow the PDF down load, even though it congratulated me for joining. Then today, I tried and had no problem. Sooo, got the schematic and now got your code. Seems I can read PBP written in French, but the comments are a little fuzzy. :) Thanks for the files.

Reading the Voltage under high Amperage variations is a bit of a problem. My case let’s me stop the current and measure the Voltage. I will check the curves on the other forum and apply the principles to this project.

Probably good to check the batteries, on the GROUND, on a helicopter. We can imagine how well they fly without power!

The battery world IS a Wild world. The PIC world is a Fun world! I will be reading your information tonight. Thanks for the help.

-Adam-