# Battery monitor for a camper van electrical system

As one of my first DIY projects, I'm going to build a battery monitor for the DC battery/solar/inverter system in my camper van.

The van has 440 Ah of lead acid batteries and DC currents up to 200A to the inverter, although more typical currents are in the 0-5A range. During the day, the current flow from the batteries often reverses as the batteries get charged from the solar panels, with the maximum charing current being around 10A.

A battery monitor basically provides the state of charge of the battery at all times. The typical design seems to be coulomb-counting (i.e., integrating current over time), combined with a bit of math to approximately adjust for the peukert effect. The monitors will generally try to "zero" themselves when they detect the battery is completely charged, usually by examining the battery voltage (ideally at rest) or the current acceptance rate, or some combination of the two.

I'll (probably) be using a shunt resistor to measure the current flow, either at the positive or negative terminal of the battery.

I'm wondering what type of circuit I need to best amplify and measure the small mV drop across the shunt. A typical 200A shunt is going to have something like 0.25 milliohms of resistance, so the voltage drop across the shunt will be something like 0.1 mV for small currents (which are still important).

I'm planning on using an arduino for as the MCU for the monitor, so I could use the existing ADC (which works between 0V and R, where R is the full scale reference voltage and must be between 2V and 5V). So some specific questions:

1) What kind of circuit do I need to amplify the voltage drop so it can be processed by the arduino ADC? I've looked at instrumentation amplifiers, but I'm not sure if they are the right tool.

2) How can I deal with the fact that current can run both ways? That is, I'll need to measure both positive and negative drops across the shunt. Most differential amplifiers seem to work in the case V+ > V-, but not the other way around.

3) Does it make a big difference whether I put the shunt on the high side or the low side? For the physical layout that I have, a shunt on the high side may be more convenient, however that means a few mV (or less) signal riding on a ~12 volt common mode voltage. Does that make things harder? I can't tell if CMRR etc would even apply here (and I asked a bit about it over here).

4) The DC current may be as high as 200A (e.g., when I'm using the space heater), but typical currents are much smaller. I want to have at least 0.1A resolution for the low currents, and more is better. 200A full scale at 0.1A resolution implies an 11-bit DAC, at least, but the arduino DAC has only 10 bits. I'm interested in a dual range solution where I amplify the signal with two different gains - one giving full scale at 200A, and the other at say 10A, and feed those into separate ADC inputs. When the current is below 10A I can use the much finer resolution I get from the 10A input. Is it feasible? The main problem I see is that I don't know how to "cap" the 10A input so that it doesn't put a damaging voltage to the ADC when currents are higher than 10A.

5) I'm fine with off-the-shelf chips that will do much of the above (up to and including the ADC stage) and then the adruino can just do the integration and UI logic, but I haven't found anything suitable. Anyone know of anything?

Looking back on this question, I realize it could be five separate questions, at least - but this early in the design they are kind of all related. If any of the topics are big enough I'll split them out.

• Ask yourself, could this question be shorter? – Andy aka Jan 22 '16 at 0:46
• Take a look at this guy: ti.com/lit/ds/symlink/ina169.pdf – Axis Jan 22 '16 at 0:58
• SOT-23 is certainly had solderable. – Axis Jan 22 '16 at 1:10
• If you limit yourself to non-surface mount packages you are going to make thing much harder on yourself. I would suggest you purchase some surface mount devices and practice. There are millions of soldering tutorials out there. SOT-23 is an easy package to solder with a little bit of practice. – Axis Jan 22 '16 at 1:24
• The INA169 part is probably the best choice within that family of parts but it's probably not an optimal choice because your shunt is so small. If you decide that a low side shunt is acceptable, many of the offset/CMRR/gain issues disappear, and there are tons of op amps to choose from, along with a bevy of possible topologies (e.g. linear.com/solutions/1188). If you must have high side, I'd consider the Hall Effect sensors mentioned above. – PKL Jan 25 '16 at 7:13

You want to read bi-directional current (battery charge/drain), which means that the INA139/169 with a shunt is out.

Based on the current range, you probably want something in a high range: http://www.allegromicro.com/en/Products/Current-Sensor-ICs/Zero-To-Fifty-Amp-Integrated-Conductor-Sensor-ICs.aspx

There is an alternative breakout board from Sparkfun: https://www.sparkfun.com/products/8882

It only has a range of 5A, though. You might want to find a friend in the local hackerspace who can layout a board and show you how to solder a higher current part. I have used the ACS711 and ACS712 in the past, they are great - and simple - parts!

Also, generally, it is best to sense current on the high side. This is b/c when you place resistance in the return path, all of the circuit 'above' the current has a higher resistance path to ground and tends to generate more noise. It is done, no doubt, but on as small a part of the circuit as is possible.

You are sometimes drawing 200 Amps.If you persisted with a shunt you would want reasonable resolution at low currents and you do not want to waste too much in your proposed shunt at 200 Amp.Say you run a 1/2 milliohm shunt which would waste 100 millivolts at 200 Amp .This shunt would blow up to 20watts which is getting up there .If the current was only 5 Amps the shunt volts would be 2.5mV .You can see the terrible trade off between low end accuracy and high end power wastage .Nowdays I and lots of others use the hall effect device .These devices have got much cheaper and dont waste power because you just slip your big cable through so sensing in the + is easy .These devices are galvanicly isolated so you dont have to worry about ground loops .My favourite hall device runs on 5VDC outputting 2.5V at Zero current so you can sense charging and discharging .Proof that hall effect devices are easy is that I have helped MOVAN people in NZ over the phone with them and never had to go on site .

• Interesting comments on hall devices. I wonder then why all the commercial battery monitor products I've looked at (for boat or RV use, generally) have used shunts? BTW, a typical shunt is 75mV full range, so 0.375 milliohm for a 200A model, or a waste of 15W at full range. 15W sounds bad, but at this point you are drawing something like 2600W overall, so it's well less than a 1% loss. At lower currents, the loss is lower. For example at a 5A typical current the loss is negligible. – BeeOnRope Jun 6 '16 at 18:54

I’m building something similar and suggest using the INA219 that both is possible to bi-directional current as well as being placed on the high side up to 26V.

Adafruit has a breakout board for it but you need a external shunt.