Friday, May 31, 2013

Arduino weds Raspberry. The "Freeboard" project

"If you imagine it's possible, someone else is already trying to doing it, or has already done it." The Installer.

This was how I left my musing on the fictitious open source Celestronic M1 chart plotter system. I wasn't aware at the time how extensive the efforts were by an ever increasing cabal to build these types of systems. My screen display was photoshopped, the ones below are real.

Another aspect of the Celestronic story was to illustrate how tentative marine electronics manufacturers have been in adopting new technologies, although this has certainly improved over just the past few years. It seems with each technological advancement the buying public endorses, the rest of the herd immediately follows. Raymarine introduced the e7d with both WiFi, and blue tooth, and now who doesn't have this capability? But WiFi, and Bluetooth had been laying around for many years before its adoption into marine electronics world.

This all started with a somewhat cryptic comment left on the Celestronic post by "Practical Pirate." "Check out Freeboard at 42.co.nz." I did, and this is Robert Huitema's approach to an open source hardware/software navigation system, "The Freeboard Project".


Robert built his system around the open source hardware processors the Raspberry Pi ($35.00) and the Arduino, (in this case the Mega version $60.00). In basic terms, the Arduino is used to collect and process data such as NMEA 0183/2000, wind direction, voltages and others. This part of the system can be also used as a stand alone addition to your existing navigation system.

The Raspberry Pi, receives that NMEA data from the Arduino or your current systems via USB, and does real time updating of browser pages accessible to PC's, tablets, and other mobile devices via WiFi. It also broadcasts the NMEA data over WiFi so you can access it from OpenCPN or your cellphone/tablet navigation app.

So far we have spent about $100.00. Add a USB WiFi adapter a USB hub, a serial GPS, digital compass, and wind instruments and we are now at about $500, for a system ready to navigate.

The Raspberry Pi is the processor for the world you will be able to hear and see on the displays. It has composite video in, HDMI sound and video out, and audio in. You can even add an on-board 5 megapixel camera for about $25.00. The Raspberry uses the ARM 11 processor. You will also find this in most smart phones, and the iPad. Don't let its credit card size fool you. There is a lot of computing horse power here.

The Arduino is an amazing device all by itself, and has been used in thousands of projects. You can check out this extensive list of a few of them.

The Arduino Mega microcontroller has has 16 analog inputs, and 54 digital input/out pins, of which 15 are pulse width modulated (you can use these to control DC motor speed and direction). Add to this four serial ports, and the USB interface, and you have a very capable back end processor.

Now that we have met the Arduino, it's time to talk a bit about shields. Shields are Arduino compatible boards that add additional capabilities to the system. For example you could add a gyro and accelerometer, or a CanBus shield to your Arduino. Currently there are 291 shields listed with another 390 yet to be added.

Shields "Stack" on top of Arduinos. There are some limitations on how many can be stacked because each shield has to use the resources of the Arduino at the bottom, and things like data pins don't like to share with others. But lots of specialized functionality can be added.

There are more things we can add to our system. This is an ArduIMU V3 shield with a 3 axis compass, accelerometer, and gyro that sells for about $80.00. The Freeboard project provides a software image that adds NMEA output to this device so it can also be used as a stand alone rate adjusted electronic compass. This can provide heading data for radar overlays, and inputs for the autopilot yet to come. It's impact rated for an astounding 10,000 gees so I'm pretty sure it will take the waves.

For $99.00 we can add a wind instrument that sends serial data to our Arduino. Robert also located a low cost technology that can translate Seatalk to serial RS232 that can be read by a PC. The Canboat project is working on being able to read and write NMEA N2K PGN's.

So far it is apparent that all of a vessels navigation and sensor requirements can be met with relatively inexpensive open source hardware. But what can we do about the autopilot?

The original Ardupilots were shields that stacked onto a Arduino processor. As time has passed it has morphed into a more stand alone Arduino compatible product such as the Ardupilot 2.5 pictured.

It only costs about $180.00 with enclosure. It's somewhat of an overkill for a boat. It can manage a quadcopter, or fixed wing aircraft, has a compass, gyro, accelerometer, barometer, on-board telemetry, and many more features. There is activity to turn the Ardupilot into a Arduboat, but this is primarily orientated toward the servo actuated RC community.

So can you use standard Arduino's for a boat's autopilot? The answer is absolutely yes, and Jack Edwards has built one that runs in heading mode (Auto), and tracks to a waypoint with cross error correction. It has successfully followed a 40 mile complex route. Wind instrument integration, and a rudder reference are next. In this case two Arduino Mega's are used. One to manage the GPS data which then sends it to the second Arduino that handles the balance of the autopilot tasks.

What does seem to be missing from the Arduino open source hardware collection is a Arduboat autopilot shield designed specifically for a real boat. Maybe with a rudder reference input, on-board gyro, compass, and accelerometer. The Arduino can already interface to a DC rudder drive system, and a serial GPS. Wind data, waypoint information, and other data needs can also come via the Arduino. Okay let me think for a second, let's add a couple of outputs to manage the thrusters, and don't forget some capability to control the engines. I may want my boat to do the Skyhook thing, and be able to dock itself. Have I forgotten anything? I'm sure I have.

The Celestronic story was a flight of fancy, and I threw a lot of current technology at the wall to see if any would stick. I then belatedly discovered most of it was already long stuck on the technology wall somewhere world wide. I had no idea at the time how much open source high quality hardware and software was already available.

Is the Arduino the salvation of the marine electronics industry? The answer is conceptually yes. If it isn't, it's very very close. It does provide a crystalline view of a very possible path toward the future. The basic system elements seen could be redesigned to more specifically address the elements needed by boaters along with simpler implementation tools. Your marine installer in the future could be both building, programming, and installing a system to spec, at less cost. 

In the mean time the Freeboard system has some very inexpensive and clever solutions to multiplex, and wirelessly move NMEA data to PC's and mobile devices, display data and charts in a wireless browser environment, and provide accurate heading data. The modules can be used independently, or be integrated and combined. They will also play with your existing legacy marine navigation systems. The software is free, and open source also.  

Is this all good for the marine electronic industry? In the long run, I think so. The open source, and third party app models can only have an overall beneficial impact. There may be tribulations dealing with patents, liability, propriety, proprietary or reliability issues, but they will work themselves out. Who could have believed just a few short years ago, that there would now be over 800,000 Apple iSomething apps available.

And speaking of apps, a client of mine just downloaded an anchor watch app for his Ipad. He can't hear his brand new cockpit mounted MFD's alarms beeping while in the cabin. It seems there are no longer any external outputs for alarm buzzers in this system. The app works great, and it costs just ninety nine cents. The Freeboard system approach doesn't have this problem, it can be created.

How about your chart plotter telling you out loud, "Shallow water, Danger." Would a built in barometer be a good idea? How about using it to Skype with another boat in coastal waters, or even a calculator to just add up the parts costs your going to buy to keep your boat running. Integrating a Spot like device into the chart plotter system so you can be followed might be cool. It would at least let people know where the boat sank. Being able to put your own digital notes on your charts like an arrow pointing to that uncharted shallow spot. I'd like that. These are all technically possible.

There is one more final note. The hardware is very low cost, and the application software is free, but at this point in time there are no turnkey packages for sale. You have to buy the computers, package them, and make them work. I've started down this path by buying an Arduino to learn about them, and there is a massive community out there to give you a hand.

Arthur C. Clarke's three laws:

1. When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.


2. The only way of discovering the limits of the possible is to venture a little way past them into the impossible.

3. Any sufficiently advanced technology is indistinguishable from magic.


This is the link to Robert Huitema's Freeboard site.
For more information on the autopilot development you can email Jack Edwards (coyotewaits3@gmail.com).
The photo of the "stacked shields was taken by John Boxall.
Screen shots, and block diagram were courtesy of Robert Huitema.
The Raspberry photo was taken by Wikipedia user Jwrodgers and annotation was added.
The Arudino Mega photo was taken by Wikipedia user David Mellis.
Want to by an Arduino or shields? Sparkfun Electronics is a good place to start.


5 comments:

  1. Open source marine electrinics sounds pretty interesting. In the future, would the basic hardware be something you could see the builder installing at the factory level, or would it be something you'd prefer to package and install yourself?

    ReplyDelete
  2. That is pretty damned nice. I could see packaging a lot of this to be portable, for use on deficient bareboat charters. Spent last weekend running from Seattle-Lopez and back on an otherwise great Dufour w/a Garmin "GPSMap" postage-stamp sized plotter sporting something looking like ~192x192 resolution and a pair of extremely worn zoom keys. Ok and better than nothing in conjunction w/paper charts but given the complexity around here could be lots better.

    OpenCPN down below on a ThinkPad and my waterproof smartphone w/MXMariner topsides were better than what was bolted onto the boat. Three devices ain't elegant, though.

    A subset lashup of what you show here and stuffed inside a Pelican case w/clear cover and decent LCD panel would be great. The low power consumption of the MCU boards would make it possible to run such a thing continuously for long periods from a reasonable LiFe battery also in the case, or just via cig-lighter plug and cord leading from below. (bareboat is all about adaptability :-) )

    ReplyDelete
    Replies
    1. I think there are zillion of approaches to solve the problem, but they all have the same elements. You have to collect data, process data, and then display data, and/or use the data to control something. Toss in this mix the costs involved from low to high. I think boat manufacturers will stay away from playing with any open source technology, they can barely get a boat assembled to the point most stuff sort of works. I think they would best serve the technology by providing good access for wiring and equipment. Unfortunately the color of the salon pleather takes precedence over maintainability. The consumer gets to take some of the blame for wanting impracticable technology. Does your TV levitate out of the ceiling electrically, or does it just sit on the wall? One of my very low cost navigation options is a netbook with a USB GPS and Seaclear. you can leave it in the cabin and use the Air Display app to see the PC display on most android and Isomething phones and tablets.

      Delete
  3. As an alternative if you want to dispense with the arduino and use serial-to-usb converters instead, kplex (http://www.stripydog.com/kplex) could be worth a look. Does serial line / multi network multiplexing, sentence filtering, failover, data logging, source prioritisation etc. No "display" but you can use your tablet or opencpn etc. on a pc for that

    ReplyDelete
  4. I really like this idea. I've been looking for something like this for a number of years. I use the Raspberry Pi to control my HO trains (www.JMRI.org) and it's worked out great. I would prefer to use two or three Pi's than a Pi and a Arduino (just a personal preference). I've been thinking along the same lines as Keith. Run Freeboard on one Pi and Kplex with a GlobalSat BU-353 USB GPS Receiver on a second. Has anyone tried this? I also can't find any forums with people using Freeboard. I'm a little worried about support.

    ReplyDelete