Close

New Boat, New Autopilot - using an old laptop mainboard!

A project log for OpenCPN Chart Plotter /w Autopilot and Waypoints

I am in the process of implementing an autopilot on my 42' Uniflite Aft Cabin Cruiser based on the original 1984 hydraulic steering system.

timo-birnscheinTimo Birnschein 08/09/2023 at 13:260 Comments

For quite some time I have been thinking about the possibility to using a laptop to run all the heavy OpenPlotter and OpenCPN stuff instead of using a Raspberry Pi. The performance of the RPi is... well it's usable but it's not a pleasant user experience. OpenCPN runs too slow and for anything else than what it's already doing (which, to be fair is a lot with GPS, AIS, Compass, Chart Plotting, Navigation, ...) it really is too slow.

I had an old Toshiba mainboard from my wife's old laptop flying around. It really fairly old but when I installed OpenCPN under the latest Ubuntu LTS for a test, I was surprised how well it handled the chart rendering.

I researched what is the main concern running a laptop for autopilot instead of the RPi and the only thing that constantly popped up was the compass sensor that PyPilot requires to do autopilot work. Fine, I thought, what are the options. Turns out, it's VGA.

What's VGA? It's an antiquated monitor port that no one uses anymore but it does break out an I2C port to read an eeprom inside the monitor describing what resolutions and frequencies it supports. It's wired straight from the CPU/IO buffer to the monitor. So can we use it for sniffing using the i2c-tools under ubuntu?

I got me one of these VGA breakout boards from Amazon:

Hooked it up as follows to my IMU MPU9250:

Then I ran the i2cdetect command to sniff what's connected to the port and voila!

chartplotter@chartplotter-Satellite-U505:~$ sudo i2cdetect -y 1
    0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                        -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- 76 --

chartplotter@chartplotter-Satellite-U505:~$ sudo i2cdump -y 1 0x68
No size specified (using byte-data access)
    0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: c2 d2 e3 f0 ab de 29 c0 08 29 04 03 00 69 61 70    ??????)??)??.iap
10: c7 ba ec 00 00 00 00 00 00 00 00 00 00 00 00 00    ???.............
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
30: 00 00 00 00 00 00 00 00 00 00 05 3d c0 f2 04 0b    ..........?=????
40: a8 0e b0 fd b0 00 52 ff e2 00 00 00 00 00 00 00    ?????.R.?.......
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
60: 00 00 01 00 00 00 00 00 00 00 00 01 00 00 00 ea    ..?........?...?
70: 00 00 00 00 00 75 00 e1 b6 00 ea 10 00 27 da 00    .....u.??.??.'?.
80: c2 d2 e3 f0 ab de 29 c0 08 29 04 03 00 69 61 70    ??????)??)??.iap
90: c7 ba ec 00 00 00 00 00 00 00 00 00 00 00 00 00    ???.............
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
b0: 00 00 00 00 00 00 00 00 00 00 01 3d b0 f3 48 0b    ..........?=??H?
c0: 3c 0e 90 fd d0 00 83 ff dc 00 00 00 00 00 00 00    <????.?.?.......
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
e0: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 03 b4    ...........?..??
f0: 00 00 00 00 00 75 00 e1 b6 00 ea 10 00 27 da 00    .....u.??.??.'?.

Shockingly, this just worked and the IMU popped up!

Disclaimer: The dump here is not actually from that specific IMU but from another one but it's just an example that it works!

With the IMU connected, I installed Openplotter as usual. Download the Settings app and from there, install everything. Or at least so I thought. A couple caveats: PyPilot can only be installed on Raspberry Pi using the Settings app. Given the above appears to be no issue at all, this doesn't seem to make any sense anymore and should probably be changed if there are no other good reasons.

Instead, one has to hop over to the git repository and install PyPilot manually.

Right after, one can go ahead and install it as a service on the system so that it start automatically when the system starts. Since we didn't install it using the Settings app, it won't start otherwise as OpenPlotter doesn't know it exists. I followed this documentation to get the service installed but it would not start.

We have to go to the service script it installs and change a few things:

My services file looks like this:

TODO: Add file contents

I'm not sure the last step is important, but I read somewhere that to run services that require a sudo/root password to do stuff as a user (for instance to access I2C ports, one needs to allow the user to run sudo commands without requiring a password. This is a highly questionable choice and depending on what else you are using the system for poses extreme security risks. So it it at your own discretion should PyPilot not start as intended.

Getting AIS to work reliably WITH an IMU connected to the I2C port:

Now that everything worked - including AIS, I restarted and... AIS stopped working. The reason turned out to be that once an RTL-SDR dongle is plugged in, the I2C multiplexer on the RTL-SDR that is not used by anything is registered by the system and a module is loaded for it. Once that happens, the I2C port 1 used for the IMU. In order to fix this, I found that blacklisting lots of RTL-SDR modules during boot is a usable solution. Luckily, someone already figured out what modules to blacklist so I was able to just follow this short guide:

Discussions