Turn a Raspberry Pi into a Regetta Processor (and more)

I’ve been cleaning up the boat computer package I’ve been building and want to put it out there so you all can use it and contribute to it. The goal here is to turn a $35 Raspberry Pi or Beaglebone Black into a sensor hub and processor, similar to the B&G H5000 or any other regatta processor.

Raspberry pi is B&G

The package provides several functions through a modular ‘app’ system that I’ll talk about in a bit.

  • It enables calculation of complex data like true wind and currents.
  • It broadcasts all NMEA messages over UDP, so that the sensor data can be displayed in mobile apps like iRegatta and NMEA Remote.
  • It logs all NMEA messages to the Pis disk, and enables downloading of the logs to mobile devices.
  • It stores your sailing instructions so that you can reference them while on the water.

I’ve also started developing some add on apps.

  • It has a web interface for setting a waypoint, and it calculates and displays on instrument screens heading, time, and bearing to the waypoint
  • It enables customizable instrument screens displayed on your mobile device

index documents logs goto output_1sGSns

 

Any module in the app/ folder at startup will be loaded, if it has the following export:

exports.load = function(server, boatData, settings)  

These three arguments give the app access to the NMEA data stream, the sailors, and an easy place to store simple configs.

  • server – and ExpressJS server object, for adding new web apps
  • boatData – an interface to the boats sensor data.
  • settings – an interface to get and set simple config values.

You can write simple modules that just interact with the sensor data. With Node.js’s event based patterns, its pretty easy to create an app that calculates current from speed, compass, and gps sensor data.


exports.load = function(server, boatData, settings) {
    //@ 1Hz, broadcast current set and drift
    setInterval(function() {
        //first, get the latest boat data
        var data = boatData.now();
        
        //then use it to calculate the current vector
        var currents = calcCurrents( data.speed, data.hdg, data.sog, data.cog );

        //broadcast the new bit of data. boatData will handle NMEA formatting.
        boatData.broadcast({
            type: 'vdr',
            set: currents.set,
            drift: currents.drift
        });
    }, 1000);
};

Or to create an app to show more sensor readings (or custom calculations like ‘target speed’) on your tacktick displays.


exports.load = function(server, boatData, settings) {
    //add tacktick formatter to boatData's nmea parser
    boatData.nmea.parsers.PTAK = {
        format: function(data) {...}
    };

    //every time we get a heading message, make a custom 
    //tacktick message and send it back out.
    boatData.on('data:hdg', function(data) {
        boatData.broadcast({
            'type': 'ptak',
            'subtype': 'data',
            'index': 1,
            parts: [Math.abs(data.heel)]
        });
    });

    //every 5s rebroadcast the heading label
    setInterval(function() {
        boatData.broadcast({
            'type': 'ptak',
            'subtype': 'heading',
            'index': 1,
            parts: ['HEEL','@']
        });
    }, 5000);
};

Or modules that just give sailors access to the boat computer, like the Sailing Documents App.

Or you can make complex modules that have a web app for entering data, and use that data to calculate and broadcast new data to the NMEA network. See GoTo.

Check out the source, install it on your boat and give it a go. Let me know what you think in the comments, or through GitHub’s issue tracking.