Tech: Boat Alarm, a free boat monitoring system

STOP PRESS: I've found the CC3000 WiFi shield to be unreliable and have a new client that uses the ESP8266 instead. Please read this blog post too.

A couple of months ago I made the one-hour trip down to Wirrina Cove, where Arriba is berthed, only to find that the shore power circuit breaker had tripped in my absence. I'd left the fridge running in anticipation of my next sailing getaway, but without shore power and sufficient solar power, I was greeted with dead batteries! So much for a fast getaway with an icy one in the fridge. I vowed never again, and set about investigating boat monitoring systems.

There are several commercial systems available, but why pay for one when you can do it yourself for under $50, with no recurring fees? I therefore set about to develop my own boat monitoring system which I've unimaginatively called "Boat Alarm."

There are two parts to Boat Alarm, the client and the service. The client is a program ("sketch") running on an Arduino device installed on your vessel, with wired connections to batteries and other devices being monitored. The client must also have a connection to the Internet in order to be able to reach the service. The default client implementation uses an Arduino "WiFi Shield" to communicate with an onboard wireless access point. You can download the source code for the client here.

The service is a Google Cloud Platform App Engine program which listens for alarms and sends notification emails. Notifications are sent at most once an hour. The service is also how you register your vessel with Boat Alarm, which you can do here. You can either use this free service or, if you're familiar with App Engine, you can download the source code here and run your own instance. You can read more about the service here.

Version 1 of Boat Alarm implements two alarms, namely loss of shore power and battery voltage drop. The following photo shows the installed system. The grey plastic box neatly contains both the Arduino Uno and the WiFi shield. It is powered by an automotive (12V) USB adapter from Arriba's house batteries (the black coiled power cord). There are two analog input connections. The left, solid black wire is connected to Analog Pin 0 and monitors shore power, by means of measuring the mains USB adapter output. The right, red and black wire is connected to Analog Pin 1 via a 3:1 voltage divider and monitors battery voltage. That leaves 4 unused analog pins and 8 unused digital pins to measure other vital signs.

BTW, the WiFi access point is the white, wall-mounted device in the rear, which connects to the Telstra 4G network via an external antenna. It has an internal battery, which is also charged from an automotive USB adapter, but can run for several hours without external power.

Boat Alarm installed.
Here is what the output from the client looks like if you hook up a serial monitor:

Boat Alarm v1.0
Polling...
Checking...
Pin 0: 1016=4965mV OK
Pin 1: 918=13710mV OK
Comparing...
← Here I unplugged the shore power
Comparing...
Change detected!
Checking...
Pin 0: 0=0mV FAIL
Triggered Power:ShorePowerLoss
Pin 1: 918=13710mV OK
Comparing...
← Here I plugged the shore power back in
Comparing...
Change detected!
Checking...
Pin 0: 1023=5000mV OK
Pin 1: 920=13740mV OK

Here's what is happening. Upon startup Boat Alarm polls each pin. Analog pins 0 and 1 measured 4.965V and 13.71V respectively, i.e., both OK. Boat Alarm then wakes up every 5 minutes, re-reads analog pins and compares with previous values, emitting "Comparing...". If a change is detected Boat Alarm then checks measured values against expected values, emitting "Checking...".  In the above sequence, I simulated a loss of shore power by disconnecting the mains USB adapter, which resulted in a FAIL on Pin 0, which in turn triggered an alarm. Reconnecting shore power resulted in another change, but OK measurements do not trigger alarms.

Here's the shopping list:
The only other thing you need is an Internet connection, which could be an old phone running tethering mode on a cheap pay-as-you-go mobile plan, or your marina's free WiFi if you're so lucky!

Please give it a try and let me know what you think.

OVER

Boat Alarm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.