This tutorial will guide you through the process of setting up a station using the Balena Community Application ( or Balena MT Station ) on a Raspberry Pi (3B+, 4, or 5) with a dAISy HAT and a generic wideband RF or VHF antenna.
Requirements
Hardware
Raspberry Pi 3B+, 4, or 5
dAISy HAT
Generic wideband RF or VHF antenna ( we are using COMAR antenna)
Open
MicroSD card (at least 8GB)
Power supply for Raspberry Pi
Internet connection (Wi-Fi or Ethernet)
an RTL-SDR USB dongle
Software
Balena CLI (Command Line Interface) (optional) GitHub - balena-io/balena-cli: The official balena CLI tool.
git (optional) Git
Balena Etcher balenaEtcher - Flash OS images to SD cards & USB drives
Step 1: Login/Register to MarineTraffic
b. Fill the form
Get the confirmation email with the information
Step 2: Setup Balena Fleet and Application
Login/Register
Go to the The container-based platform for deploying IoT fleets - Balena and register/login
Setup your fleet
Go to balenaHub - IoT embedded device apps, edge computing resources, and developer tools the Balena Hub page for our MT Station application
Press the Deploy to Balena Button to create a fleet with the application as the main release
Or Go to the GitHub page of the application and read the instructions for using BalenaCLI and git to set up and deploy manually the application to your fleet
GitHub - Kpler/iot-balena-ais-station: Balena Community Application for the AIS Station
Step 2A: Pre-Configure Fleet ( Deploy by pressing Balena Button)
Pressing the Deploy button will open a modal. There you can pre-configure the fleet
Fill out the Fleet environment variables with the IP and Port provided in the confirmation email and don’t forget to change the value of
RESIN_HOST_CONFIG_enable_uart
to 1
Step 2B: Configure Fleet ( Manual Deployment)
Log in to Balena Dashboard:
Go to the Balena Dashboard and login to your account.
Go to your fleet
On the side-bar click Variables
Add the variables necessary for the application to broadcast data to MarineTraffic ( IP and Port from the confirmation email ( you can specify in which service these variables are to be applied - the service that is responsible for broadcasting data is broadcast service )
From the side-bar click on Configuration and enable UART for your devices
Deploy the application to your fleet
Follow the instructions for manually deploying the application to your fleet GitHub - Kpler/iot-balena-ais-station: Balena Community Application for the AIS Station
Step 4: Setup Device
Add device:
Flash the downloaded image to an SD card using balenaEtcher
Insert the SD card into your Raspberry Pi and power it on
Verify Device Connectivity
Step 5: Verify the Setup
Access the Logs:
Check AIS Data:
You can configure the logs output to be more verbose and to print the input received from the antenna. You can choose both or just one of the services to be verbose on the Services drop-down menu
You should see some of the data arriving on the serial-input and the valid NMEA data the broadcast service sends to MarineTraffic.
Possible error in serial input
RPI 4 may need to be configured to use a different Serial port than the default one. If you see in the logs the error from the serial-input service that
Error on serial /dev/ttyXXX: No such file or directory cannot open…….
there is a misconfiguration in the application.
So you need to add a device variable to set the SERIAL environment variable to be/dev/ttyS0
or in any serial port, you are sending the output of the dAISy hat. When the changes are applied you should see that the service is opening the correct serial port without an error
Check your Station Detail Page:
Visit the MarineTraffic Station Details by clicking on My Account---> My Stations and clicking your new Station. Once on your Station Detail Page, you should check its name and if the new station is receiving any data
Conclusion
You have successfully set up a station using the Balena MT application on a Raspberry Pi. Your station is now capable of receiving, processing, and broadcasting to Marinetraffic AIS data