Other ways to monitor battery voltage

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a solar panel charged battery device I had boards made for and I now need to monitor the battery for low voltage so I can shut down the processor.

The battery is 4v the panel can only produce 4.5V so there is no regulation, the mega48v can run it down to 1.8V, not a good idea.

So, I had 4 extra pins I ran traces too in case I needed them, and no one is not an ADC. They are pins 11,12,13 and 5.

My thought is to put a resistor from 11 to 12 and another resistor from 12 to 13. Then jumper a wire from ADC5 (pin28) to 12 to get a voltage reading using the 1.1V internal reference like I do for the solar panel voltage reading. Pin 12 will stay tristate as I am just using the hole in the board and not the pin. Pin 11 will go high and pin 13 will go low and then I will read the ADC.

The brow-out levels selectable are 1.8 , 2.7 and 4.3 and I want to shut down at 3.5V

Is there a different way to do this with what I have on the board to modify the circuit board in some way that would be easier than the one I described above. The 4 open holes are big enough to get three 1/6th watt resistor wires in so it should not be much of a problem.

By the way I went with the .125 mA regular fuse on the positive side of the battery terminal wire and a reverse diode across the battery terminals on the board to protect reverse battery hookup instead of the resettable fuse because without the holes in the board it just got too messy.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A Sealed Lead Acid, so I can see the voltage drop. Actually the customer wants to use the Cyclon dual 4V cell pack.

The solar panel is the spark fun small panel they sell for about $11.00 Description from their site:

Quote:
Description: Packaged solar cell with barrel plug termination. This is a custom cell produced for SFE - not a small toy surplus item! This unit is rated for 4.5V open voltage and 100mA short circuit. We actually took a random unit outside and measured 4.95V open voltage and 94mA short circuit.

My original battery suggested for the unit was a toyo 2FM4.5 (4VOLT 4.5ah/20hr) SEALED RECHARGABLE BATTERY.
It shows a 4.8 to 5V charge rate for cycle use.

I am still not sure how deep I should allow the battery to drop. The unit runs at 37mA maximum and goes to sleep when solar energy is on the panel drawing 1/2 mA maximum. The problem though is many days of no sun drawing the battery too low. I designed this during the winter so being so cold out I neglected to do much hands on testing of charge cycles. We can make new boards but the original 50 we have from a prototype run I would like to use with the modifications to read the battery voltage for shutdown. The next version I will incorporate regulation as well as overcharge and solar shut down so a larger panel could be used but this panel I figured did not need to shut off the solar as it can't overcharge the battery.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You have the analog comparator pins at 12 and 13. You can connect AIN0 to the internal bandgap reference voltage, and compare with Vcc (brought down by a resistor divider). I could not, however, find in the comparator's section of the datasheet, nor in the "Internal Voltage Reference", what's the voltage value; but I'm sure you'll find it. On a tiny26, this voltage is 1.18V, which would be just good for this application.
Then just monitor the comparator's output. You'll have to filter it, because near the transition point you'll have random toggling.

Embedded Dreams
One day, knowledge will replace money.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes it is 1.0 min 1.1 typ and max 1.2 in the chart on page 50.

I will connect 2 resistors from 11, and 5 to AIN1 pull pin 11 low and pin 5 high, test the ACO bit. Not enough time this morning to see if I can use the rising edge interrupt on this to wake from sleep I am guessing I can though.

Thanks a ton, this makes it very simple.

Now I just have to read up on the cyclon batteries depth of discharge to find the set point.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

metron9 wrote:
Yes it is 1.0 min 1.1 typ and max 1.2 in the chart on page 50.

I will connect 2 resistors from 11, and 5 to AIN1 pull pin 11 low and pin 5 high, test the ACO bit. Not enough time this morning to see if I can use the rising edge interrupt on this to wake from sleep I am guessing I can though.


I think you should poll ACO, because near the transition point you can have lot's of interrupts. You can even have interrupts just because something was turned on and Vcc has a negative little spike. You should at least filter ACO, let's say by voting: take some samples spaced in time and act accordingly to the majority. But just start with a simple test; then you'll see the behaviour and adjust accordingly.

Embedded Dreams
One day, knowledge will replace money.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sounds like a lot of work to just sense voltage. Why not try a higher power silicon diode in series with VCC to your chip. That will scale the VCC down by 0.7V so when VCC is down to 3.5V the VCC pin will start to read 2.8V. That's pretty close to the 2.7V BOD level. Hey, just an idea to save you some extra coding, as implementation would be really simple after you find the adequate part. Good luck.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

NuNo, thanks for the reply. IWhen I read the solar voltage I turn off at 1/4V and then raise the on/off target to 1/3V so I do add hysterisis. The battery I think I will turn off at 3.5 (the cyclon 1.75V maximum discharge per 2V cell) and not turn on until it reaches 4V again. The unit may not go on after a few days of bad weather/rain fog and such but the batteries need a full recharge to get good charge/discharge cycles.

glip456, That may work, I would have to cut the trace though to the vcc on the chip though. I will use the programming method because that way I also can monitor the battery maximum charge as well. I don't have a disconnect for the solar charger under processor control I do though have 2 holes I am using a jumper for now that was for a reverse diode on the ground trace for the solar panel, I could put a fet in there and drill a hole for the gate and connect that to the unused comparator+ pin so pulling it low would disconnect the solar panel.

I do have a .125A fuse so in the event of a runaway charge it would blow.

Somehow i really enjoy programming the complex algorithms the device uses in operation but I don't like the work it takes to make all the "simple" stuff work. I think I would be better in a project where i do specific programming tasks instead of the start to finish everything included design and build but I am learning quite a bit and today is no exception. Thanks to all of you for the help.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have the comparator working now for low voltage indication.

Can I use the comparator positive pin AIN0 as a source to increase the voltage divider setpoint? I have AIN0 connected to the internal 1.1 reference.

Right now I use 3 pins to power and sink the divider like this

LOWPIN---(470ohm)----AIN1-----1k-----(high pin)

I am measuring the battery voltage through the mega48s pin so I can turn it on and off, battery is connected directly to uC.

By adding another resistor from AIN1 to AIN0 and making AIN0 high I can increase the voltage threshold from 3.5V to 3.9V and wait for the battery to recharge to that point before turning the syatem back on.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

metron9 wrote:
Can I use the comparator positive pin AIN0 as a source to increase the voltage divider setpoint? I have AIN0 connected to the internal 1.1 reference.

I really don't know... the diagrams in the datasheet don't seem to say no, but on the other hand, it says that pin-change-interrupt doesn't work when the anacomp is enabled, so there may be some more "connections" not shown. You'll have to try...

metron9 wrote:
Right now I use 3 pins to power and sink the divider like this

LOWPIN---(470ohm)----AIN1-----1k-----(high pin)
(...)


If I understand correctly, you want to be able to check Vcc for 2 different voltages, using a "2 positions pot" for the divider's top resistor. Why do you need to disconnect both Vcc and Gnd? If you disconnect only 1, you should "gain" 1 pin and use it to control the 3rd resistor (by the way, you should use higher value resistors if you need to conserve power).

Embedded Dreams
One day, knowledge will replace money.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, you understand correctly.

Only because I have the boards made and those pins are open spots ,I could as you say use a jumper to VCC. I am only checking once per 30 seconds for 5mS so 6000 hours would use .0025 AH. I just dont have higher resistors in 1/6 watt that I an use to get 1.1V from 3.5V

That brings up a question though, how much current should one shoot for when using the ADC or comparator, I suppose it depends on the wire length and amount of speed you are working with.

I will go ahead and give it a test and see what happens though.

Once these first 48 boards are gone I will have a new batch with all the corrections made. i will switch some of the ADC pins with the other pins so I can use them instead.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

metron9 wrote:
(...) Only because I have the boards made and those pins are open spots ,I could as you say use a jumper to VCC. I am only checking once per 30 seconds for 5mS so 6000 hours would use .0025 AH. I just dont have higher resistors in 1/6 watt that I an use to get 1.1V from 3.5V

Ok, I see.

metron9 wrote:
That brings up a question though, how much current should one shoot for when using the ADC or comparator, I suppose it depends on the wire length and amount of speed you are working with.

If the datasheet doesn't have any information on that, you have to do your own tests. The anacomp should draw a constant amount just by being ON (and it usually is ON by default), because of biasing; then it will consume a bit more during output transitions.
The ADC probably only consumes when the clock is applied, and specially during conversions (of course :)).

Good luck :)

Embedded Dreams
One day, knowledge will replace money.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I got the whole thing working great now. I changed some code and dropped the 8MHZ to 1mhz using the divide by 8 fuse. Now it runs the 16 LEDS in the pattern plus two red leds at 50% pulse rate with a total draw of 24mA. When no solar energy or low battery it draws 0.14mA I added blinking the two center leds once per second for 10mS to indicate low battery.

Thanks for the help.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Great! Maybe you can post some photos of your project :)

Embedded Dreams
One day, knowledge will replace money.