Lorcan
Posts: 4
Joined: Sun Apr 15, 2018 11:24 am

Monitoring a 12v solar & battery system

Sun Apr 15, 2018 12:41 pm

Hi all,

(First post here, hope I've posted this in the right place)

I own an old campervan with a 12V battery system, The battery powers lighting and a (fairly power-hungry) compression fridge - along with a 12V TV, phone chargers, etc. It is recharged by solar panels on the roof (when it's sunny!), the alternator (when the engine is running) or a mains charger (when we're connected to mains, at campsites).

I'd like to use a Pi to monitor the state of the battery - measuring voltage across its terminals and current flow. Ideally the data would be uploaded to the cloud so I can monitor it remotely - useful since the van is kept in storage some miles from home when we're not using it. I may later want to add security cameras, motion detectors, GPS, etc - so I think a Pi is the way to go, rather than something like an Arduino.

Focusing on the input side: the system needs to be able to measure current and voltage with reasonable accuracy. The voltages will be in the range of about 10V to 14V - a nominal 12V lead-acid battery system. There is also the option of measuring the raw voltage coming from the solar panels at some point in the future, which may be higher.

The current flowing will vary widely, from zero to perhaps 30A. It will be bidirectional, depending on whether the battery is charging or discharging. The maximum current flow will probably be when the mains charger is in use.

The power consumption of the system needs to be kept fairly low, since it will be running from the 12V battery itself.

So far, I'm thinking that a Pi Zero is a good choice. I'll probably use a Zero W to allow for a wifi connection to the Internet. Some sort of ADC will be needed, and I'm considering a RaspIO Analog Zero

Once I've got an ADC setup working, measuring the voltage across the battery terminals is pretty simple. I guess a couple of 1% resistors could be needed to divide the voltage to the input range of the ADC?

But I'm not sure about how to measure the current. I've seen mention of Hall effect devices but I don't know anything about them. Is it crazy to think of using a shunt resistor and just measuring the voltage across it with the ADC? One problem with that seems to be that the voltages involved are very small - typically a maximum of 75mV with shunts like this Is there a simple way to boost that? I found another thread discussing something similar where it was suggested that an op-amp circuit could amplify the signal to give a value suitable as input to an ADC. I know little or nothing about op-amps - does anyone have a schematic (or better yet, a ready-built board) that can do that?

Finally, I'll need to find a way to power all of this from the 12V supply. That's likely to be quite noisy when the alternator or mains charger are supplying it. I've googled a bit and found references to "buck" converters - would this be suitable?

Okay, that's probably enough questions for now! As you can probably tell, I'm new to this electronics stuff, so I'll be grateful for any answers at all. :D

davef
Posts: 34
Joined: Wed Feb 20, 2013 8:39 pm

Re: Monitoring a 12v solar & battery system

Sun Apr 15, 2018 10:47 pm

A shunt is a common method. I use one in the positive lead of the battery to inverter lead. This requires a hi-side current sense chip (LTC1601). It has a DC amplifier built into it so feeding this off to a 8bit ADC would be adequate. Just FYI, I see those most UK caravan modifications seem to suggest putting the shunt in the battery negative. You will have do some research.

Also, Linear Tech make a dual hi-side sense chip which would do your bi-directional current sensing, then you wouldn't need to measure PV current or charger current. Unless you want to measure both!

Lead-acid batteries have enough voltage change with SOC that an 8 bit or 10 bit ADC is sufficient. Yes, a buck converter is a common solution. See Aliexpress.

Change to LED lighting, again Aliexpress.

Which fridge brand?

How do you plan to connect to the monitoring system?

Moe
Posts: 230
Joined: Sun Jan 25, 2015 2:44 pm

Re: Monitoring a 12v solar & battery system

Mon Apr 16, 2018 10:55 pm

Yes tis is straightforward - I have done this using ADC and resistor dividers. You don't even need precise resistors; you just calibrate your software against a meter. You can get current sensors on Ebay up to 100A that output a small voltage related to current that you can also measure with the ADC. No need to measure shunt voltages.

Your choice of an adjustable buck module is good , as you can use that as a variable voltage source for the calibration. It also lets you increase the output to compensate for volt drops when the system is under load, which the Pi can be fussy about.
Submarine communication systems engineer and amateur robot enthusiast.

Lorcan
Posts: 4
Joined: Sun Apr 15, 2018 11:24 am

Re: Monitoring a 12v solar & battery system

Mon Apr 16, 2018 11:50 pm

Hi davef and Moe

Thanks a lot for taking the time to reply, your information is very useful!

@davef: Googling with what you told me, I guess the bi-directional chip is the LTC6104? It looks ideal for this application. I'd just need to figure out which version to get LTC6104CMS8, LTC6104IMS8 or LTC6104HMS8? (I have no idea what those suffixes mean. The "MS8" is presumably "8-pin MSOP" but the "CM", "IM" and "HM"? I can see that I have a lot to learn...) After that, I'd need to figure out how to solder the little blighter. Maybe an adapter board would help?

@Moe: Is this the sort of current sensor you mean? ACS712 It certainly seems simple enough to use - and costs less that I expected.

Does anyone know the pros and cons of shunt & amp vs hall effect sensor? Does either of them consume less power, or give a more stable output, or anything? Or is it just down cost and personal preference? (For my part, I understand Ohm's Law fairly well - the Hall effect, not so much...)

Glad you both agree on the buck module being suitable - I've already ordered a few. :) Most lights are already LED, will be replacing the rest soon.

@davef: the fridge is an early-90s version of the Waeco MDC 90. The data plate doesn't have a wattage rating, just "Connection: 12V / 5A" Its modern descendant is rated at 45W but I imagine it's way more efficient than mine.

@davef: you asked how I intend to connect to the system. I'm hoping to use an old Android phone (connected to the Pi using USB tethering) to provide an internet connection. The Pi - or a powered USB hub - will keep the phone charged. It seems that the GPS on the phone can also be shared over USB, so in the future I may be able to use that to provide a location tracking function on the Pi. It could be useful to get notified if someone steals the van and drives off in it...

Again, thanks for the replies.
:thumbsup:

davef
Posts: 34
Joined: Wed Feb 20, 2013 8:39 pm

Re: Monitoring a 12v solar & battery system

Tue Apr 17, 2018 1:27 am

Lorcan,

Regarding the LTC6104 send me a private message.

I think HM is a high voltage version, which I use for my 26V house bank system. You won't need that variant.

Well, the shunt does consume some power as there is a voltage drop across it. The Hall effect module also. I would have to crunch the numbers to see which one is more efficient. With the shunt you also have to include the stand-by current of the hi-side (lo-side) current sense.

I use a shunt on the main battery supply. I use a Hall-effect for sensing mains current draw in another application. You don't need intimate Hall-effect knowledge to use them.

I thought Waeco fridges had a fairly reputation for efficiency. I also thought compressor run fridges were more efficient than an absorption fridge. Could be wrong. I use a new Samsung digital inverter fridge in the house and they are very efficient, ie about 400Watts/hours per day.

Sounds like you have your connection all sorted.

User avatar
Gavinmc42
Posts: 2099
Joined: Wed Aug 28, 2013 3:31 am

Re: Monitoring a 12v solar & battery system

Tue Apr 17, 2018 2:27 am

I use LTC2945, these are good up to 80VDC and give voltage, current and power.
http://www.analog.com/en/products/monit ... c2945.html

Even used them for series panels with i2c isolators as they can steal power from the panels with internal voltage regulator.

The shunts I have used, up to 100Amp have small resistances, 50mv drop at max current.
https://www.techbrands.com/store/product/qp5412.aspx
https://www.techbrands.com/store/product/qp5415.aspx

To get a really good idea of the battery you a coulomb counter type chip.
Something that measures current in and out, LTC2944?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Lorcan
Posts: 4
Joined: Sun Apr 15, 2018 11:24 am

Re: Monitoring a 12v solar & battery system

Tue Apr 17, 2018 7:32 pm

@davef: Yes, I guess I should work out the power consumption of each approach and get a definitive answer on that. I'll do that before making any decision. I have a feeling the consumption won't differ hugely either way.

As for the fridge: Waeco are probably about as good as they get. I think you're right about the relative efficiency of compression and absorption fridges - the compressor is far more efficient. But the most common fridge in motorhomes is a "3-way" absorption fridge - so called because it can be run on 220V (when hooked up to mains), 12V (when travelling) and gas (the rest of the time). The fact that the fridge mainly runs on gas means that its inefficiency is far less important. The 12V option is only used when travelling, as gas is meant to be shut off at the cylinder for safety reasons while the vehicle is moving. In 12V mode, the 3-way fridge is very poor - it barely keeps the contents cold if the door is kept closed. And they're trouble; I'm a member of several motorhome groups on Facebook and it seems that a the most common posting starts with "Help! Our fridge won't work on gas..."

So compressor fridges demand a lot of capacity in the 12V system, since they draw power from it alone. The 3-way fridge puts almost no load on the 12V battery, as it is generally only drawing 12V while the engine (and therefore the alternator) are running. That's why the type of fridge is a huge factor in sizing the batteries and charging system in a motorhome.

I really like my compressor fridge, and I'm keen to build a 12V system that is sufficient to keep it happy. Got to ensure an adequately-chilled beer supply, after all... :) Right now, we can't stay off grid from more than one night at a time, but I plan to fix that with new batteries and a better solar setup. (The existing battery is at the end of its life and the panels are ancient and low-power.) The idea of the Pi system is to let me monitor the system so that I can run it properly and choose which parts to upgrade.

@Gavinmc42: Thanks for telling me about the LTC2945. That's an interesting option - looks like it could make for a very neat solution. I've already ordered an ADC board (the Analog Zero) but I guess that could always be used for something else.

That LTC2944 looks like a serious bit of kit. I like the name "Coulomb Counter", it describes the concept pretty well. The datasheet calls it a "Battery Gas Gauge" which confused me. I was trying to think how it might detect hydrogen gas leaking out of a lead-acid battery until I realised they were using "gas" in the American sense of "petrol"; so it's like a "fuel gauge" for you battery, which tells you how fully charged it is, just like gauge in your car tells you how full the petrol tank is. Terminology can be confusing... Anyway, that looks like something I'll need to read more about.

Right now, I'm a little confused. So many options - but at least it sounds like there are several that would work, so I just need to choose one and get on with it.

Thanks again for the help! It's greatly appreciated.

User avatar
Gavinmc42
Posts: 2099
Joined: Wed Aug 28, 2013 3:31 am

Re: Monitoring a 12v solar & battery system

Tue Apr 17, 2018 9:44 pm

Look for a Lead Crystal battery to replace the old one, twice the price but longer life.
So "they" say. ;)
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: No registered users and 8 guests