battery monitoring with opto-isolators

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Re: battery monitoring with opto-isolators

Post by MrAl »

Hi again Ron,


Oh ok, that sounds very good. I'd like to see the data.
If you feel like it, at say 6v and 12v inputs you could vary the temperature by heating up
the opto package and see how much the output voltage changes. You could use
a soldering iron to heat up the package a little or better yet encase the whole circuit
inside an inverted cardboard box with a 100 watt light bulb inside for some heating,
measuring the temperature inside the box close to the circuit. A temperature rise
of 10 degrees C would be nice, or even 20 degrees C. We probably dont need to
see a huge rise so dont worry about the box catching fire. If you have a variac
on hand you can adjust the bulb current to get the right temperature inside the box.
BTW the box will take up to 100 deg C inside without a problem.
If the temp doesnt get up high enough with the bulb maybe two or more bulbs or
else a small electric coil heater.
Probably shouldnt let the light shine directly on the circuit in case anything is
light sensitive, but i dont think the opto package will be so.
LEDs vs Bulbs, LEDs are winning.
reloadron
Posts: 519
Joined: Sat Jun 28, 2008 8:57 am
Location: Cleveland, Ohio
Contact:

Re: battery monitoring with opto-isolators

Post by reloadron »

Moving along to the numbers:

Volts(Applied)...........Output (Volts).............Diode Current(mA)
14.0........................41.48mV....................6.33mA
13.5........................41.40mV....................6.08mA
13.0........................41.34mV....................5.83mA
12.5........................41.26mV....................5.59mA
12.0........................41.20mV....................5.34mA
11.5........................41.15mv....................5.09mA
11.0........................41.13mV....................4.84mA
10.5........................41.13mV....................4.59mA
10.0........................41.15mV....................4.34mA
9.5..........................41.21mV....................4.09mA
9.0..........................41.31mV....................3.84mA
8.5..........................41.46mV....................3.59mA
8.0..........................41.67mV....................3.35mA
7.5..........................41.95mV....................3.10mA

This is all relatively doing nothing as far as Eout. From 14 Volts down to 7.5 not much going on. Nothing going on in the voltage applied ranges we would care about. I dropped to 5.0 Volts applied:

5.0...........................45.53mV....................1.86mA

Now I get down to 2.0 Volts applied:

2.0............................89.50mV....................0.38mA
1.9............................98.15mV....................0.33mA
1.8............................110.64mV...................0.29mA
1.7............................131.69mV...................0.24mA
1.6............................210.1mV.....................0.19mA (Stable input and stable current but Eout gets erratic +/- 1 mV)
1.55..........................878.9mV.....................0.17mA
1.50..........................1.732 Volt...................0.15mA
1.45..........................2.541 Volt...................0.13mA (At this point Eout is +/- 10 mV getting more unstable)
1.40..........................3.279 Volt...................0.11mA
1.35..........................3.885 Volt...................0.09mA
1.30..........................4.352 Volt...................0.07mA
1.25..........................4.679 Volt...................0.05mA
1.20..........................4.868 Volt...................0.03mA
1.15..........................4.952 Volt...................0.02mA
1.10..........................4.977 Volt...................0.01mA
1.05..........................4.981 Volt...................0.00mA (That's about it as Eout is as good as it gets)

Interesting as when we are actually doing something with a stable (very stable) voltage applied to the diode and a stable current flow the Eout gets erratic. Maybe just the nature of the beast. I was seeing numbers with +/- 10 mV bouncing around.

Ron
reloadron
Posts: 519
Joined: Sat Jun 28, 2008 8:57 am
Location: Cleveland, Ohio
Contact:

Re: battery monitoring with opto-isolators

Post by reloadron »

Now that was funny Mr. Al. As you were posting I was trying to arrange all those numbers. I did also try changing the values of R1 & R2 but it seems to only really want to work in those very low voltage ranges (applied voltage). I figure that is a result of the decreasing current once things actually begin to happen? I would figure the range of concern would be maybe in the 10 to 14 Volt range for 12 Volt batteries.

Ron
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Re: battery monitoring with opto-isolators

Post by MrAl »

Hello again,


For those numbers the opto would have to have a CTR of about 600 percent.
The data sheet says 500 min so that is typical.
This is much higher than the cheap opto's i considered previously.

You can try a single 33k resistor for R1 and short R2 (only need one resistor
on the input side).
I guess a good adjust point before starting the numbers would be to adjust
for 1v out at 14v input.

If a 33k resistor doesnt work you may have to go with a different opto.
You can also reduce gain a bit by using a base resistor like 5k to 10k.
That would be from pin 7 to ground.
LEDs vs Bulbs, LEDs are winning.
reloadron
Posts: 519
Joined: Sat Jun 28, 2008 8:57 am
Location: Cleveland, Ohio
Contact:

Re: battery monitoring with opto-isolators

Post by reloadron »

I'll likely get more into it next week unless I have time tomorrow. Much as I love seeing the grand daughter I wish I would have time time this weekend to start on the uC kit sitting here.

Ron
User avatar
kheston
Posts: 354
Joined: Wed Dec 03, 2003 1:01 am
Location: CA
Contact:

Re: battery monitoring with opto-isolators

Post by kheston »

I was reading through the latest issue of Circuit Cellar last night and came upon the LTC6802. It can monitor up to 12 series-connected batteries and can be daisy-chained to monitor even more. Alas, in poking around the Linear site I couldn't find a lead-acid version, only for Li-Ion. Oh well. Back to the one I was working on...

I am also having a problem with uneven charging. I'm looking at beefing up something like this to deal with it:
http://axiom.anu.edu.au/~luke/xr4000batbal.html
Kurt - SF Bay
User avatar
kheston
Posts: 354
Joined: Wed Dec 03, 2003 1:01 am
Location: CA
Contact:

Re: battery monitoring with opto-isolators

Post by kheston »

I'm still working on this one as I have time...

My PIC 12f683 has 10-bit ADC resolution. I want to measure 9-18v. Right now, I'm using an R1=1M, R2=330K voltage divider. So, 9v = ~2.23v and 18v = ~4.47v. Can I use an op-amp or something to make a 9-18v range look something more like 0-5v to the PIC?

I was thinking I could also use 2 of the ADC inputs with two voltage dividers (and a zener for the low one) to get the full range. I'm thinking, however, there must be a better way, I'm just Googling on the wrong keywords.
Kurt - SF Bay
Robert Reed
Posts: 2277
Joined: Wed Nov 24, 2004 1:01 am
Location: ASHTABULA,OHIO
Contact:

Re: battery monitoring with opto-isolators

Post by Robert Reed »

Definately Op-Amps
with proper attenuation, scaling and offset you can make your voltage range almost anything you want.
User avatar
kheston
Posts: 354
Joined: Wed Dec 03, 2003 1:01 am
Location: CA
Contact:

Re: battery monitoring with opto-isolators

Post by kheston »

I found this TI app note:

http://focus.ti.com/lit/an/slyt173/slyt173.pdf

that seems to explain things well. I'm Googling for more examples as I write this...
Kurt - SF Bay
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Re: battery monitoring with opto-isolators

Post by MrAl »

Hi,


Too bad i could not reach that web site on TI just yet they must be having a problem so ill try again
later.

I just wanted to comment on the op amp, which would be a good idea as Robert says, but there
is another thing to think about that might help eliminate that component...

Using an op amp you can change the range 9 to 18 to 0 to 5v yes, but then again if you set
up the A to D converter to read 0v to 20v (which includes 9 to 18v of course, plus a little
headroom) the resolution with a 10 bit AD would still be 20mv, meaning you could measure *ALL*
the voltages between 0 and 20v and still be within 20mv at any time.
For example, a 10 bit AD has 1024 steps, so that means that each step up to 20v is worth
0.0195v using a simple voltage 4:1 voltage divider (30k and 10k resistors on AD input).
This means 10v reads as close to and AD count of 512, and 10.0195 (close to 10.02v) reads
a count of 513. Around 12v we get a count of about 614, and one more count 615 would be
12.0195v, so it's easy to see that the resolution is certainly far better than we really need for
lead acid batteries even without using an op amp. The AD input usually needs a 10k lower
resistor to keep the DC offset bias of the internal AD input happy, so the upper resistor would
need to be 30k in order to get the correct divide ratio. This combo of resistors also means
a very light load current on the battery...at 14v it's only about 350ua, which is very good.
Thus, a 30k and 10k resistor should get you there and then you can measure 0 to 20v no problem.

The algorithm can convert to volts, or simpler yet is to convert the count to volts during the
design of the program and compare counts directly rather than have to convert to volts first.
Thus, if you are looking for 12v, instead of converting 512 to 12.0 first simply look for 512
and that saves code space as well as makes the algorithm simpler.
LEDs vs Bulbs, LEDs are winning.
User avatar
kheston
Posts: 354
Joined: Wed Dec 03, 2003 1:01 am
Location: CA
Contact:

Re: battery monitoring with opto-isolators

Post by kheston »

MrAl,

Again, you've exposed my ignorance. I thought I couldn't go over Vcc on any pin, including ones I've set up to be ADCs. Are you saying I merely need a current limiting resistor and I can read 0-20v on a pin of my 12F683? If so, that's the ticket! If not, what have I missed?

BTW - The extra-code part doesn't worry me, it's using the wrong analog circuit that does.
Kurt - SF Bay
reloadron
Posts: 519
Joined: Sat Jun 28, 2008 8:57 am
Location: Cleveland, Ohio
Contact:

Re: battery monitoring with opto-isolators

Post by reloadron »

I believe what MrAl is telling you is that you have an A to D maximum input of 5 Volts. Therefore if you want a 0 to 20 Volt input to be read you can configure a voltage divider:
The AD input usually needs a 10k lower
resistor to keep the DC offset bias of the internal AD input happy, so the upper resistor would
need to be 30k in order to get the correct divide ratio. This combo of resistors also means
a very light load current on the battery...at 14v it's only about 350ua, which is very good.
Thus, a 30k and 10k resistor should get you there and then you can measure 0 to 20v no problem.
Using a 30k and 10k resistor for your divider would give you a 4:1 ratio. If you apply 20 Volts accross the 30k and 10k in series and measure accross the 10k you should see 5 volts. Therefore an input to the divider of 0 to 20 volts will output from the divider 0 to 5 volts. Therefore as to your chip an input of 0 to 20 volts will yield 0 to 1024 counts.

The remainder of the work is done in your code.

Ron
User avatar
kheston
Posts: 354
Joined: Wed Dec 03, 2003 1:01 am
Location: CA
Contact:

Re: battery monitoring with opto-isolators

Post by kheston »

10k/(10k+30k) = 0.25!

This would work for both 6v and 12v LA batteries with no circuit changes. Nice!

...I don't usually try to over-complicate things.
Kurt - SF Bay
Robert Reed
Posts: 2277
Joined: Wed Nov 24, 2004 1:01 am
Location: ASHTABULA,OHIO
Contact:

Re: battery monitoring with opto-isolators

Post by Robert Reed »

Kheston
"I found this TI app note:

http://focus.ti.com/lit/an/slyt173/slyt173.pdf

that seems to explain things well. I'm Googling for more examples as I write this..."

That was an excerpt from Ron Mancinis book- OP-AMPS FOR EVERYONE. Google that up and you can download his whole book free of charge. And I may add- a very informative book indeed!
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Re: battery monitoring with opto-isolators

Post by MrAl »

Hi again,


Here is the simple circuit i was talking about:

Code: Select all



Battery  o----R1------+-----o AD input
                      |
                      R2
                      |
    GND  o------------+-----o GND


    R1=30k
    R2=10k



Note that R2 is 10k, as going higher than that does not meet the DC drift spec required
for most PIC chips. The spec requires that the parallel combo of R1 and R2 (often
approximated by taking R2 alone) and the leakage current do not produce a voltage
greater than 1/2 bit. At 5v, 1/2 bit is roughly 2.5mv, and the leakage for many PICs
is 1ua, so this would lead to a resistor who's value is 2.5k, but that's for the full
temperature range too and 10k works good enough for most applications. If you are
really worried about temperature drift though, use R1=10k and R2=3.3k and that
will take care of it. The load on the battery will increase to about 1ma which still
isnt that significant for large Lead Acid batteries.

Oh yeah, you gotta let us know how this all works out once you get it up and running :smile:
LEDs vs Bulbs, LEDs are winning.
Post Reply

Who is online

Users browsing this forum: No registered users and 96 guests