Wednesday, June 4, 2014

Signal K is afoot.

I wish to communicate with you!


I know the vast majority of you have never heard of "Signal K" and until recently I hadn't either. Signal K is a collaboration by several open source boating related software developers who have worked together to create a common data management framework to support their efforts.

This includes the open source CANboat and browser oriented Navguage projects. CANboat is largely dedicated to reverse engineering NMEA 2000 PGN's to allow others to access the specific data elements such as boat speed or wind angle.

Why the reverse engineering? They can't access the technical information. The open source community is caught in a catch 22. Any member could buy the standards, but then can't disclosed the raw data by parsing it in an open source program.

This takes me into a contentious area. I'm a big NMEA 2000 fan. They have created a very solid marine data networking system that works well and has been widely adopted. I'm not going to debate the merits of the NMEA 2000 standards and costs. This has been done by others for example on Panbo. I will say that the NMEA 2000 standards and formatting didn't and possibly couldn't anticipate the massive proliferation of mobile devices, and how to package their data for output to a now much more connected world.

As an aside I also think it would be of value to NMEA in the long run to consider finding a way to ease data access for the potentially many thousands of small mobile app developers. Smaller fees from them maybe yes, all they want is the data, but many more participants potentially paying them for a myriad of possible mobile applications. I think with the right scenario this could be good for both the boating community, NMEA, and technological innovation. 

Parsing data in the engine parameter PGN




The CANboat volunteers have figured out how to parse the individual data elements in the PGN's by observation without using the Actisense DLL (Dynamic Link Library) or their SDK (Software development Kit). This isn't perfect yet, but it's working well now, and gets better every month. As a side effect this also includes the majority of manufacturers propriety PGN's. Now here is the question. What do you do with all of this data? Each PGN can contain lots of varying information, and this is where Signal K comes into the story.


"Signal K defines a universal marine data model, a structure where every piece of information on a boat has a defined place, and is stored in a consistent defined way. The model holds multiple boats: your own, and others acquired from AIS, local WiFi, or the Internet. It also holds other data such as cruising notes, charts, weather, notices, port data, etc." From the Signal K website.

To simplify what's going on is an Actisense NGT-1 NMEA 2000 to USB converter can be plugged into a N2K network, and then connected to a server.

The CANboat software takes the NMEA PGN's and identifies the specific data elements contained within it, ie the water depth or bearing magnetic. Now we have the data, how do you format it so you can get at? Let's say you want to have engine RPM's and apparent wind angle appear in separate gauges on a Ipad.

One of the things the Canboat software can now do is to output the translated data as a Signal K message in JSON (JavaScript Object Notation). JSON is one of the two primary ways servers send data to web browsers. (The other is XML). Of the two, the JSON format is most used when quick handling of a lot of data is required.

Signal K merges the JSON messages into their JSON schema (think of it as a database). The end result is all of the data is hierarchically arranged and now human readable. The NMEA sentences which often contained many different collections of information, have been disassembled into their components parts and can now be accessed easily.


Best of all it's simple to add new data to the schema because each single data element has exactly the same format. Want to add wave height? Give it a name (waveheight), value is where the latest height is stored, source is where it came from, and timestamp is the date and time of the current data. Now that piece of data is easy to locate, and use.


Since your boat's (and others) data is now organized and easy to access what can you do with it? The Navguage project is working on this. Navguage takes data from the Signal K schema and using Javascript and SVG images (Scalable Vector Graphics) allows the information to be displayed in browsers, mobile or otherwise, using a huge array of formats such as sparkline graphs, charts, and gauges to name a few. You can find one of Navguage's online demostration here.


What does this mean to a boater? In the long run potentially a great deal. You and I will probably never directly interact with this software, but for the mobile device app developer this is terrific. You need magnetic heading? It's now easily accessed all by itself, along with all of the other data, and it's in a JSON string format already suitable to wirelessly send to a tablet. It's not exactly quite that simple, but Signal K makes it much easier to get close to real time data from your boat and send it to a tablet, phone, PC browser or to the cloud. It becomes straight forward to let you see it as a gauge, in a data box, represent it as a graph, and so on.

To become more connected in the Signal K world the hardware configuration is straight forward. The Actisense sends the data to a PC, Raspberry Pi, or similar device which acts as the server. The output data is sent in a JSON format to a mobile device via a WiFi router.

Arduinos can also be added to allow additional senors to interact, or even to replace existing instruments. The Freeboard project is writing code to let the Arduino send it's data in the Signal K JSON format avoiding the need to use NMEA at all

Where is this all going? That's the question of the hour. This open source Signal K concept is extremely clever. It has breathed new life into the marine open source community. This is not a trivial effort that's going on. The CANboat NMEA 2000 PGN portion (pgns.json) file contains over 17,000 lines of code alone, and this is barely half of the totality. Reading the interactions of the participants in their Google/GitHub forums is enlightening. A better idea comes up, the group discusses it, agrees, it gets adopted, Signal K is revised and the others match their code to fit it. No fighting, no committees, just smooth, fast and collective motion forward by boat savvy developers.  

Where this ends up is hard to prognosticate. It will no doubt be of interest to developers of marine related mobile apps. It certainly can be used to create specialized applications for racing, vessel monitoring and many more applications. The ability to efficiently send information to the cloud offers endless possibilities all by itself. I think the Signal K concept is brilliantly conceived. It provides an elegant flexible bridge between your boats data, and the rest of the connected world using browser based software techniques well understood worldwide by millions of programmers.

Signal K Project
The Freeboard project.
The CANboat project.
Navgauge Project.

The software interaction block diagram courtesy of the Freeboard Project.
Code images are real examples.
The hardware block diagram created by the author.

6 comments:

  1. Aren't these NMEA canbus PGNs either patented, copyrighted, or proprietary? Won't there be legal repercussions of reverse-engineering them?

    ReplyDelete
    Replies
    1. Karl, it's a complicated question and I'm not qualified to provide any substantive legal information on the subject. I do have some observations:

      CANBoat has been around for years without any notable strife with NMEA that I'm aware of. CANboat is not licence-able for commercial use. There is no profit being derived, money being exchanged or proprietary information being used. Lastly even if you wanted to sue them I'm not sure how you could do it. There are many people involved from all over the world.

      As I said, Signal K is an insightful and clever system designed to connect your boat to the world. It's been designed and programmed by talented software developers who are also boaters, and you can tell. I can't find anything that has close to it's capabilities anywhere.

      Delete
  2. Excellent posting - really explained the issues (technical and licensing/political). An open system like this would create many new apps for all boaters. It would be great if there were a discussion group about this somewhere. I'd like to make sure some two way communications capabilities considered for support like route upload/download.

    ReplyDelete
  3. @Jeffrey
    Signal K is fully two-way. Its a peer-to-peer design to enable sharing between any signal k capable devices. Sharing routes, cruising notes, etc is one of the possibilities. Using wifi the possibility of transfer to nearby boats is also viable. - Rob (Signal K)

    ReplyDelete
  4. I remember the years of lawsuits by the various owners of UNIX against the open-source Linux community due to infringement issues...I think it only ended upon patent expiration, but I'm fuzzy on that. If something needs to be reverse-engineered, I would expect a potential for lawyers to get richer.

    ReplyDelete
    Replies
    1. http://en.wikipedia.org/wiki/SCO–Linux_controversies is what you were thinking of, probably. Just plain you-stole-my-source-code claims. No reverse engineering in sight. SCO thought it could pluck a wealthy IBM chicken. Ta. Didn't turn out that way, but it was good for lawyers.

      Reverse engineering through lawful means is OK in almost all jurisdiction(s) including the USA. Reverse engineering is protected in the USA by the fair use exception in copyright law.

      Some examples of open source projects that do RE include Samba (RE of Microsoft LAN protocols) and Wine (RE of Microsoft Windows API).

      Delete

Note: Only a member of this blog may post a comment.