Go Down

Topic: 12V battery meter with Arduino MEGA (Read 1 time) previous topic - next topic

steger

#45
Jan 19, 2021, 05:51 pm Last Edit: Jan 20, 2021, 04:13 am by steger
I think I found some sort of solution, how the capacity can be calculated.
One way is: linear regression on multiple variants.
Lets take this model:
Battery Capacity = A*Vterminal + B*Crate + C*Temp + D   (A, B ... D constants)
If we have data-set (simple table with hundred of rows) with Capacity; Vterminal; Crate and Temp data, then this data can be used to train the above model -> the constants (A, B, ... D ) can be be figured out. (Machine learning.)

After that, with this constants the model can be tested as well. -> Accuracy can be checked.

I found some battery data-sets here (MATLAB might be required to open .mat files):
link1
link2
How to train a model (video with Python):
link3
like4

Other, non-linear algorithms (NASA):
link5

If Your found a good-data set for LiFePO4 battery with the above parameters, kindly share.
Thank You !

steger

Just to have a more comprehensive picture, I'm attaching the 12V battery meter with Arduino MEGA incl. temperature and current measuring options for further consideration and improvement. 


Koepel

#47
Jan 21, 2021, 05:35 pm Last Edit: Jan 21, 2021, 05:36 pm by Koepel
I'm afraid we all forgot to tell that the 1-Wire bus needs a pullup resistor.

You already showed a DS18B20 in the picture in reply #13 and #34, and we didn't tell about the pullup resistor :-[

steger

@ Koepel: thank You very much for advise, I changed the schematics.



Zivo

Before continue with codding, assuming you do have 4 cells of LifePO4, I think your volt range (12.8-10.7)  is wrong.
I suspect it should be 11.2-14.6V.  You better verify this point before blow-up your battery.

Zivo

I did some projects like this, thought the whole idea of "running" after the charge / discharge curve  will not work.

Or you exclude the first and last ~15% capacity, measuring the ~15-85%, consider it linear (knowing  you are +-10%. For the edges just specify you are on the edge).

Or, back to ASC712 current sensor (mention early), you can measure the charge and discharge current all the time and calculate the balance. When charging current it minimal and battery volt reach to the Max., I'm resetting the balance (to zero).  I have few projects (with ASC712, 15, 758) and it's the best way I found to figure out the battery status.
If you go this direction (using ASC712), these sensors are tricky to use. I can post my code and share my experience.

steger

@ Zivo: Thank You for Your comment.
Yes, You are right. I use 4 cells of LifePO4. Actually in my case the max voltage went up to 12.8V (may be not the best battery) and I set the minimum to 10.7V as cut-off. (Can be 10V as well.)

I would sincerely appreciate, if You would share Your experience with ASC712. ;)

To simplify the math, I thought the following:
Let say, I have the discharge curves only @C/10 from -10 to 50 Celsius .
(In this outdoor application the C/10 is the typical current consumption, on a long distance.)
It means, have to make 7x3 regressions. (I already made for 3 temperatures and may be from 30 Celsius to 50 Celsius will be the same. So only two more required).
Lat say, the rover running up & down. In every 30 minutes, I can adjust the speed for 1 minute to C/10 (let say to 1.2 A total current consumption for 12 Ah battery) and calculate the actual remaining capacity %. 
This will not giving the best accuracy, but considering with temperature, which in this outdoor application is important.

Zivo

Once again, I'd advise you to re-check your LifePo4 spec. 10V is 2.5 per cell, this is too low for  LifePo4.
You better stay above  2.7. Pay attention to Lithium discharge curves, the capacity contribution (around these number) are neglected. At other hand the risk of damage  the cell is big.
Don't go there.
Regarding the capacity curves, you are focusing on ambient temp', while there are few others parameter (like charge and discharge current, # of cycles) which have no less impact on these curves.
By the end of the day, the simple method i'd proposed, will give you about the same accuracy , with much simple solution.

steger

#53
Jan 25, 2021, 04:49 am Last Edit: Jan 25, 2021, 04:49 am by steger
@ Zivo: thank You for the advise. I will try your approach as soon as possible.
The 10V is the cut-off on 2.5V, so the battery during discharging can go max to this point, not below.

For Your kind information and for other Arduino users who are vising this page as well.
I started a new thread:
Power Supply for Arduino MEGA + Shield
in "Arduino Forum >  Using Arduino >  Project Guidance  section"
https://forum.arduino.cc/index.php?topic=724297.0
It is very useful with a lot of learning points.

If You are interested, just jump in. ;)
Have a nice week ahead.

Go Up