This is an old revision of the document!
Installing and Configuring MacArthur HAT on Raspberry Pi with NMEA 2000 and Signal K Prerequisites Raspberry Pi (3B+ or 4 recommended) MacArthur HAT NMEA 2000 to USB adapter (e.g., Actisense NGT-1) MicroSD card (16GB or larger) Power supply for Raspberry Pi Ethernet cable or Wi-Fi connection Step 1: Prepare the Raspberry Pi Download and install the latest Raspberry Pi OS (previously called Raspbian) on your MicroSD card. Insert the MicroSD card into the Raspberry Pi. Connect the Raspberry Pi to your network via Ethernet or Wi-Fi. Power on the Raspberry Pi. Step 2: Install the MacArthur HAT Power off the Raspberry Pi. Carefully attach the MacArthur HAT to the GPIO pins on the Raspberry Pi. Secure the HAT with standoffs if provided. Step 3: Enable I2C Interface Power on the Raspberry Pi and open a terminal. Run sudo raspi-config. Navigate to “Interfacing Options” > “I2C” and enable it. Reboot the Raspberry Pi: sudo reboot. Step 4: Install Required Software Update your system:
sudo apt update sudo apt upgrade -y Install necessary packages:
sudo apt install -y git cmake build-essential libgps-dev gpsd gpsd-clients python3-pip Install the MacArthur HAT Python library:
sudo pip3 install macarthur-hat Step 5: Configure the MacArthur HAT Create a new Python script to test the HAT:
nano ~/test_macarthur.py Add the following content:
from macarthur_hat import MacArthurHAT import time
hat = MacArthurHAT() while True:
print(hat.read_all()) time.sleep(1)
Run the script to test the HAT:
python3 ~/test_macarthur.py Step 6: Set Up NMEA 2000 Interface Connect your NMEA 2000 to USB adapter to the Raspberry Pi.
Install the NMEA 2000 library:
sudo pip3 install pycanboat Create a new Python script for NMEA 2000 data:
nano ~/nmea2000_reader.py Add the following content:
import can from pycanboat import PGNs
bus = can.interface.Bus(channel='can0', bustype='socketcan') pgns = PGNs()
for msg in bus:
decoded = pgns.decode(msg) if decoded: print(decoded)
Run the script to test NMEA 2000 data reception:
python3 ~/nmea2000_reader.py Step 7: Install and Configure Signal K Install Node.js and npm:
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - sudo apt install -y nodejs Install Signal K:
sudo npm install -g signalk-server Create a new Signal K configuration:
signalk-server-setup Start the Signal K server:
signalk-server Step 8: Connect MacArthur HAT and NMEA 2000 to Signal K Open a web browser and navigate to http:<raspberry-pi-ip>:3000. Go to Server > Plugin Config. Install and enable the following plugins: signalk-macarthur-hat signalk-canboat-parser Configure the plugins: For signalk-macarthur-hat, set the update interval and select the sensors you want to use. For signalk-canboat-parser, set the NMEA 2000 interface (usually /dev/ttyUSB0 for Actisense NGT-1). Restart the Signal K server: sudo systemctl restart signalk.service Step 9: Verify the Setup Navigate to http:<raspberry-pi-ip>:3000 in your web browser. Check the Data Browser to ensure you're receiving data from both the MacArthur HAT and the NMEA 2000 network. Congratulations! You have successfully installed and configured a MacArthur HAT on a Raspberry Pi, added an NMEA 2000 network interface, and connected it to a Signal K application.