Battery-Pi

Tell us about your projects. Update us regularly.
Post Reply
parkview
Guru Maker
Posts: 603
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Battery-Pi

Post by parkview » Sun Dec 13, 2015 10:31 pm

Every now and then I need to measure various battery capacity/or it's discharge performance. Over a number of projects, I have assembled all the parts and knowledge to build a dedicated battery tester. It needs to be able to test 1.2V, 1.5V, 6V and 12V battery's, all being of different battery technology.

For example in the GIS-Pi project, every minute I am recording the battery power being used and it logs the data to a CSV file. When the script notices that a suddenly the battery voltage is much higher than before, a python script is called and uses matplotlib to plot a line graph of the battery performance over time. I thought it would be a neat method of automatic tracking battery deterioration of time.

Yes, there are many people popping up on Hack-A-Day who have done something like this before, but I wanted to build my own. This is based on a spare Raspberry Pi B that I had lying around and has been a nice weekend project. Rough BOM:
  • 1 x Adafrout INA219 i2c based voltage/current sensor board
  • 1 x dx.com SSD128x32 i2c based OLED display
  • 1 x MTP3055VL MOSFET
  • 1 x opto-isolator
  • 4 x 100 ohm resistors
  • 2 x 10K ohm resistors
  • 1 x push switch
  • 1 x red LED
  • a few 10 ohm 50W load resistors

Here is the circuit diagram:
Battery-Pi_v1.0.jpg
Battery-Pi_v1.0.jpg (123.75 KiB) Viewed 9384 times


Of course I first started with a breadboard circuit to test it all out:
battery-pi - breadboard.jpg
battery-pi - breadboard.jpg (241.54 KiB) Viewed 9384 times


Then I moved it all onto a perfboard:
battery-pi - circuit board.jpg
battery-pi - circuit board.jpg (211.55 KiB) Viewed 9384 times


One initial issue I had was that I had the load resistor swapped around with the MOSFET. This caused it to not turn on properly, and get very hot. With Stephen's IR camera, I tracked it to over 100 deg. C before chickening out and turning the load off.

User avatar
seaton
Master Maker
Posts: 222
Joined: Tue Jun 24, 2014 11:41 am
Location: Bunbury, WA
Contact:

Re: Battery-Pi

Post by seaton » Mon Dec 14, 2015 10:18 am

nice write up.

So did swapping the load resistor around resolve the problem?

parkview
Guru Maker
Posts: 603
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: Battery-Pi

Post by parkview » Mon Dec 14, 2015 9:34 pm

Yes it did. Back to normal and doesn't even get warm. I was surprised it still worked!

User avatar
seaton
Master Maker
Posts: 222
Joined: Tue Jun 24, 2014 11:41 am
Location: Bunbury, WA
Contact:

Re: Battery-Pi

Post by seaton » Wed Dec 16, 2015 4:03 pm

parkview wrote:Yes it did. Back to normal and doesn't even get warm. I was surprised it still worked!


Excellent...but where are the graphs??? ;) (nothing like a graph to show)

parkview
Guru Maker
Posts: 603
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: Battery-Pi

Post by parkview » Sun Dec 27, 2015 10:39 am

I have now fitted all the Battery-Pi components on a 6mm MDF painted plate:
battery_test_sml.jpg
battery_test_sml.jpg (127.74 KiB) Viewed 9376 times


Good old Ninjaflex came to the rescue for some 3D printed feet:
ninjaflex_foot.jpg
ninjaflex_foot.jpg (33.17 KiB) Viewed 9376 times


As requested, here is a reasonable test run graph of a 7.2AHr, 12V SLA (Sealed Lead Acid), battery:
batterydata_2015-12-26_162925.jpg
batterydata_2015-12-26_162925.jpg (68.5 KiB) Viewed 9376 times


I don't know what the 50min. jump is all about, but the down spike at around 120min. is me blowing for a few minutes on the small 10 ohm power resistor. I wanted to see how the readings would change, as I had previously seen seemingly random short term changes to the readings. I suspect that it might be due to wind gusts via the window which was close by. In the above graph, I was running Battery-Pi out in the shed, with windows and doors closed. Check out the sine-wave fluctuations of the current! I have no idea on what might be causing those.

I have two more interesting batteries to test, so more graphs soon.

parkview
Guru Maker
Posts: 603
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: Battery-Pi

Post by parkview » Sun Dec 27, 2015 1:37 pm

At the moment, I have set the auto cut-off at 10.65 volts. Now this is being read when the battery is under a ~ 500mA load (~ 6W). The script reads 500 readings per minute, averages them out and writes the results into the CSV text file. Here are some data samples:

Datetime, minute count, Volts, milli-Amps, milli-Watts
-------------------------------------------------------------------
2015-12-27 08:43:54,65,11.001572,549.076,6040.699304
2015-12-27 08:44:54,66,11.002046,549.08,6041.003464
2015-12-27 08:45:53,67,10.994896,548.994,6036.131942
2015-12-27 08:46:52,68,10.998988,549.006,6038.510406
2015-12-27 08:47:53,69,10.992102,548.82,6032.686614
2015-12-27 08:48:56,70,10.97755,548.018,6015.895112

with roughly 10 readings per second, and then averaging them out, I am surprised to see the readings fluctuate so much. Note: the RPi is being powered from the mains, so that's not causing them.

It does remind me that there are some wind sensors that use four resistors to measure the wind speed and direction. If a relatively large thermal mass power resistor is that sensitive, then I guess a much smaller one will be even more sensitive.

Anyway, here is today's graph from another 7.2AHr 12V SLA battery. I started recording for a few minutes before turning on the load. You can see how much the battery voltage sags when under a load:
batterydata_2015-12-27_073911.jpg
batterydata_2015-12-27_073911.jpg (45.13 KiB) Viewed 9375 times


As you can see above (and below), when you look at a zoomed out view of the current draw, that really the fluctuations are very small - just a few milli-Amps. Over each run, the current only changes by ~ 25mA (eye balling it from the graphs) while the battery voltage changes by ~ 0.4V. Looking at ohms law: A = V/R | 0.2A = 0.4V / 20 ohms, so it's all about right.

This battery started at a rest voltage of 12.82V and after the load run had finished (15minutes to recuperate), ended up at 12.2V. The load run lasted for 5 hours and 3 minutes. The previous battery ran for: 6 hours and 22 minutes! Quiet a bit of difference.

Here is the same data with the first 6 readings removed:
batterydata_2015-12-27_074455.jpg
batterydata_2015-12-27_074455.jpg (50.66 KiB) Viewed 9375 times


Yes, the spikes at 190 min. was me touching the resisters. I just can't seem to be able to keep my mitts off them. :)
Last edited by parkview on Mon Dec 28, 2015 4:45 pm, edited 1 time in total.

parkview
Guru Maker
Posts: 603
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: Battery-Pi

Post by parkview » Mon Dec 28, 2015 4:17 pm

I have a 12V - 28AHr SLA battery that I purchased back in 2005 or 2006 for my Autonomous boat project: http://www.bdug.org.au/project/swasc/about I never really got to use the battery for the project, so it sat around on the floor for 10 odd years. I did use it a couple of times for a few light projects. I think I recharged it two or three times over that period. Yes, I wasn't very kind to the battery!

Anyway, I was thinking I would have a go at using it for my remote weather station project. But I needed to figure out if it's still any good - or, how bad is it. This is part of the reason for building Battery-Pi. Looking at the previous graphs, and looking at the base starting voltage of 12.57V for the 38AHr battery, I thought it wasn't going to last as long as it did:

batterydata_2015-12-27_1909.jpg
batterydata_2015-12-27_1909.jpg (52.38 KiB) Viewed 9374 times


This graph is a doozy! I have a special routine in the code to look for a new battery, and the big spike in battery voltage at around 230minute mark trigged it to start a second data file. I had to manually stitch the data together to create the graph. That's also why the date on the graph is around the wrong way.

No, the voltage spikes where not because I was playing around with cooling the resistor. I was in bed fast asleep at the time. I am now thinking that perhaps there might be something going on with the battery chemistry - maybe the discharge played around with sulfation, or a plate un-shorting? Unfortunately I don't have a SLA battery conditioner, so it will just have to make do with it for now.

I will have another go at discharging the battery a second time to see what will happen next time.

Some stats:

  • Under load the battery quickly drooped down from 12.38V to 11.0V. That wasn't a good sign that it was going to last very long.
  • The run last for 680 minutes, or around 11 hours and 20 minutes. As per usual, it was pumping out around 6W during that time. This battery would run my Raspberry Pi A+ for at least 2.8 days.
  • A new 28Ahr battery should be able to run a Raspberry Pi A+ for at least 20 days!
  • there is still a wavy fluctuating current through out the battery discharge.
Last edited by parkview on Sat Jan 09, 2016 9:49 pm, edited 3 times in total.

parkview
Guru Maker
Posts: 603
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: Battery-Pi

Post by parkview » Tue Dec 29, 2015 6:54 pm

Ok, last battery graph...

batterydata_2015-12-28_162953.jpg
batterydata_2015-12-28_162953.jpg (47.84 KiB) Viewed 9373 times


That test lasted for 838 minutes, or 13hrs and 58 minutes - at ~ 6Whr.

Apart from the bit at the end, it is a much cleaner discharge! Looking at the current fluctuations today, I think it might just be the smallest level that the INA219 can read, ie: it is about 1mA (or a bit less) per step. Previously I was kind of looking at it a bit sideways.

I did find this page had some good info on lead-acid battery tech: https://wiki.xtronics.com/index.php/Sealed_Lead_Acid_Battery_Applications

This has been a fun project, but it's time to move on...

parkview
Guru Maker
Posts: 603
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: Battery-Pi

Post by parkview » Wed Jan 13, 2016 9:24 pm

This post could have gone into GIS-Pi project, or as a Product Review , but since this was about using some of Battery-Pi graphs, I will stick it here.

At the 2015 Robofair, I brought along my GIS-Pi project to demo to interested people. I had freshly charged up 8 x UltraFire Li-ion 18650 batteries. These where arranged as 2 parallel block of four batteries in series, ie: approx. 16V at 4400mA, or around 70Whr of power. This should in theory keep GIS-Pi running for 21 hours, so I didn't pay any attention to the low battery warning signal that was flashing on the screen! :o

It wasn't until pack up time, that I noticed that it was reading less than 12% battery life left. I quickly shut GIS-Pi down. It was many weeks later, when I wanted some 18650 batteries that I took them out and recharged them. I measured each one as I removed them and to my horror, found that 4 of them where reading 0V. The rest where 3.4V or so. Bummer that I had a 50% loss rate in their first big work out. It was only this week that I flashed up GIS-Pi to extract the battery run graphs. Unfortunately I only log battery data once every 5 minutes, but still I collect 89 readings, or 445 minutes, or 7 hours and 25 minutes worth of data.

Here is the resultant graph:

batterydata_2015-12-03_212002.jpg
batterydata_2015-12-03_212002.jpg (43.18 KiB) Viewed 9369 times


Some of the spikes are when kids turned off the GIS-Pi (note to self, always cover the on/off switch. Kids will play with ANYTHING if its visible). The low readings between 8 and 37 was when the display was switched off, ie: just powering the RPi. The Adafruit LCD display draws about as much as a RPi.

Looking at the graph, I think I shut it down just before it was about to rapidly tail off. This site has some great info on battery tech, charging and discharging etc: http://budgetlightforum.com/node/16699

I think I might just bite the bullet and purchase my next lot of 18650's at the local Battery World. I do have a set of 4 x 32650 Trustfire Li-ion batteries still to test. I wonder how they will go?

I also have the dud 18650's to try and open up/explode! :shock:

User avatar
BeJay
Maker
Posts: 139
Joined: Mon Jun 23, 2014 6:31 pm
Location: Perth
Contact:

Re: Battery-Pi

Post by BeJay » Fri Jan 15, 2016 2:41 pm

Great work Paul:) Those pesky kids will tinker with everything!

parkview
Guru Maker
Posts: 603
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: Battery-Pi

Post by parkview » Fri Jan 15, 2016 8:08 pm

Not wrong. I was chatting with someone and saw their eye wide. I looked down to find a parent-less young 8yo flicking switches on/off/on/off etc. Bashing hand on keyboard...

I was really surprised it lasted the day, but next time I will look at making things a bit more robust - *fair proof - if there can be such a thing. Life is always a learning curve. I love it all.

Post Reply