Sunday, April 20, 2014

Keeping An Eye On Things: A Boat Monitoring System

It is a good idea to monitor boat systems in order to detect problems before they become major problems. Collecting basic information like engine operating temperatures, refrigeration system temperatures, and battery performance information are a few examples. It is best to gather an information baseline when everything is operating correctly so that abnormal readings are easy to identify. A manual method of recording the information is easy - just record the measurements on paper. Transferring the information to a spreadsheet makes it easy to display as graphs, making it easy to spot trends that may indicate a pending problem.

IR Thermometer Gun
We've been recording engine temperature readings for some time, but only doing it on a sporadic basis and putting the data into a spreadsheet. Even with the sporadic measurements, we've developed a baseline that allows us to determine if there is a problem with one of the engines. (Note: We recommend that everyone capture the data to create a baseline of engine operation. An IR thermometer isn't terribly expensive ($40-$90 on Amazon) and is a great diagnostic tool. Put one on your gift list for your spouse/SO to buy for you.) We have a remote temperature sensing system to show us the refrigeration system temperatures (freezer, fridge, compressor housing). But there is no historical information stored that allows us to determine if (or when) the system is experiencing problems.

My "day job" is computer network design and monitoring, which requires automated systems to collect the large volume of data. Applying those same principles to boat monitoring led me to automate data collection using a single board computer known as a Raspberry Pi. The other attractiveness is that it is a cool project. I'll refer to the Raspberry Pi as "RPi" in the rest of this post. I'm starting with temperature monitoring and will add other features as I go.

I plan to monitor the temperatures listed below. The engine temperature readings are the same as what we've been manually monitoring. We have the Oregon Scientific Clock Weather Forecaster BAR206A and THN132N Wireless Temperature Sensors for monitoring the refrigeration system, but have not recorded measurements. Manually recording refrigeration system temperatures would be useless because of the changes in temperature after the door was opened. Automated temperature recording would let us know how long it takes to return to the desired operating temperature.

Raspberry Pi with Pi Plate Development Board and Acrylic Enclosure
* Ambient air (clipped to the back of the DC panel)
* Freezer plate
* Freezer mid-rack
* Refrigerator mid-rack
* Refrigeration compressor cabinet
* Port and Stbd water heater
* Port and Stbd air conditioners
* Port and Stbd engines
  - Alternator frame
  - Exhaust mixing elbow
  - Raw water inlet
  - Oil pan
  - Cylinder head (one sensor - the ideal would be one next to each injector)

This photo shows the RPi with the attached Pi Plate development board in an acrylic enclosure. The is the fully assembled unit. It measures 6in x 3in x 1.5in. In the foreground is one of the waterproof temperature sensors, which is attached to the white cable that connects to the board. My prototype has three sensors, which I've labeled freezer, fridge, and compressor.
Sample Hourly Temperature Graph

I have a script (a small computer program) that periodically creates graphs of the collected data. All three temperatures are shown on one graph. I'll wait until I get on the boat to refine what types of graphs I want.

The Details

The temperature probe is the DS18B20, which is available in a waterproof version (we'll see, they are probably only water resistant) from sellers on Ebay (search for "waterproof DS18B20"). I found that connecting the DS18B20 using all three wires (Ground, Data, +3.3v) worked the best. I used a "Pi Plate" development board for connections between the RPi and the DS18B20. All sensors can be connected to the same 3-wire bus, which I'll snake around the boat to all the locations. The operating system supports up to 10 temperature sensors. That's not enough for my purposes, so I'll have to generate a new kernel to support many more sensors, probably 30.

The Internet contains many examples of interfacing the DS18B20 temperature sensor with the Raspberry Pi.

I am using the Round Robin Database (RRD) to store the sensor values. RRD is typically used for network management functions. It is very simple and does a good job of storing and displaying time-series data. The current implementation stores a month of samples. I have plenty of storage space and RRD is very efficient, so I'm planning to increase it to several months so that we can see longer term trends.

12V to USB Power Adapter
I needed a way to power the RPi on the boat. The easiest solution was to modify a 12V to USB adapter. This photo shows the adapter with two new wires soldered to it. I wrapped the modified adapter in heat shrink. The red wire connects to an in-line fuse for connecting to the boat's 12V system.

I'll be publishing the scripts that I've developed for this system so that anyone can make their own and can contribute to it.


No comments: