The Licensing and Compliance Lab interviews Kees Verruijt of CANboat
Kees Verruijt is a sailing software engineer from Harlingen, NL. He maintains CANboat, which he describes as "[a] small but effective set of command-line utilities to work with CAN networks on BOATs".
By Femnett/Maretron, LLP (Maretron, LLP) CC BY 2.5, via Wikimedia Commons
To help you understand a bit more about the technology on top of which CANboat works, we have provided a brief explanation below. The following text has been adapted from the CAN bus article on English Wikipedia (which was originally licensed under the terms of the Creative Commons Attribution-ShareAlike 3.0 License):
A Controller Area Network (CAN bus) is a vehicle bus standard designed to allow microcontrollers and devices to communicate with each other without a host computer or server. It is a message-based protocol that was designed originally for multiplex electrical wiring within automobiles. Modern automobiles may have as many as 70 electronic control units (ECU) for various subsystems. Others are used for transmission, airbags, antilock braking/ABS, cruise control, electric power steering, audio systems, power windows, doors, mirror adjustment, battery and recharging systems for hybrid/electric cars, etc. Some of these form independent subsystems, but communications among others are essential. A subsystem may need to control actuators or receive feedback from sensors. The CAN standard was devised to fill this need. The use of CAN was adopted by the marine industry, because they also needed a plug-and-play communications standards used for connecting marine sensors and display units within ships and boats.
Could you provide a little info to landlubbers about the kinds of electronics and computers used in the marine world?
Marine electronics has a long history, it was way back in the 1960s when electronics were starting to make an appearance on recreational and commercial boats. Depth sensors, marine radios, wind sensors and geo-location devices were appearing on the market. In the beginning every manufacturer started creating their own networks, usually based on some variation of serial data, typically running at 4800 or 9600 baud. Electronic sensors enabled boaters to have displays with data such as compass heading, wind and boat speed. Two other major developments were the first auto-pilots (a device that keeps the boat on a particular heading) and position locators -- first based on land based radio signals and later on satellite radio signals. As you can imagine knowing where you are is much harder for a sailor than a landlubber as there are so few reliable points of reference out on the ocean! One of the first applications for a protocol used by devices made by different manufacturers was to pass heading data from the sensor network or from the satellite navigator to the auto-pilot.
The need for industry data standards lead to a group of US electronics dealers forming the National Maritime Electronics Association (NMEA), which interacted with the various manufacturers to standard protocol and data formats for devices. Membership for these manufacturers meant access to the large single US market, so soon manufacturers from Europe and Australia/New Zealand joined as well. In the 1980s this resulted in the NMEA 0180 and later 0183 standard. This standard is used every day by billions of users as (almost) all modern satellite navigation building blocks will transmit data using this protocol.
As the number of devices on board started to rise and new sensors and displays were added the manufacturers saw that a new standard would be needed. Like most such standard committees they chose a name that would reflect the hoped-for release year, so NMEA 2000 came to be. It took a few years more before the first NMEA 2000 devices to come to market, but today they're everywhere. NMEA 2000, or N2K, is based on CANbus. Development for CANbus was started by Bosch for use in the car industry, but it was soon adopted by many other industries as well. The marine version communicates at 250,000 baud, and allows you to hook up many devices to a single "backbone" meandering through your ship. Electrically its really neat -- no master device, no wasted bandwidth with high priority messages automatically taking precedence. The datagrams are easier to generate and parse in small microcontrollers as the format is in binary, with fixed bit length fields. In other words, when done correctly they map one-on-one to a C structure with the fields in a native C unsigned or signed integer value. This also has the effect of the data being harder to understand if you don't have access to the standard.
Where does CANboat fit into all this?
Use of the NMEA 2000 standard is encumbered by onerous copyright restrictions. The original documents are under copyright, and no member NMEA is allowed to publish them, not even in a different format. This resulted in manufacturers documenting just the list of sentences that their devices support. The NMEA nowadays does provide a list of all messages and what fields they contain, but not the precision or meaning of these fields.
CANboat gets around this by being written using only public sources, without access to the standard itself. The technical detail of which fields take up how many bits and what the used precision is was reverse engineered from live networks.
Nowadays CANboat is the only comprehensive NMEA 2000 database available in a free format. It also contains programs that can be used to read N2K data from the bus, convert it into text, XML or JSON and pass it on to other software.
What inspired you to create CANboat?
As I was building a new boat in 2008-2010 I wanted to have a single device that would show all the data available on board via a simple Web interface. I could join the NMEA and buy the NMEA 2000 standard (spending $3,000 USD or so) but then I couldn't actually release my program as free software. So I figured that the only way out was to reverse engineer the protocol from scratch. It took me about a week to write some code to interact with a CAN interface and only a few evenings before I had the first datagram done.
Soon I was able to have my dream of a tablet-friendly, HTML5(ish) page, in 2010. It took many evenings though over the last 6 years to add more and more N2K datagrams. Luckily, after making the sources GPL and putting them on Github I soon got a few collaborators from around the globe. All regular non-company specific NMEA 2000 messages are now decoded, most of them completely. CANboat is unique in that it also decodes. It is able to direct quite a number of company specific messages, but work on this is particularly slow as it requires a software developer with both access to a device producing them, a (perceived) need to use them and the will to put in hard hours doing the reverse engineering. This involves looking at hex dumps and fiddling until it makes sense.
How are people using it?
This has changed over time. In the early days everyone in the Marine Electronics community loved the idea but didn't necessarily use it -- partly because you need to have N2K on board. Andrew Mason of the University of Auckland, N.Z., was one of the first who grasped what I was doing and he created OpenSkipper using the CANboat database, and others soon joined.
Nowadays it is used by hobbyists (usually professional software developers with a boat) to monitor their onboard devices. And some even use it to control stuff -- for example turning a water maker off if the shore power fails or the generator shuts down. I use it myself to infer the boat's navigation status and automatically switch on the correct navigation lights. It uses the anchor winch state, engine RPM and GPS location to decide what lights should be on and which should be off.
CANboat is also used by people in the marine electronics industry -- software developers and hardware developers that are either contemplating entering the marine electronics world and are not yet NMEA members or haven't bought the standard yet. It is also used by companies that do have the standard but use it as a "lab instrument" to see what is going on and log data produces by new devices under development.
Probably the biggest set of users are those using it to feed NMEA 2000 data into Signal K servers. Signal K is probably even more exciting than CANboat. It is the outcome of an association of frustrated software developers who felt it was time for a completely new free standard for marine electronics, based on the ideas of "internet of things" and oriented towards reusing standards such as TCP, WS and JSON.
What features do you think really sets CANboat apart from similar software or projects (if there are any similar projects!)?
There are a few other projects that contain N2K parsers, but the ones that I have seen cater more towards very small microcontrollers, and focus on the most used data sentences only. CANboat is the only one with the ambition to cover all messages, and to cover company specific messages.
Why did you choose the GNU GPL version 3 (or later) as the license for CANboat?
I personally think the RFC method of publishing standards is a better one than the ISO/IEC style of charged access. I also don't like how the NMEA uses copyright law to prevents people with access to the standard to talk about content within the standard. Even the IEC doesn't do this. When I decided to make my work free software, I felt that I wanted to help non-professionals to gain access, but I also wanted to respect the NMEA as much as possible. I'm not trying to subvert their business model here, just offering an alternative for free software development. What I didn't want to see happening is that business would just use my work as a means to evade paying the NMEA without them contributing back to the community. This is why I made a deliberate choice for the GPL with its strong copyleft clause, which ensures this.
How can users (technical or otherwise) help contribute to CANboat?
If you've installed CANboat and you get "unknown PGN" messages you should, at the very least, create an issue on Github to make us aware of this. We can then decide to add at least minimal support for these. What would be even better is that you exercise the device that emits the PGNs and do the reverse engineering yourself. This is especially true if the PGNs are in the "company specific" range, as these tend to be hard for others to analyze if they don't have access to a live device.
Over the last five years the amount of community updates has steadily increased, so I'm not complaining, but this is still a mostly-one-person-effort right now.
What's the next big thing for CANboat?
The next big thing is support for Signal K. This is a brand new set of Internet age message and server specifications. If you are a marine electronics enthusiast that wants to build your own sensors and connect those into a network, you should not use NMEA 0183 or NMEA 2000, but Signal K. If you are a software enthusiast that wants to experiment with the data available on your NMEA 2000 network, by all means use CANboat, but use it to feed data into a Signal K server, and then use the Signal K data.
As Signal K is a work that stands on its own and does not require the use of either NMEA 0183 or 2000 it can be the next generation protocol for marine data interchange. This has been recognized by the NMEA as well, who now recommend the use of Signal K when creating new products that communicate over TCP/IP. Signal K code is Apache licensed and protocols and databases are CC BY-SA licensed.
Enjoy this interview? Check out our previous entry in this series, featuring Matt Lee of GNU Social.