Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 28-10-2015, 07:33   #1
Registered User

Join Date: Jun 2015
Location: USA/Hungary
Boat: Dufour 382 38'
Posts: 20
DIY battery/shore power/tank monitor

The factory tank/battery level instrumentation of my new boat (see picture attached) is surprisingly simplistic - or at least I was a bit surprised . It is a single gauge with a set of scales and three double rocker switches. By pressing the switches on either side the needle will slowly climb and show the level of the water tanks, fuel tank and house battery (voltage). That’s it. As a gadget-fan I decided to launch a small DYI project to extend the existing functionality.

The goals are:
  • do not interfere with the existing cabling and instruments (any more than absolutely necessary)
  • monitor shore power voltage, amps drawn and frequency, along with keeping total of power consumption over any period
  • monitor holding tank level (has no sensor in factory configuration) and all other tanks
  • monitor battery voltages and electrolyte temperature (to give a better SOC estimate) for the bow thruster and starter batteries
  • monitor battery voltage, electrolyte temperature and amps drawn/charge amps for the house battery bank, also to give a better SOC estimate, along with total battery power consumption over any period
  • the gadget should be able to maintain data over power loss
  • the user input “interface” has to be as simple as it can be, possibly a single pushbutton
  • small size (so that it can be built in the existing cutout for VHF radio (1” x 3” for the display plus a single button is the absolute minimum cutout size)
  • switch on-the-fly between customary and metric units
Decided to go with a micro controller (ATMega 1280) and 4x20 backlit LCD display for low power consumption and simplicity’s sake. See the other "screenshots" of various planned display outputs.

If anyone is interested in this I’ll go ahead and post about the pondering, design and implementation phases of the project. Hopefully will finish this by next Spring
Attached Thumbnails
Click image for larger version

Name:	instrument.jpg
Views:	190
Size:	211.6 KB
ID:	111708   Click image for larger version

Name:	main screen.png
Views:	145
Size:	34.4 KB
ID:	111709  

Click image for larger version

Name:	battery.png
Views:	141
Size:	54.0 KB
ID:	111710   Click image for larger version

Name:	tank level.png
Views:	136
Size:	37.4 KB
ID:	111711  

Click image for larger version

Name:	shore power.png
Views:	132
Size:	22.5 KB
ID:	111712  
__________________

__________________
Csory is offline   Reply With Quote
Old 28-10-2015, 07:54   #2
Registered User
 
leftbrainstuff's Avatar

Join Date: May 2011
Location: San Francisco and Australia
Boat: Liberty 458
Posts: 1,979
Re: DIY battery/shore power/tank monitor

Neat

Sent from my SM-N900T using Cruisers Sailing Forum mobile app
__________________

__________________
leftbrainstuff is offline   Reply With Quote
Old 28-10-2015, 09:32   #3
Registered User

Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 3,541
Re: DIY battery/shore power/tank monitor

Keep us posted please

If you've been looking at the atmega 1280 you might have come across the arduino series of microprocessors which would be well suited to a project like this. My fridge thermostat is an Uno, And recently an engine temperature logger. They're very cheap, logging is easy with a RTC/SD card shield for a clock and sd card. Temperature is easy using ds18b20 sensors Votage is pretty easy with a voltage divider into an analog input.

The fidge Uno I use has a bluetooth transceiver fitted as well so you can program the temp using a smartphone.

All in all arduino is a very versatile device, lots of online help, cheap and very low power.

It might be worth dipping your toe into SignalK if you're feeling adventurous, early days but one day it might be a common format to save any and all boat data in.

Good luck and share your successes


(must get round to tidying up that display layout )

And recently an engine temperature logger -
__________________
conachair is offline   Reply With Quote
Old 29-10-2015, 13:54   #4
Registered User

Join Date: Jun 2015
Location: USA/Hungary
Boat: Dufour 382 38'
Posts: 20
Sensors and whatnot

Thanks for the replies and suggestions - please keep them coming! I have checked out the Arduino series and it looks rather like a standardized set of breakout boards than a microprocessor by itself? The “Arduino Mega” is a good match for this project - might as well order one with the necessary “shields” and save loads of soldering and panel etching while prototyping…

Here are a few more functionality ideas that I will add to the original ones:
  • user adjustable tank level curves - calibrate the system filling the empty tanks in small increments and let the system register readout values
  • remote connectivity option for telemetry and logging over internet
  • ultra-low power consumption (with power-managed sensors that shut down when not in use)
  • ability to monitor inverter(s) in terms of current load and over-the-time utilization
  • user selectable battery chemistry (starter, AGM, deep cycle etc)
  • self calibrating menu (to adjust for current sensor zero drift and voltage drop over cabling)
Ok, here are the basics of measuring all the above:

Shore power: 6V transformer to provide safe low-voltage feed for the rectifier bridge / voltage divider (to measure VAC) and an optocoupler (to trigger interrupts for frequency counting). Hall-element sensor for current measurement (currently eyeing with the CSLA1CD, 4 windings would work up to 16A, less for more).

Bow thruster and starter batteries: LM35 or similar temperature sensors glued to the side of the battery, measurement of battery voltage (shielded direct cable run) fed through voltage dividers.

House battery bank: temp and voltage same as with the thruster battery, load and charge current monitored again via a hall sensor element such as the CSLA1CD. This would give me max reading of 65 Amps but is completely resistant to over current so no worries… I have assessed the current draw (see attached table) and found that the windlass (60A) is the single biggest load. I’m willing to sacrifice current measurement over those few seconds when running the windlass for the sake of more precise measurement of “regular” loads in the range of a few ten amps. Also, the current sensor requires precise reference voltage - I can either go with a buck regulator and feed 9V most of the time to the sensor or go with a proper booster reg to get 12V no matter what the battery voltage is. Other sensors require 5V - no problem.

Tank levels: Will use the existing float sensors in water tanks and fuel tanks, reducing the problem to measuring resistance but will calibrate readouts to offset for irregular tank shape. As for the holding tank, hope to get around the problem with adding four small load cells under the tank. This seems to be the simplest solution to measure black water level. Fortunately the holding tank is a simple cubic thingy conveniently tied down on a narrow shelf - see attached picture.
Attached Thumbnails
Click image for larger version

Name:	holdingtank.jpg
Views:	117
Size:	69.1 KB
ID:	111810   Click image for larger version

Name:	amps.png
Views:	110
Size:	83.2 KB
ID:	111811  

__________________
Csory is offline   Reply With Quote
Old 16-11-2015, 04:38   #5
Registered User

Join Date: Jun 2015
Location: USA/Hungary
Boat: Dufour 382 38'
Posts: 20
Estimating SOC - some light math

Measuring voltage, temperature, weight and such is pretty (ehem...) straightforward. Estimating the state of charge is a different beast. This is what I figured out so far:

1. Measuring anything over a long(ish) cable with high precision is a challenge. Voltage drop, which varies by the ambient temperature, can be compensated for by using an extra wire loop to the measurement points and feeding reference voltage through it. I plan to use the 5-wire "alarm cable" which has solid copper conductor, yet flexible and thin enough to be easily routed around. If the resistance is too much I might have to fall back to regular power cables (AWG 16 or 1.5mm2). Let's assume that I have acceptable (in terms of precision) values across all sensors - how am I gonna turn that into SOC%?

2. There are various tables across the internet providing voltage / SOC% conversions for different types of batteries, usually at no load and no surface charge, at a given temperature. I picked this table from emarineinc.com for generic marine-use deep cycle batteries. For different designs (AGM etc) this table might have to be adjusted.

3. Battery capacity varies with electrolyte temperature. To compensate for this I'll attach a temperature sensor to the side of the batteries and take that into account. Why not just a single ambient temperature sensor? Well, batteries can get pretty hot pretty quickly while being charged or discharged and there is no guarantee that all 3 batteries will have the same temperature. The correction factor is 0.024 Volts per ten degrees Fahrenheit, with no correction applied at 80F.

4. Apparent SOC will drastically drop under load - because of the voltage drop. To take this into account I plan to measure load current and apply correction accordingly. The second diagram shows voltage drop for different loads (not in amps but in fraction of total capacity). The diagram is from the HomePower magazine's 1993 8/9 issue.

5. I decided to go with functions instead of lookup tables, so did a quick polynomial regression for table (1) which was good enough at 2nd degree, then did apply temperature correction factor and load correction (again via some trial-and-error). The end result is table 3 (see the "final" function at the bottom line). I will use this as a first shot - and keep my fingers crossed As you can see from the table, anything over 14.4V will be interpreted as the battery being charged and surface charge is also displayed though only as being ">100%" since I see no point in estimating SOC over "full" Also, if everything goes well, I might go ahead and add SOC estimate while under charge - but this might get a bit tricky if the charger itself is temperature compensated.
Attached Thumbnails
Click image for larger version

Name:	SOC.png
Views:	109
Size:	62.7 KB
ID:	113123   Click image for larger version

Name:	load_SOC.png
Views:	638
Size:	98.3 KB
ID:	113124  

Click image for larger version

Name:	Battery SOC.png
Views:	110
Size:	124.8 KB
ID:	113125  
__________________
Csory is offline   Reply With Quote
Old 16-11-2015, 07:11   #6
Registered User
 
transmitterdan's Avatar

Join Date: Oct 2011
Boat: Valiant 42
Posts: 4,030
DIY battery/shore power/tank monitor

Trying to estimate SOC from all these variables is probably not going to be very satisfying for you. There are 2 industry methods in wide usage these days.

The first type are the so-called "coulomb counter" devices. These are by far the most common. They work on a very simple principle. They integrate the current in and out of the battery bank. The shunt or Hall effect sensor must be placed so that it can see the net current including all loads and charging sources. There is a well known equation derived by a guy named Peukert that uses a single constant to compensate for various lead acid battery types. This same equation will work for lithium batteries too. The Peukert integrator has to be "reset" every so often to compensate for small errors that build up over time. Typically the reset is done by charging the battery bank to full over a 24 hour period and then telling the integrator to set itself to 100% full scale. Another variable is the total size of the bank in AH (aka coulombs, aka watt-hours).

The other type of SOC system is purely based on voltage. The algorithm is not published but users report that it works as well or better than the integrator type and does not require periodic resetting.

Measuring things over long cables is not hard. The trick is to make sure there is negligible current in the measurement wires.
__________________
transmitterdan is offline   Reply With Quote
Old 16-11-2015, 10:01   #7
Registered User

Join Date: Jun 2015
Location: USA/Hungary
Boat: Dufour 382 38'
Posts: 20
Re: DIY battery/shore power/tank monitor

Dan,

Thanks for your insights and tips. The Coulomb-counter is something I'm trying to avoid - it seems to be quite hard to measure amps with the required precision (I could use multiple Hall sensors across the 0..300A range but that would be a bit complicated again). It is the voltage-based measurement I'm going for, with the load current and temperature added for more precision. Or so do I hope
__________________
Csory is offline   Reply With Quote
Old 16-11-2015, 10:50   #8
Registered User
 
transmitterdan's Avatar

Join Date: Oct 2011
Boat: Valiant 42
Posts: 4,030
Re: DIY battery/shore power/tank monitor

Quote:
Originally Posted by Csory View Post
Dan,

Thanks for your insights and tips. The Coulomb-counter is something I'm trying to avoid - it seems to be quite hard to measure amps with the required precision (I could use multiple Hall sensors across the 0..300A range but that would be a bit complicated again). It is the voltage-based measurement I'm going for, with the load current and temperature added for more precision. Or so do I hope
I think you will be plowing new ground. I am unaware of any commercial product that estimates SOC based on this suite of measurements.

It is not that hard to get accurate current readings from a current shunt. This is done all the time and does not cost a lot of money for components. But it requires a high degree of design skill. One has to know about things like "guard rings", bias current, offset current and other esoteric parameters and techniques.
__________________
transmitterdan is offline   Reply With Quote
Old 10-03-2016, 08:59   #9
Registered User

Join Date: Jun 2015
Location: USA/Hungary
Boat: Dufour 382 38'
Posts: 20
Circuits galore...

Ok, started working on an electronics prototype. The inputs/functions/peripherials are:

SOC estimating:
- battery temperatures on all 3 battery sets (thruster, house, starter)
- battery voltage on all 3 battery sets
- current drawn on house batteries

Shore power related:
- shore power voltage
- shore power frequency
- current drawn on shore power

Tank levels:
- water tank levels, using float-type (resistive) sender
- fuel tank level, using float-type (resistive) sender
- holding tank level, using 4 load cells (weight measurement)

Environmental monitoring:
- water heater temperature (just because I can...)
- barometric pressure and salon temperature, BMP085
- humidity and salon temperature, DHT-22

User interface:
- 6 buttons (4 directional "arrows", a green OK and a red CANCEL)
- 4x20 alphanumeric LCD with adjustable backlight
- GSM modem module for text messaging and posting results on the web

Attached please find bits and pieces (from EagleCAD schematics). The +16V power supply and most of the sensors/modules can be turned on or off from software to save power when not in use.

Modules are:
AI_D=Analog Input with voltage divider
AI_DS = analog input with divider and switch
AI_ND=analog input (no divider or switch)
Attached Thumbnails
Click image for larger version

Name:	PSU_5V module.jpg
Views:	104
Size:	42.1 KB
ID:	120360   Click image for larger version

Name:	PSU_16V module.jpg
Views:	103
Size:	51.7 KB
ID:	120361  

Click image for larger version

Name:	AI_D module.jpg
Views:	96
Size:	22.2 KB
ID:	120362   Click image for larger version

Name:	AI_DS module.jpg
Views:	93
Size:	32.6 KB
ID:	120363  

Click image for larger version

Name:	AI_ND module.jpg
Views:	92
Size:	19.0 KB
ID:	120364  
Attached Files
File Type: pdf BoatPanel.pdf (48.7 KB, 32 views)
__________________
Csory is offline   Reply With Quote
Old 10-03-2016, 09:27   #10
Marine Service Provider
 
Maine Sail's Avatar

Join Date: Jan 2007
Location: Maine
Boat: CS-36T - Cupecoy
Posts: 3,060
Re: DIY battery/shore power/tank monitor

I know the white paper you grabbed this graph from quite well:



Unfortunately it is only valid for that battery bank tested, an L-16 bank and at that banks state of health. The author feels it can be broadly applied but I have proven it rather vastly and grossly inaccurate numerous times.

If you start with bad data you beget worse SOC data especially with batteries.

Here is just one experiment that shows how badly the chart above applies as well as the SOC vs. voltage charts often found on-line:

Battery SOC vs. Voltage

Predicting SOC is a very, very difficult problem to solve and as of yet the only product I have seen that even comes close is the Smart Gauge.

Ah counters have many great features but accurately predicting SOC is not one of their strong points. For example a 12V lead acid battery is nowhere near fully charged when voltage hits/attains 14.4V. A lead acid battery still has many, many hours to go before even beginning to approach 100% SOC.

If you PSOC cycle, as we do on boats, you will also have vastly differing charge efficiencies to account for. Charge efficiency is not a fixed % unless you cycle back to 100% SOC after each discharge from the same exact SOC point, at the same temperature, each time. Then and only then could you say that charge efficiency is 90% or 88% etc.. In reality charge efficiency varies widely from as high as 99 +/-% in bulk to as low as 35% +/- in the SOC ranges above 95% SOC.

Accounting for temp is good but charge rate, discharge rate (Peukert), sate of health, Coulombic efficiency etc. all play a major roll too.

Batteries also change as they age with regard to Peukert, voltage support at varying SOC's, capacity, charge efficiency etc. and any good SOC meter would need to change with the battery to get anywhere close to giving a reasonable representation of SOC. Perhaps just monitor voltage and let users figure it out from there...
__________________
Marine How To Articles
Maine Sail is offline   Reply With Quote
Old 11-03-2016, 05:39   #11
Registered User

Join Date: Jun 2015
Location: USA/Hungary
Boat: Dufour 382 38'
Posts: 20
Re: DIY battery/shore power/tank monitor

Hi Maine Sail,

Thanks for the heads-up. The "trigger" of starting this project was the (rather surprising) fact that my new boat has no battery monitor for the house pack - zilch, zero, nada. The only battery related information that comes up on the switch panel is the voltage of the starter. The goal was to put up as much data on my "boat panel display" as possible, wile also having some fun I'm aware of the many problems with giving a SOC estimate and will provide raw battery voltage too - just could not resist to making this info-center thingy a bit more elaborate
__________________
Csory is offline   Reply With Quote
Old 11-03-2016, 11:44   #12
Marine Service Provider
 
Maine Sail's Avatar

Join Date: Jan 2007
Location: Maine
Boat: CS-36T - Cupecoy
Posts: 3,060
Re: DIY battery/shore power/tank monitor

Quote:
Originally Posted by Csory View Post
Hi Maine Sail,

Thanks for the heads-up. The "trigger" of starting this project was the (rather surprising) fact that my new boat has no battery monitor for the house pack - zilch, zero, nada. The only battery related information that comes up on the switch panel is the voltage of the starter. The goal was to put up as much data on my "boat panel display" as possible, wile also having some fun I'm aware of the many problems with giving a SOC estimate and will provide raw battery voltage too - just could not resist to making this info-center thingy a bit more elaborate
I fully understand!!
__________________
Marine How To Articles
Maine Sail is offline   Reply With Quote
Old 12-03-2016, 00:39   #13
Registered User

Join Date: Apr 2007
Location: Australia
Boat: Island Packet 40
Posts: 1,376
Images: 7
Re: DIY battery/shore power/tank monitor

Might I make a suggestion folks?


As a now fairly long term house battery user who attempts to always only use about the top 25-30% of the amp hours available from my house battery bank I tend to get nervous when the battery voltage gets down to a certain point.


Since I have a number of charging systems some of which depend upon the brightness of the sun, cloud cover and wind speeds and occasionally how much motoring I have done the in/out balance and system battery voltages vary considerably.


However, if I was to monitor and log the ins and outs and snatch an occasional unloaded/non charging voltage measurement could I calculate say an battery performance profile and use it to forecast the percentage of usable amp hours remaining before I reached the panic point at which I get frantic about contingency methods to pump some more amp hours in.


In summary, the usable remaining without serious battery capacity degradation would be estimated using a both a hindcast and forecast. The longer term deviation might also be used to evaluate battery condition.


I like the idea of settling on the Arduino, there are enough of them out there to ensure a probability of them remaining available, a library of programs could be established to allow a fairly standardised set of functions, both programming, and hardware specific and the economics and availability of the various devices appear propitious.
__________________
RaymondR is offline   Reply With Quote
Old 14-03-2016, 03:15   #14
Registered User

Join Date: Nov 2014
Location: Germany
Boat: Beneteau Sense 43
Posts: 53
Re: DIY battery/shore power/tank monitor

Just noticed this thread - interesting project, I have been working on something similar for our boat.

My primary objective for my own setup is to have some way of controlling some of the electrical components, e. g. switch the alternator regulator to small engine mode (50 % output reduction), switching charging completely off etc.
Secondary is monitoring: temperature and battery cell voltage.

My approach is a little different hardware and UI-wise. I am using a Particle Photon as main processor https://docs.particle.io/datasheets/photon-datasheet/
Coolest micro controller I have ever touched. API and programming environment is close to Arduino, but programmable via WiFi (!)
(I also have a Particle Electron which possibly will be used as an "asset tracker" in the future)

After some thought about user interfaces I decided to use a programmable touch LCD (240 x 180 pixels), connected via I2C: EA eDIP series Serial Graphic - ELECTRONIC ASSEMBLY
This device has some built-in intelligence, it is possible to render buttons, switches and sliders with some sort of high level command language, making UI design much easier.

Regarding sensors:
Temperature measurement will be via a bunch 1Wire DS1820 sensors.

I am adding a NMEA 2000 interface section (via a MCP2515 and MCP2551), via https://github.com/ttlappalainen/NMEA2000 it will be possible to read and write NMEA 2k PGNs.

Alternator tach output (from a Balmar MC614) will be connected to an input pin (configured as an interrupt) via an opto coupler. That way I can measure engine speed. And using the engine diagram depicting fuel consumption vs. engine RPM it is possible to roughly estimate fuel flow.
In conjunction with the N2K section it will be possible to inject NMEA2k data indicating fuel flow. Our B&G Chart Plotter will then be able to display roughly estimated fuel flow allowing for RPM efficiency optimization. This is done purely because I can.

Battery monitoring: I'm using a BMV 700 for monitoring the LiFePo4 bank. Propagating it's SoC information is low priority for now.

Cell voltage monitoring: not yet decided on a suitable chip for cell voltage monitoring. Still searching for some simple I2C chip with four differential high precision channels, preferably in DIP package. Needs more investigation.
__________________
mbartosch is offline   Reply With Quote
Old 21-06-2016, 05:57   #15
Registered User

Join Date: Jun 2015
Location: USA/Hungary
Boat: Dufour 382 38'
Posts: 20
Re: DIY battery/shore power/tank monitor

Slowly inching forward... Redesigned the PSU so that the idle power consumption will be much lower, from LM2577 to MAX1651. Also created a small "universal" panel to accomodate either a CSLA series current sensor or a TO92 packaged temperature sensor, along with an RC filter and a shunt cap (optionally). Also considering switching from LM35 temp sensors to DS18B20 to cope with long cable runs. The main PCB is about 5"x3", will fit nicely next to the current switch panel.
Attached Thumbnails
Click image for larger version

Name:	IMG_1752.jpg
Views:	69
Size:	443.2 KB
ID:	126669  
__________________

__________________
Csory is offline   Reply With Quote
Reply

Tags
battery, monitor, shore power

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing Tank Watch Monitor in new holding tank SV Demeter Plumbing Systems and Fixtures 2 27-08-2012 09:47
For Sale: Shore Power Inlet, Battery Charger, A/C Panel pressuredrop Classifieds Archive 6 22-04-2011 01:31
Battery Charging - Shore Power ianhef Electrical: Batteries, Generators & Solar 21 05-06-2010 05:23
110vac / Shore Power / Battery Combos Finding Id Electrical: Batteries, Generators & Solar 14 04-08-2009 16:52
Battery Charger, Shore Power and Generator? motion30 Electrical: Batteries, Generators & Solar 13 20-06-2009 15:02



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 20:45.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.