# Campervan project - Calculating approx remaining battery time

Good afternoon all,

I am designing and prototyping a vehicle monitoring and control system, based around and ESP8266 with additional ADC inputs via an MCP3008, additional I/O via an MCP23008, voltage sensors via standard resistor divider circuits, amps via shunt resistors then via AD623ANZ Instrumentation Amplifiers, outputs relay controlled, visual display via a Nextion display, and so far all is working as expected.

The unit is monitoring the water tanks (clean and grey), controlling the roof fan, wall fans, inside lights, kitchen lights, radio (entertainment), and inverter (when required). It is also monitoring the remaining gas in the tank, outside and inside temperatures, battery temperature, GPS location, distance from home, and more ....

As stated above all is working, so far, as expected, and the prototyping is going well; Circuit board ordered and partly assembled. (Assembling one part at a time and checking before moving on to the next).

My question is this:

My battery monitoring system is

• aware of the Ah rating of the battery (currently just a constant of 110).
• aware if the battery 'full' voltage (currently a constant of 12.8 ).
• is monitoring the voltage of the battery.
• is monitoring the current draw of the battery.
• is monitoring the temperature of the battery.

I am trying to work out how I might work out the approximate time remaining on the battery, but this is not quite as simple as first thoughts might lead you to believe...... or maybe it is and it's me that's over complicating it!

Firstly, for the calculations I am assuming that the battery is not being charged at the same time as being used (i.e. via solar charger, or battery charger), so is a 'stand alone' unit.

Its easy to state that:

• Capacity (Ah) = Amps (A) * Time (h)

Therefore is the Capacity is 110Ah and the draw is 10 Amps the time would be 110 / 10 = 11hrs. This assumes that the full capacity of the batter can be used, which (of course) it can't.

Standard Deep Discharge Leisure type Lead Acid battery should probably not run past 80% capacity, so i'll assume that the Capacity is actually only 80% of the marked Capacity i.e 110 * 0.8 = 88Ah.

Therefore for the above calculation drawing 10Amps would result in a running time of 88 / 10 = 8.8hrs (not 11hrs as before).

For now I am also trying to ignore Peukart effect, so am not worried if I'm drawing 1A or 50A, but maybe that is a mistake?

So far I have:

``````  readADC=analogRead(analogInput);                   // read ADC value
``````

this calculates the Amps being drawn. The Shunt resistor is 0-50mV for 0-50Amps, and the AD623ANZ gain set to scale this to 0-5v for the MCP3008 ADC, so this makes the calculation very easy.

I can calculate a 'running average' of the Amps by something like:

``````  readADC=analogRead(analogInput);                   // read ADC value

numberOfSamples++;                                 // increment number of samples counter

``````

and can easily modify this to be calculating the average over a period of time (say 1 minute).

What I'm struggling with is where I go from here? Do I 'sum the Ah used' and take these away from the Capacity? How do I know where the discharge point of the battery is? How do I know how much of the 'Capacity' is available to start with? A big part of me thinks I should be using the monitored voltage in the calculations as well, after-all anything lower that 10v and it's basically a dead battery!

This can be done as whilst investigating I came across this commercial unit that displays the 'remaining time' (See attachment).

I'm not after someone to write me the code, just to suggest methods that I might use as I think that I am now overthinking it and cannot see the wood for the trees!

Thanks.

Do I 'sum the Ah used' and take these away from the Capacity?

That is the basic idea.

But battery capacity is not a constant, and depends on the battery age, number and depth of discharge/charge cycles and the discharge rate, so depending on time and how much the load varies, you may have to construct and use a rather complex model for battery capacity.

The model has to be updated from time to time and only by monitoring actual conditions will you have the information needed for that.

Working with traction batteries, 48 volt, 1500 Ah, weight more than 1000 kilo, for quite some time, I only support the reply from @jremington.
Measure the voltage and learn by experience when cut off is close to happen.

dh68:
What I'm struggling with is where I go from here? Do I 'sum the Ah used' and take these away from the Capacity?

As a long term user of deep cycle lead acid batteries there are many problems with estimating the available capacity. The first and biggest is to know what is the practical capacity of the battery. It will be a great deal less (perhaps only 50%) of the sticker value, even when the battery is new. IMHO your estimate of 80% is far too generous unless you are happy to replace the batteries regularly. That's not to say that you cannot occasionally discharge down to 80%. And as others have said, the capacity declines with usage - the cells wear out like the soles of your shoes.

You also need to take into account the types of loads that your battery must meet. The biggest challenge with my setup is starting a 230v fridge (via an inverter). The brief inrush current can easily exceed 60 amps at 12v and when the battery is significantly discharged it cannot meet that demand without the voltage falling so low that the inverter trips out.

The measured voltage at the battery terminals depends on the load - if the battery is discharging it will be lower than the steady state value and if the battery is charging it will be higher than the steady-state value. The problem is that you need to leave the battery unused for at least 12 hours to get the steady-state value and that is usually quite impractical.

Personally I would have no faith in amp-hour calculations as an indicator of available capacity. Even using the voltage as an indicator is doubtful. For example if the present ampere draw is 3A there is an associated voltage reading. If the future ampere draw is much the same then the voltage is probably meaningful. But if you plan to draw an additional 5 or 6 amps later in the evening that 3amp voltage reading would need to be downgraded considerably.

My own strategy is to estimate the total consumption between charges in Ah (I now have lots of experience) and ensure that the battery capacity (when new) is over 4 times as much. That provides some scope for unusual demands (and occasionally delaying or forgetting a charge). It is also essential to ensure that the battery gets a complete charge (about 8 to 12 hours) once every 7 to 10 days - otherwise it will deteriorate very quickly.

...R

Have a look at this from here, Credit goes to the author, This gives you a rough guide it monitors what goes in and out of the battery.

I did s spin off form this using an 16Bit adc converter tweaked a few tings and it seem to really work well, What you need to be careful about is something called Peukert's Equation where you take more than 1amper hour out of the battery, Example if you have an 225Ah battery rated at a 20hr rate and discharged the battery at 11.25amps this should be able to supply that current for 20 hours (in an ideal world and you should never discharge a battery to 100%) 225/20=11.25amps,
Same again if you use this with an higher discharge current say 30 amps 225/30 = 7.5hrs (again in a ideal world) this should be able to supply 30amps for 7.5 hours but because you are taking more than the 1Ah out the battery allowed using the Peukert's Equation it will be able to supply that current for 5.6hrs to 100% discharged, (which you should never do, just to make sure I get this point across as I know what other on here would say about discharging a battery to 100%).

http://www.smartgauge.co.uk/peukert2.html

The above link for the cheap battery monitor uses this Peukert's Equation and I can the results are very good, My version I made of it I carried out some controlled testing where I used an 100Ah battery(for testing I did not care if I destroyed the battery has I was testing it) and a constant current load tester set to 5amps and set an timer for 1 hour and it took 5Ah out of the battery and then I fully charged the battery again. I increased the current to 20amps and the battery monitor calculated the reaming time fairly accurately. The trick is you need to make sure that the battery is fully charged from flat to full of if you know the battery is full y charged and you can trick it, the author of it explains everything very well and has even provides full instructions, It's based on an nano but should easily made to work on an ESP8266

Steveiboy:
SmartGauge Electronics - Peukert's Equation - what it means to you

I think I still have one of those in a drawer somewhere.

...R

Thanks all for you comments and suggestions. You have verified what I was originally thinking which is good.

@steveiboy - I knew it would come back to haunt me! :-), as I said:

For now I am also trying to ignore Peukart effect, so am not worried if I'm drawing 1A or 50A, but maybe that is a mistake?

Will check out the links supplied - Thanks for the heads up and info.

dh68:
Thanks all for you comments and suggestions. You have verified what I was originally thinking which is good.

@steveiboy - I knew it would come back to haunt me! :-), as I said:
Will check out the links supplied - Thanks for the heads up and info.

Sorry there's no way around it, The Peukert factor plays a major part in it, I worked with batteries can chargers for 10 years fitting new battery pack and testing for warranty claims, A lot can be said by stripping down batteries to see how they failed

Therefore is the Capacity is 110Ah and the draw is 10 Amps the time would be 110 / 10 = 11hrs. This assumes that the full capacity of the batter can be used, which (of course) it can't.

The Amp-hour rating doesn't assume that you'll drain the battery to zero to extract all of the energy from it... If amp-hour rating is honest and you use the battery according to the specs you should be able to get the full-rated energy from it. Even more if you're using a voltage regulator! i.e. If you are using a 5V voltage regulator you can get usable power from the battery down to about 6V (probably not recommended).

If there's a "real standard" it's hard to find but it seems like batteries are considered discharged when they get to between 60 or 80% of the rated voltage.

I found [u]this[/u] which says an automotive battery is considered good down to 10.5V. I think a "12V" battery is supposed to be 14.4V when fully-charged, so that would be about 70% of it's maximum or about 90% of its rated voltage.

That same website says you get fewer amp-hours at a high discharge rate than at a lower discharge rate.

Rather than trying to predict the hours remaining it might be easier or better to display the percentage of the energy remaining, or maybe the percentage of the "usable" energy. And then maybe trigger an alarm at whatever point you want to be alerted...

DVDdoug:
If amp-hour rating is honest and you use the battery according to the specs you should be able to get the full-rated energy from it.

They never tell you how many times you can do that or what charging regime is a necessary adjunct to it. Without that information the capacity rating is meaningless.

...R

I have been following this string with great interest, I have been designing and specifying Standby and Deep Cycle battery systems for more than 15 years. Every time I see a series of posts here I see some really good information interspersed with some misinformation, missing information or generalizations, I would like to just add my 2 cents worth.

1. Sealed Lead Acid also know as Valve Regulated Lead Acid (VRLA) are designed in a variety of "types" including Standby, Deep Cycle (Cyclic), Traction, Solar to name a few.

2. The majority of these types will be rated in Amp Hours to an end voltage at a specified discharge rate as noted above. This the DESIGN specification and will usually tested in laboratory conditions.

3. Any good quality battery manufacturer will specify the DESIGN life in years and/or cycle life in number of cycles to a given depth of discharge. I would point out that in all my years of battery system design I don't think I ever saw a battery fail to deliver the designed amp hour capacity from new, however design life in years was always wildly optimistic and never achieved, so much so that we routinely derated the design life expectancy by up to 40%!!

4. Engine start batteries are rated in CCA or CA/MCA (Cold Crank Amps or Crank Amps/Marine Crank Amps) these should not be used as solar or deep cycle batteries.

5. Deep of discharge is a commonly misunderstood expression and is relative to the application, as an example a Standby Battery in a UPS/Emergency lighting application might be designed to discharge to 10.2V (1.7VPC), whereas the Telcos will not allow their battery design to go below 11.1vdc (1.85VPC).

When it comes to Deep Cycle i.e house batteries in a caravan or boat etc, the end voltage may be determined by the lowest voltage the connected equipment will work at. As an example most decent inverters will have a low voltage disconnect set to around 10.5 volts to prevent over discharge.

For a solar system we typically use batteries rated at c100 which is the 100 hour rate and size the string to not discharge below 50 percent of the battery capacity. We also allow for 3 - 5 days of no sun and size batteries accordingly.

Finally a 12 volt nominal Sealed Lead Acid battery is very sensitive to higher voltage charging and the manufacturers specifications regarding temperature compensation needs to followed for best battery life. A 12v battery can be bulk charged at up to about 14.4 volts for a period of time then "finished" and floated at 13.8 volts. A fully charged battery should settle to about 12.8 volts once the charger is disconnected, this may take some time to settle to this level.

Kiwi_Bloke:
3) Any good quality battery manufacturer will specify the DESIGN life in years and/or cycle life in number of cycles to a given depth of discharge

I would be interested to see a link to a manufacturer's webpage with that information.

...R

Robin2:
I would be interested to see a link to a manufacturer's webpage with that information.

...R

this is one of our most common Solar Battery ranges, we also use their wet (Flooded Cell) range for some applications.
We use there Standby range for our Telco and Power Generation clients.

Haze is a more "entry level" or small system range, although we move a lot of the 6v 445ah batteries into low usage holiday houses etc.

Thanks for the link. They seem to be expensive batteries for commercial applications - but I guess you get what you pay for.

...R

Or You pay for a low volume produced battery and not the high volume produced car starter battery.
Just did a checkup for a separate battery powering a fridge in the rear of the car....

Robin2:
Thanks for the link. They seem to be expensive batteries for commercial applications - but I guess you get what you pay for.

...R

Well we are commercial company, but you did ask for examples.....
There are lots of cheap and cheerful batteries on the market, some of them are quite good.... a lot are not quite as good...

If you want a longer life span don't use motor start batteries for Deep Cycle applications, just as you wouldn't use a deep cycle battery for motor start.
In fact today I went to the assistance (I crew on a rescue boat) of a boat that had start batteries for both start and house use, they had paralleled the batteries and left them running a load overnight. When we put the meter on them the start batteries were at 10.49vdc at rest and dropped to less than 5 volts when they went to crank. We were unable to jump start them and wound up towing them for 2 hours back to the marina.

Kiwi_Bloke:
Well we are commercial company, but you did ask for examples.....
There are lots of cheap and cheerful batteries on the market, some of them are quite good.... a lot are not quite as good...

I did appreciate the link - I had not heard of that company.

From further study it seems that they get their extra quality mainly by having more lead in a battery for a given claimed Ah rating. But that brings up another problem. Their 12v 94Ah would be too heavy for me to lift. The golf-buggy batteries that I'm using are probably a good compromise.

...R

Kiwi_Bloke:
If you want a longer life span don't use motor start batteries for Deep Cycle applications, just as you wouldn't use a deep cycle battery for motor start.
In fact today I went to the assistance (I crew on a rescue boat) of a boat that had start batteries for both start and house use, they had paralleled the batteries and left them running a load overnight.

That's the reality.
I's another disadvantage parallelling batteries... The human factor as we call it here. Mistakes, forgetting...
Keep house power separated from start power.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.