Tuesday, April 7, 2015

Posted up v0.0.1 of monitor, but. . . .

Today I posted up an almost complete Battery MONITOR capable of measuring the battery voltage, amps, temperature as well as count its SOC.  Communications via CAN, USB and using the Arudino IDE.

I spent a lot of time coming to this point, mostly trying to get in some type of coulomb counter.  And in the end I have based this around the ATmega32HVB chip.   This part is design as a battery monitor/manager for Li cells, includes amp shunt, coulomb counter, and cell voltage readings.  Added to it is a SPI based CAN controller and a USB <--> Serial adapter (though will need to use SoftwareSerial libs, as the ATmega32HVB does not contain a UART)

(See Resource Tab above for .pdf file)

Over all I am not fully settled with this design.  The core chip is rather expensive ($11+), and after going through the voltage dividers for Vbat its 12bit ADC end up with a resolution of only 22mV.  Oversampling can help get this down to perhaps 6mV - fortunately the ADC is fast, but this is a long ways from the 16 bit ADC used in the INA226, where I also oversampled, and had much better resolution.  Interface to external cell monitors is incomplete as well.

Though I have posted this, I am not going to build a copy right away.  There is a lot of development work to be done on the MPPT controller, and I have other boards around that I can use to simulate a battery monitor, or even build one up.  Plus I want to think about this all some more.

Perhaps the biggest limiting factor at this point is usage of the Arduino IDE.  Without going to even more massive efforts (ala, what Intel has done -- among other) I was just not able to come up with a clean solution based on the Atmel uCs, and say the INA226 - close, but getting a coulomb counter capability was proving tough (again without going overboard and designing a discreet solution).  I would give the ATmegas32HVB based monitor a C+ grade.

Now - I also have been looking at the Freescale MM9Z1I638.  Has Volt, Amp, coulomb+ CAN and a UART for under $8.  Its 16 bit ADCs provide 1mV resolution, and there are 3 of them BTW - one for volts, one for Amps, and one for Temp.  It is a multi-die solution with all the analog separated from the digital stuff.  Plus it is targeted for the Auto industry, so it some with some extra hardening futures. I think this would make a much better core for the battery monitor / manager.

But it is not Arduino.  No simple IDE, need around a $50 probe to program, crippled free compiler, etc, etc..  

This is why I am a bit unsettled.  How important is it to keep the Arduino IDE for a project like this?  Goes beyond the monitor as well, PIC makes very nice uCs for the alternator regulator and Solar MPPT - but again, different development environment.

So - am a bit unsettled.  Given there is much to work on for now, will push this down the road some.  Perhaps anyone reading this has some thoughts?


  1. Hi,
    my 2 cents: I think neither the ATmega32HVB nor the Freescale MM9Z1I638 are a very good choice. Their coloumb-counting is very basic: They simply count the current that goes in and out. This might be ok for Li-ion. But for Lead-acid, you have to take Peukert's law (http://en.wikipedia.org/wiki/Peukert%27s_law) into account to get a reasonable estimation of the state-of-charge.
    I would stick with the ATmega328 + INA226 combination which has worked well in your other projects. Coloumb-counting can easily be done in software once you have a quick and accurate reading of the actual current. And you can also factor in Peukert's law and the temperature of the battery for a realistic indication of the state-of-charge.


    1. Kai,

      Thank you for taking the time to comment - and sorry for such a lag to acknowledge.

      You are correct; any amp summing approach to SOC will need to overlay a Peukerts correction - at least for lead-acid based technologies.

      Though I am a big fan of the INA226 and its like, the issue with using it for monitoring amps is it has large discontinuous periods. Primarily: The INA226 has one ADC, and that is cycled between converting Volts and then Amps. During the time when VBat is being converted any changes in current will be lost - specifically transition events. For instantaneous use (e.g., deciding acceptance rate of the battery to signal charger state change) this is not too major of a lacking, but I worry that even small errors in SOC summing will accumulate to a significant error over time.

      The Coulomb Counter optimized ADCs address this by largely integrating current measurements across a capacitor. In this way even the smallest transition can be captured. The ATmega32HVB and the Freescale MM9Z1I638 (among others) contain two ADCs across the Amp Shunt – one for instantaneous measurements, and one accumulating amps via a column optimized ADC.

      I also looked at retaining the INA226 and adding a separate Coulomb counter, specifically the LTC4150 – however, the LTC part requires a High Shunt, while the INA226 will not support a High Shunt for 48v batteries… Looking at approaches around this started to get too complex, as did creating an external integrator. (48v support has always been a challenge – in so many ways!)

      So, that is how I ended up where I am at. Very open to ideas on this, but do think simply summing INA226 amp readings will results in too many errors in the SOC estimate – unless I am missing something, which has been known to happen :-)