Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: Sylvestre on September 03, 2011, 04:29:23 PM

Title: IC That Will Indicate When I Have Low Battery
Post by: Sylvestre on September 03, 2011, 04:29:23 PM
Hey guys,

Im looking for an IC that will send serial data to my pc indicating when my battery is low.  Im using an axon ii and a sealed lead acid battery.  Any suggestions are appreciated.
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: garrettg84 on September 03, 2011, 08:19:59 PM
You could do that with one of the A/D converters on the axon itself and a voltage divider setup (set of two resistors) depending on your battery max voltage....

http://www.arduino.cc/playground/Main/AOneLedVoltmeter (http://www.arduino.cc/playground/Main/AOneLedVoltmeter)
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Soeren on September 03, 2011, 09:33:27 PM
Hi,

Im looking for an IC that will send serial data to my pc indicating when my battery is low.  Im using an axon ii and a sealed lead acid battery.  Any suggestions are appreciated.
The only time a voltage reading of a lead-acid battery will tell you its state of charge (SOC), is when it has been left at rest (i.e. with no charge or discharge going on) for at least 4..8 hours.
That means you have to use something like sampling at periodic (short) intervals to get the SOC, or at least an indication of its approximation.

But... Since you are unlikely to use even half the Axons resources, why by extra chips - you have ample processing power idling around?
Just use either one of the comparators, or if you want to have graded alerts, use one of the A/D-C's.
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Afroman on September 04, 2011, 11:29:31 AM
This is a good place to start ;)
http://www.societyofrobots.com/schematics_batterymonitor.shtml (http://www.societyofrobots.com/schematics_batterymonitor.shtml)
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Sylvestre on September 05, 2011, 06:17:06 PM
I am just looking for someway to let me know when I have approximately ten minutes left of charge.  How would I use one of the analog to digital converters?  This is my first experience with the Axon II so as you can tell I am a bit newbie.  Would I just set up a voltage divider circuit and connect it to the ADC pins?  Also, I am not sure how I would program/ configure it?
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Soeren on September 05, 2011, 06:34:21 PM
Hi,

I am just looking for someway to let me know when I have approximately ten minutes left of charge. 
You cannot make a precise estimate working for any battery, but running down your specific battery 3..4 times while measuring should net you an average voltage (depends on instantaneous current draw when measuring) that it will have 10 minutes prior to running flat - assuming you have the same current draw in normal use.
Any variance on the current draw will obviously show up in the (lack of) precision.


How would I use one of the analog to digital converters?  This is my first experience with the Axon II so as you can tell I am a bit newbie.  Would I just set up a voltage divider circuit and connect it to the ADC pins?  Also, I am not sure how I would program/ configure it?
This site should hold ample tutorials and examples and reading the datasheet on the controller is a must too, so you have a lot of reading to do.
Yes, you would need a voltage divider to get the voltage within the 0..5V range. Setup can be found in the atasheet and you can find many examples (this site and on the web in general).
Did I mention that building robots takes a lot of reading?   :)
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: rbtying on September 05, 2011, 08:28:16 PM
If you don't already know how to send data through UART to a computer (via an RS-232 port or a USB-TTL serial converter), now's the time to look it up. Webbotlib provides handy functions that you can use for the communication.

If you already know how to do that, you just need to connect them together with something simple, like this (pseudocode):

Code: [Select]
if voltage < measured_10min_left_voltage
  print "low voltage" to serial
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Sylvestre on September 05, 2011, 09:16:00 PM
Thank you Rbtying.  That helped.  I am pretty familiar with UART.   I guess what I am trying to get it is that I don't really get how to configure the the voltage divider so it will know when I have ten (approximation) minutes left.
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Admin on September 05, 2011, 11:36:26 PM
note: Several flame-like posts were removed, based upon a request sent to me.

Sylvestre, here is the general process:

1) Using my battery monitoring tutorial, have a voltage divider get the voltage to say half. For example, if you have a 6V batter, fully charged it may be 7.2V. But your ADC will fry above 5V. So a 1/2 voltage divider will keep the voltage below 7.2/2 = 3.6V. You generally want it closer to say 4.8V for better resolution.

2) Plug the output of the voltage divider to your ADC, have your mcu read that voltage

3) Output that voltage by USB from your Axon II, and your PC can read it using hyperterminal or whatever

4) Have it read out a low battery, and that value it gives (or anything below that) will then be known as 'low battery'.

I like to use a battery monitor on my robots as it saves me debugging time. It simply warns me of a low battery by UART before my robot starts acting funny.
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Sylvestre on September 06, 2011, 03:44:17 PM
Ok thank you Admin.  One problem though, the battery I am using is 12 volts so if I used resistors of different values Would this work?
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: joe61 on September 06, 2011, 04:26:11 PM
Ok thank you Admin.  One problem though, the battery I am using is 12 volts so if I used three resistors, instead of to would my voltage be divided by three?  Would this work?

It's not the number of resistors, rather the ratio of their resistance. You need to calculate the value of the resistors that you need, for whatever circuit you're going to use it on. You'll need different sets of resistors for different voltages. Take a look at the following, which may give you a better understanding. There are other tutorials on the web as well.

http://www.sparkfun.com/tutorials/207 (http://www.sparkfun.com/tutorials/207)

Joe
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Sylvestre on September 06, 2011, 04:42:03 PM
Oh ok I see.  Sorry  :P.  Which would be better for me to use, a 1000 ohm resistor and a 700 ohm resistor or a 10000 and a 7000 ohm resistor?  I am using a 12 volt 55 ah battery.  The total current draw of everything is 42 amps.
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Admin on September 06, 2011, 04:47:40 PM
Remember Ohms Law

V = IR

or

Voltage / Resistance = Wasted Current Loss

Voltage is your battery voltage, the resistance is the sum of both resistors which you choose.

A microcontroller requires *some* current, so allowing say 1mA for current would be fine.
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Sylvestre on September 06, 2011, 05:08:15 PM
Ok I am bit confused with the last statement.  I don't undertand what you mean  ???.  So which resistors should I use?
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Admin on September 06, 2011, 05:20:22 PM
If we tell you, you won't learn how to calculate resistor values yourself :P

Look at that equation, and start plugging in numbers and see what happens. This thread has the clues you need. I bet it won't take you more than 10 minutes to have that 'ah ha!' moment. ;D

When you figure it out, but still aren't sure, post your result here and we'll verify it for you.
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Sylvestre on September 06, 2011, 05:37:47 PM
I honestly do not understand this.  I don't what it is, but I find it difficult to comprehend this particular thing.  This does not seem right, but
Voltage: 12 volt
Resistance: 1700 ohms
12/1700=0.007
Final Output Voltage:4.9 volts

No idea
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: waltr on September 06, 2011, 06:00:39 PM
12/1700=0.007 Amps = 7 milliAmps
Now go back and read Admin's post above.
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Sylvestre on September 06, 2011, 06:10:30 PM
Oh now I understand!  Wow how foolish I am!  What I wasn't understanding was that 0.007 amps is 7 milliamps.  Blank moment I guess.  So the total resistance shoud add up around 9000, right?

12/9000=0.0013

Will these two resistors work, then?

r1: 5500 ohm

r2: 3500 ohm 
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: rbtying on September 06, 2011, 06:13:49 PM
Those would be fine IF your battery's max voltage was really 12.00v - but that's somewhat unlikely. The fully-charged voltage of a lead-acid battery is more in the range of 13 or 14 volts - recalculate your resistors' ratio based on that.

But you're on the right track - good to know that you're learning things!
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Sylvestre on September 06, 2011, 06:28:22 PM
Well this is actually the output voltage of a switching regulator that I am feeding to the electronics (everything besides the motor).  My initial voltage is 24 volts 55 ah (two 12 volt batteries connected in series).  Switching regulators are usually accurate so I should be fine.
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Admin on September 06, 2011, 06:32:50 PM
I'm confused . . . is this what you have?

24V battery -> switching regulator -> 12V output -> to electronics

If you are measuring the 12V, it won't tell you your battery is low until it's nearly dead (in which case your mcu might fail, anyway). You'd need to measure the voltage before the regulator to get a good reading.

What electronics do you have?
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Sylvestre on September 06, 2011, 06:41:58 PM
Quote
24V battery -> switching regulator -> 12V output -> to electronics
Yes that is correct.

Quote
What electronics do you have?
Electronics:
Video transmitter and receiver
camera
Axon II
hardware connected to Axon II (I dont think matters)
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Admin on September 06, 2011, 07:00:00 PM
In this case, you need to measure the voltage at the 24V battery end. Your voltage divider would have to give you an output no greater than 5V, even with a fully charged battery.

Basically the same thing you already did in your previous calculations.
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Sylvestre on September 06, 2011, 07:24:09 PM
So according to your previous post I have to put the voltage divider setup before the regulator?  How will I send serial data then or will it be still hooked up to the ADC on the microcontroller?
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: rbtying on September 06, 2011, 08:08:45 PM
You just need to have the high end of the voltage divider connected to +24v - everything else should come after the regulator, and the ADC input should connect to the center of the voltage divider.
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Sylvestre on September 06, 2011, 08:27:32 PM
Ok sounds good.  I still need to change my resistor values though because they have correlate with 24 volts rather than 12 volts.  I drew up a real amateur schematic (don't have that much time) just to double check my answer.  It is attached.  The lettering is backwards because I used a webcam, but most of it is readable except for where it says voltage regulator in the middle.
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: billhowl on September 07, 2011, 04:55:57 AM
No, the schematic is incorrect.
The resistors should connect to negative on one end and not in-series with supply to the regulator input.


 |------ + -|------------ to regulator input
24V          R
 |             +--- to ADC
 |             R
 |------ - -|-------
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Sylvestre on September 28, 2011, 08:47:34 PM
I just realized that my resistor calculations are flawed because I didn't take into account that I had a 24 volt battery.  If you guys could quick verify this, that'd be great. 

Resistor 1: 16,000 ohms
Resistor 2: 4,000 ohms

4,000/20,000=0.2

0.2*24= 4.8 volts

24/20,000= 1.2 ma wasted
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: newInRobotics on September 29, 2011, 12:45:30 AM
Correct  :)
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Sylvestre on November 19, 2011, 01:06:45 PM
If I am hooking up my two sealed lead acid batteries in series to produce 24v, will I get a little over 24 volts?  Should I recalculate my resistor values for 24 or 25 volts?
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: billhowl on November 20, 2011, 07:39:38 AM
For SLA each cell had max voltage of 2.45V, hence 24V batteries can go up to 29.4V, so calculate your resistor values base on 30V.
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Sylvestre on November 20, 2011, 03:36:29 PM
Ok here are my new calculations

Resistor 1: 16500 Ohms
Resistor 2: 3300 Ohms

3300/19800=.16666666667

.166666666666667*30= 5 volts

30/19800= 1.5 ma wasted

I'm not sure how to choose a power rating for the resistors.  I have two motors that run at 400 watts each.  Does this mean I have to get a +800 watt rated resistor?
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: billhowl on November 20, 2011, 05:21:08 PM
Calculate for Power (P)
P = I 2 x R
P = 0.00152 x 19800
P = 0.04455W

So power rating for the resistors you can get 1/8W (0.125W) or 1/4W(0.25W)

Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Sylvestre on November 20, 2011, 08:11:59 PM
Ok thanks Bill.  I think I am gong to purchase these 1/4 watt resistors (below).  Any problems that you see?


http://www.mouser.com/ProductDetail/Welwyn-Components/RC55Y-16K5BI/?qs=sGAEpiMZZMsPqMdJzcrNwhBdsdbMpQ1NK6gcUD4%252b0wk%3d (http://www.mouser.com/ProductDetail/Welwyn-Components/RC55Y-16K5BI/?qs=sGAEpiMZZMsPqMdJzcrNwhBdsdbMpQ1NK6gcUD4%252b0wk%3d)

http://www.mouser.com/ProductDetail/IRC/GS3-100-3301-JLF/?qs=sGAEpiMZZMsPqMdJzcrNwgD6D5IpFG6Mncl9asedEwI%3d (http://www.mouser.com/ProductDetail/IRC/GS3-100-3301-JLF/?qs=sGAEpiMZZMsPqMdJzcrNwgD6D5IpFG6Mncl9asedEwI%3d)
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: billhowl on November 20, 2011, 09:00:29 PM
The first one 16,5K was okay, but the 3.3K need not to have 3W, this will do

http://www.mouser.com/ProductDetail/Xicon/271-33K-RC/?qs=sGAEpiMZZMu61qfTUdNhG%2fJtDnsRrrptaPf%2fpx2qOkY%3d (http://www.mouser.com/ProductDetail/Xicon/271-33K-RC/?qs=sGAEpiMZZMu61qfTUdNhG%2fJtDnsRrrptaPf%2fpx2qOkY%3d)
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Sylvestre on November 20, 2011, 09:04:57 PM
Wow thank you!  I must have overlooked that on accident.   :P

Thanks a lot!
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Admin on November 25, 2011, 11:10:58 AM
If I am hooking up my two sealed lead acid batteries in series to produce 24v, will I get a little over 24 volts?  Should I recalculate my resistor values for 24 or 25 volts?
Best to measure with a multi-meter the total fully charged voltage. But it'd definitely be more than 24V for sure.
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Sylvestre on November 27, 2011, 07:58:33 PM
I would hook it up to a multimeter, but my multimeter is only rated for 10 amps while battery (two batteries in series) is 24 volt at 50 amp. :(
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Admin on November 27, 2011, 08:17:17 PM
I would hook it up to a multimeter, but my multimeter is only rated for 10 amps while battery (two batteries in series) is 24 volt at 50 amp. :(
When you measure the battery, there should be zero amps. You're only measuring voltage.

Measure each battery individually, then add the two voltages to get the total.
Title: Re: IC That Will Indicate When I Have Low Battery
Post by: Sylvestre on November 28, 2011, 12:08:01 PM
Oh ok I did not realize that.  Thanks!