Hi everyone,
This is a technical post. It is the first of two posts describing how we installed and setup software to capture, record and display data from our NMEA-2000 network. This post describes how we did so on a Macbook laptop running Mac OS X. The second will describe how we moved the NMEA-2000 capture and recording onto a cheap, low-power BeagleBone Black computer.
Zen Again Graphs on our Macbook |
Our NMEA-2000 network includes the following devices and data:
- Vesper XB8000 AIS
- GPS
- AIS
- Garmin GPSmap451 Chart Plotter
- GPS
- Garmin VHF300iAIS VHF Transceiver
- AIS
- DSC
- Airmar DST800 Speed/Depth Transducer
- Depth
- Boat Speed
- Log
- Water Temperature
- Raymarine SPX5 Autopilot
- Rudder Angle
- Airmar 220WX Weather Station
- GPS
- 3D Attitude
- 3D Attitude Rate
- Air Temperature
- Air Pressure
- YachtDevices YDVR-04
- Recorder
- TechnoSpark Replicator
- WiFi Hotspot
- ActiSense NGT-1
- NMEA-2000 to USB Gateway
So there's a lot of data on the network, including 3 sets of GPS data. We've previously described some of the ways we use the data:
All the above are useful. But they involved writing and maintaining our own Python scripts. Meanwhile the marine electronics world has lots of open-source technologies to offer. One particular development was particularly interesting - SignalK.
SignalK provides a means of gathering data from NMEA-0183, NMEA-2000 and other boat networks and making it available in a 'web-friendly' (JSON) format. Sounded great, but research seemed to show it is most heavily used with OpenPlotter on Raspberry Pi computers. OpenPlotter provides a 'ready to go' suite of software for the Raspberry Pi including SignalK, OpenCPN and more. However our navigation system runs OpenCPN on Macbook laptops so OpenPlotter wasn't for us.
More recently we discovered InfluxDB and Grafana. InfluxDB is a time-based database system which can be populated from SignalK. Grafana is a graphing system which can plot data from InfluxDB. This combination looked nice and convinced us to give them a try. Initially we aimed to install them all on a Macbook.
Here's how we did it, noting that we have an ActiSense NGT-1 NMEA-2000 to USB interface. If you follow in our footsteps you may wish to replace 'ZenAgain' with your boat name.
ActiSense NGT-1 Installation
To install drivers which work in Mac OS X 10.15 Catalina, get them from FTDI at FTDIUSBSerialDriver_v2_4_4.dmg. This link was provided to me by ActiSense Support.
Homebrew Installation
Homebrew is a package installation manager. It is used to install and control some of the software we need. Here's how to install it.
- In a Terminal window run 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null'.
Note that Ruby will install Xcode command line tools if they are absent.
SignalK Installation
- Download nodejs from https://nodejs.org/en/download/
- Run the install pkg and accept all defaults.
- In a Terminal window and type 'npm -v' to show the version installed.
- Download signalk-server-node from https://github.com/SignalK/signalk-server-node
- In the Terminal window run 'cd signalk-server-node'
- In the Terminal window run 'sudo npm install -g --unsafe-perm signalk-server'
- Start the server using sample NMEA2000 data by running `signalk-server --sample-n2k-data`
- In a browser, open 'http://localhost:3000'. Explore!
- Kill the server by typing <ctrl>c in the Terminal window.
SignalK Setup
- In a Terminal window run 'sudo signalk-server-setup'
- Enter your boat name and MMSI and accept defaults otherwise
Initial Run and ActiSense Connection Setup
- In a Terminal window run 'signalk-server' to start the server
- In a browser, open 'http://localhost:3000' to access the server
- On the 'Server => Connections' page click on 'Add'
- Set ID to 'actisense'
- Set NMEA 2000 Source to 'Actisense NGT-1 (canboatjs)', noting the 'js'
- Set Serial Port to '/dev/serial/by-id/usb-Actisense...', where '...' identifies your NGT-1
- Accept defaults for the other fields and click 'Apply'
- On the 'Dashboard' page check the Stats show ActiSense data being received.
- On the 'Data Browser' page select 'Self' and check for data, noting the use of SI units.
SignalK Server Actisense Connection Setup |
SignalK Dashboard |
OpenCPN SignalK Connection
OpenCPN SignalK Connection |
ActiSense Connection not working?
We had trouble using the ActiSense NGT-1 with canboatjs. This was indicated by an error on the Dashboard page. To fix this I installed canboat which worked fine. Here's how i's done...- Download canboat source files from https://github.com/canboat/canboat
- In a Terminal window run 'cd canboat-master'
- In the Terminal window run 'make' to build the executables
- In the Terminal window run 'sudo cp rel/darwin-x86_64/* /usr/local/bin' to move the executables for use
- In the Terminal window run 'which actisense-serial' to check the executable we need is ready for use
- In the Terminal run 'nano ~/.signalk/settings.json' and replace its contents with the text illustrated below, replacing '/dev/tty...' with the correct string for your NGT-1
- If the SignalK server is running kill it by typing <ctrl>c in its Terminal window
- Start the SignalK server by running 'signalk-server' in its Terminal window
- In a browser, open 'http://localhost:3000' to access the server
- On the 'Dashboard' page check the Stats show ActiSense data being received.
SignalK ~/.signalk/settings.json for canboat
- Download canboat source files from https://github.com/canboat/canboat
- In a Terminal window run 'cd canboat-master'
- In the Terminal window run 'make' to build the executables
- In the Terminal window run 'sudo cp rel/darwin-x86_64/* /usr/local/bin' to move the executables for use
- In the Terminal window run 'which actisense-serial' to check the executable we need is ready for use
- In the Terminal run 'nano ~/.signalk/settings.json' and replace its contents with the text illustrated below, replacing '/dev/tty...' with the correct string for your NGT-1
- If the SignalK server is running kill it by typing <ctrl>c in its Terminal window
- Start the SignalK server by running 'signalk-server' in its Terminal window
- In a browser, open 'http://localhost:3000' to access the server
- On the 'Dashboard' page check the Stats show ActiSense data being received.
SignalK ~/.signalk/settings.json for canboat |
InfluxDB Installation
- In a Terminal window run 'brew install influxdb' to install
- In the Terminal window run 'which influxd' (note no 'b') to check installation success
The InfluxDB executables install area is '/usr/local/Cellar/influxdb'.
InfluxDB Start
- In a new Terminal window start the influxdb service with the command 'influxd'.
- In a new Terminal window create a new database run 'curl -X POST http://localhost:8086/query?q=CREATE+DATABASE+ZenAgain'.
The InfluxDB config file is in '/usr/local/etc' and databases are in '~/.influxdb'.
InfluxDB uses IP port 8086 to service client requests. It doesn't provide a web page but browsing there is a handy way to see if InfluxDB is running. Doing so produces a page with '404 page not found' text.
signalk-to-influxdb Installation
- In a browser, open 'http://localhost:3000'
- Go to 'AppStore => Available' page, find the 'signalk-to-influxdb' entry and click on the download link on the right.
- Go to 'AppStore => Installed' page and check 'signalk-to-influxdb' installed.
- In the Terminal Window running 'signalk-server', enter <ctrl>c to shutdown, then 'signalk-server' to restart.
- Back in the browser, go to 'Server => Plugin Config' page, click on 'Influx DB'
- On the page, tick the 'Enable' checkbox, enter 'ZenAgain' as the Database, then click on 'Submit' at the bottom.
SignalK Server / Plugin Config |
Grafana Installation
- In a Terminal window run 'brew install grafana' to install
- In the Terminal window run 'ls -l /usr/local/etc/grafana/' to check installation
The Grafana install area is '/usr/local/Cellar/grafana', config files are in '/usr/local/etc/grafana/' and the log file is in '/usr/local/var/log/grafana'.
Change Grafana's IP port since its default is the same as signalk-server...
- In a Terminal window run the command 'sudo nano /usr/local/etc/grafana/grafana.ini'.
- After the line ';host_port = 3000', enter a new line containing 'host_port = 3001'.
- Enter '<ctrl>o' to save, '<enter>' to confirm, then '<ctrl>x' to exit.
Grafana Setup
- In a Terminal window run 'brew services start grafana'.
- In a browser, open 'http://localhost:3001'.
- Login with admin/admin then change the password.
- In 'Configuration => Data Sources' add 'Influx DB'.
- Set HTTP URL to 'http://localhost:8086 (don't leave it greyed-out).
- Set Influx DB Details Database to 'ZenAgain'.
- Set Influx DB Details user/password to those of your login account.
- Click 'Save & Test' and confirm all 'green'.
Grafana Welcome Page |
Overall Manual Start
- In a new Terminal window, run 'influxd'.
- In another new Terminal window, run 'signalk-server'.
- In another new Terminal window, run 'brew services start grafana'.
- In a browser, open 'http://localhost:3000' and check 'ActiSense' and 'InfluxDb writer' running.
- In a new browser tab, open 'http://localhost:3001' and check Grafana running.
Overall Automatic Start
- Create file ~/Library/LaunchAgents/signalk-server.plist
- Create folder /usr/local/var/lib/signalk-server
- Create folder /usr/local/var/log/signalk-server
- Create file ~/Library/LaunchAgents/influxd.plist
- Create folder /usr/local/var/lib/influxd
- Create folder /usr/local/var/log/influxd
Hi and thanks for a nice article. I use mac os catalina and when I try command to create new influx database I only get this: jonny @ Mac-mini ~% curl -X POST http: // localhost: 8086 / query? Q = CREATE + DATABASE + Fri
ReplyDeletezsh: no matches found: http: // localhost: 8086 / query? q = CREATE + DATABASE + Fri
jonny @ Mac-mini ~% which influx
/ usr / local / bin / influx
Suspected error due to influxdb version 2.x. Do you have an updated solution to this?
For info I use mac mini (i7 16gb ram late 2012) which has been converted to a 12v supply as the motherboard runs on 12v. Powerful and uses "little" power "
Hi Jonny's, No update I'm afraid. I moved SignalK and InfluxDB onto a BeagleBone Black and that's working well (and is very low power). I now only run Grafana on the Mac.
DeleteYour command seems to have many incorrect spaces - it should be ''curl -X POST http://localhost:8086/query?q=CREATE+DATABASE+Fri'.
Interesting that you've converted your Mini to 12V. What did that involve?
I would love to have the Zen again stats dashboard on my onboard mac! That looked awesome. But I am afraid I am not technical emnough to get through the 40 steps of this post :)
ReplyDelete