It’s summer time and for some of us that means sunshine, outdoors, and water. If you are lucky enough to live near an ocean or lake and you are a boat owner, that can also mean that it’s boat time.
During the summer months it is much easier to monitor your boat because you are always on it. What happens when summer ends and you need a way to make sure things are sitting smoothly while you are away? Some boat monitoring systems can run you thousands of dollars and be a pain to install. What if there was a way to spend less and still be able to monitor your boat in real-time and get alerts when things go awry?
This is a DIY solution using a Raspberry Pi, some electronics, and Initial State to monitor your boat, so you can have all the data when you are on it and when it’s in the slip. You can monitor temperature, battery voltages, shore power, and bilge pump cycles. This remote monitoring solution allows you to monitor your boat from anywhere in the world. It will give you a peace of mind knowing your boat is safe and secure.
There are a lot of reasons why you would want to know what is going on with your boat in the slip. For example, let’s examine bilge pump cycles. As the name suggests, bilge pumps pump water. They push water out of the bilge (lowest point on the inside of the boat) so that your boat doesn’t sink. Water can get into your bilge a multitude of ways: spray while driving the boat, rain and storms, missing plug. Today most bilge pumps are automatic but what happens if one fails? Being able to monitor how often your bilge pump is cycling can give you assurance yours is still in working condition and is pushing the bilge water out.
Let’s next look at shore power. Shore power is what you use for power when you have your boat docked and not running. This not only charges your battery but also lets you run AC powered devices on your boat. Constant shore power during the winter months is necessary to keep your batteries charged and Pi running. And if the power is out, who knows what else might be wrong. You can’t monitor your boat if you Pi is dead.
Lastly, battery voltages and temperature are a no brainer. Is the temperature too hot or too cold? Is that going to affect your boat and the devices on it? Are your batteries dead and need to be replaced? This kind of general information is important to have a clear picture of the health of your boat.
This project was implemented by the very smart and very creative John Poindexter. John was gracious enough to let me share this project with the world so please enjoy.
Basics of What You’ll Need
First things first, you’ll need a boat. The boat used in this project was a 1990 Hunter Passage 42 sailboat. While this project is tailored to this boat, you can modify what is documented to fit your boat.
Initial State to log data, view real-time conditions, and send alerts.
KiCad for interface board layout or PCB design.
Netgear AirCard 815S mobile hotspot for internet connectivity.
A few miscellaneous electronic accessories for your interface between the boat inputs and the Raspberry Pi.
*Note: This project is not for the faint of heart. This is one for those who like a challenge and enjoy building their own systems. When it’s all said and done, you’ll feel good knowing you built it yourself.
I recommend using a Raspberry Pi 3 or Raspberry Pi 4. It can connect to WiFi and send your data to a real-time monitoring solution. If your Pi isn’t already set up, you can follow the instructions on Raspberry Pi’s blog to get started.
Raspberry Pi keyboard & monitor
While not absolutely necessary to this project, a Raspberry Pi keyboard and monitor make it a lot easier to work with your Pi and get things done. The Sunfounder monitor and Logitech Wireless Touch Keyboard K400 were both used in the making of this project.
For the keyboard to be compatible with the latest version of Raspbian, you’ll need to install Solaar. Solaar is a Python version of the Logitech Unifying software.
Run the following in the terminal window of your Raspberry Pi:
sudo apt-get install solaar
After installation, you can find the Solaar app under the Accessories of the Pi as well as on the top menu bar. In addition to providing a pairing function it also shows the state of the battery.
There are lots of options for Raspberry Pi monitors and keyboards. Any one you choose will be good and make working with your Pi easier.
This mobile hotspot is used since marina WiFi can be unreliable for continuous connectivity. Really any mobile hotspot will do, you just need something that allows you to be continuously connected to WiFi. Follow the directions for the device you buy to set it up.
You’ll want to connect your Pi to the WiFi (whether marina or hotspot). Your hotspot will have 3 passwords: WiFi password, guest password, and admin login password. You can use the WiFi password to connect your Pi.
Your hotspot does have a battery but to keep it continuously running you’ll want to leave it plugged in. This is also why shore power is so important. Without power your Pi and hotspot both die, which will require an in person visit to resolve.
Initial State is a data visualization software that can be used for real-time data monitoring and historical data evaluation. While this is the data visualization platform that is used for this project, you can use any platform that allows you to send in data via an API.
Initial State offers a free tier for students with an active edu email address, an individual tier for hobbyists and prototypers for $9.99/month, and an enterprise tier for businesses starting at $20/month. Every account is given a 14-day free trial to test out all features and functions on the platform.
Once you register for an account, you can go to your settings and view your access keys. An access key allows you to send data into your account. You’ll use your access key in the Python script later in the article.
SSH’ing & IP Address
One of the issues that occurred while doing this project was that the Raspberry Pi IP address wasn’t static and changed frequently. This makes it difficult to remotely SSH into your Pi when you don’t know the IP address. There is an easy solution for this.
The Pi Process tutorial shows you how to monitor your Pi’s processes and it’s IP address. You can send the IP address of your Pi to your Initial State dashboard. Knowing your Pi’s IP address makes it easy for you to remotely SHH into your Pi to access it.
You‘ll need to find a copy of your boat’s schematics. You can generally find this in your user manual or online. This will help you to understand the boat’s inputs. The interface board will be a connection between the boat’s inputs and the Raspberry Pi. You can use KiCad to design the layout for the connections.
This diagram shows the entire project layout including the Raspberry Pi, boat inputs, and interface board.
This is a list of the boat inputs and what was needed for connection to the Raspberry Pi.
Bilge Pump Cycles — PTV12010WAH 12V to 5V Power, R40–11D2–12 Counter Relay
Shower Power — 3.3V Bus, Ground Bus, BTA6–2C-J-CW-120 120VAC Relay
Battery1 & Battery 2 V — Voltage Divider, MCP3008 8 Channel ADC
Temperature — 12 VDC Fan, DS18B20 Temperature Sensor
Raspberry Pi — Ribbon Cable
General Purpose Board or PCB
Now that you have your design, you’ll need to layout your interface board. You have two options for this: you can use a general purpose board with wired connections (RadioShack Universal Board) or design a printed circuit board (KiCad). A general purpose board might be easier to start with as you can easily change things around, but a PCB tends to be neater when it comes to wiring and layout.
Rather than soldering the devices directly to the board, you can use sockets and headers to make replacing devices in the future easier.
You can connect your Raspberry Pi and your boat inputs to the interface board. You should check and recheck your wiring because it would be very easy to blow your Raspberry Pi with an incorrect connection. Thankfully, Raspberry Pi’s aren’t too expensive but it’s definitely a mistake you don’t want to make so be careful.
You can view the entire python code below and at this link. What this code does is read the inputs from your boat and send that data to Initial State.
There is a single change that needs to be made within the code for you to be able to send data to your own dashboard. Line 122— Update with your access key from Initial State. You can change the bucket name and bucket key if you so choose.
Monitoring Your Data
Once everything is connected and your Pi is running the Python script, you should start receiving daily data updates on Initial State. When the data first arrives it will be automatically laid out for you but I recommend you take advantage of the customization options within Initial State to create a dashboard that is not only functional but one that looks good too.
You can add a custom background image of your boat or layout of your electronics. You can change the temperature tile to a thermometer and set color ranges so you know if it is high or low immediately by the visual color representation. You can set any of your signals to a line graph to view historical trends of the data. You can add a map tile and enter the GPS coordinates for your boat’s location.
You can see a real-time summary of your data in your Tiles dashboard. The Waves app gives you a separate but important way to view the data. Waves is great for viewing historical trends and identifying anomalies in your data.
In addition to the data you can pull from your boat, you can add weather information to your dashboard. The Weatherstack Integration in Initial State requires no code and is easily set up with just a few clicks. You just add your coordinates or zip code and you can get weather forecast data every 15 minutes or hourly. You can send this data into your boat dashboard to monitor weather conditions and storms.
You’ll want to set triggers on your dashboard so you can be alerted immediately if data falls outside of the normal thresholds. You can receive an alert via email or SMS. To do this, go to your triggers tab in your bucket settings. Here you can select which signal you want to monitor, the operator (equal to, less than, greater than, etc.), and the threshold value. Choose the contact you want to be notified by (email or phone number). Click done and your trigger is set. You can add up to 20 of these alerts per dashboard.
You can create a desktop view and a mobile view of your dashboard. This allows you to have a perfectly laid out dashboard for both viewing options. Your desktop view could be more in depth and your mobile could be a snapshot view to allow you to see updates quickly.
With so many tools now available, DIY has become more accessible than ever. So get out there and build your own boat monitoring system.