For a couple of weeks, I was in between jobs. I quit my old job and signed up for a new one. The time in between was a bit of an unpaid vacation and I used my time to pay myself. I always wanted to install a full blown autopilot on my boat because my girlfriend and I are boating in a nice area and either myself or her are required to be at the helm at all times. Even when there is absolutely no one around. The boat simply doesn't steer itself.
That needed to change, so I spend a couple days researching my options, initially bought an ArduPilot Rover kit and wanted to use that. However, it became clear, that ArduPilot kinda sorta uses google maps or similar to create missions but I needed something marine, like a chart plotter.
After some further googleing, I found OpenPlotter! An open source platform, compatible with the Raspberry Pi 3 - of which I have a bunch sitting on the self collecting dust. On top of the ecosystem this project created, they have an OpenCPNintegration and that has an PyPilot integration!
All together, this is a complete chart plotting, autopilot solution with the ability to integrate various sensors and other systems like AIS! Quite impressive, really, and supported by a large community - with varying success, as I will explain in a bit.
Installing OpenPlotter could not be easier as there is a NOOBS image available that contains everything needed to get things running. Just flash it to a microSD card like you would to install any Raspberry Pi OS and fire it up. Just follow the very good documentation.
I then started OpenCPN and installed some charts. I'm not entirely sure which ones I installed but there are several.
Once charts are installed and a GPS is plugged into the USB port, you need to configure it using the OpenPlotter application:
Please note, when you plug two of the same USB to Serial converters into the Raspberry Pi, you have to let the the system know to remember what port you plugged each one into. Otherwise, the system may wake up expecting the GPS to be where the PyPilot is connected.
I plugged each one in individually, configured it by giving it a name and an assignment and then hit apply. GPS will be detected automagically, PyPilot as well.
Next up is the IMU. I strongly recommend buying the suggested IMU:
I tried to get other ones to work but this one just works out of the box and need to further configuration. It's a whole $9 on Amazon so there is your big investment for this project!
It's a little funny that the IMU only shows up under PyPilot and not under I2C even though it is connected through I2C. However, if you go to I2C and then hit add, it will show it, once connected correctly, and it will also show the addresses:
There is no need to ADD the IMU to the I2C sensors. PyPilot will just take it once connected.
At this point, you have GPS and an IMU for the compass.
Now, we need to let OpenCPN know where to get all the sensor information. OpenPlotter uses an app/daemon called SignalK which is kinda like a hub apps can connect to to get access to all sensor data. This includes AIS, NMEA2k as well as NMEA0183 if all of that is actually connected to the Pi.
In OpenCPN, go into the settings and click Connections:
There are two things that you need to set up. The connection to port 10110 to gain access to the SignalK hub / multiplexer and the connection to PyPilot. In my case, everything runs on the same Raspberry Pi so localhost is the correct IP address.
Port 10110 supplies all the sensor data and needs to be configured as an input as we only want to receive information and 20220 is autopilot data (waypoints) going to PyPilot. Here, we should select the NMEA messages we want to send to PyPilot to reduce the amount of data that needs to be sent and processed:
That's kinda it! This is how I set my system up and so far it works like a charm.
What's really important is that you tune your PID controller. You probably only really need P and D and ignore the I-gain but they need to be tuned a little bit to not have the system freak out the first time you actually activate the autopilot / course keeping.