The Power of Raspberry Pi: the blissful beginning

When we first heard about the Raspberry Pi (RPI) credit-card sized computer we thought that it might meet the goal of a low energy usage (just over 1 Watt) server on Mahdee that ran 24-7 and performed some essential functions. Those functions included logging, serving and displaying boat and weather data, as well as monitoring that data and sounding alarms when something isn’t right.  Our first RPI took many months to arrive because of demand exceeding supply in 2013 and the RPI coincidentally arrived at the marina office on Pi day (March 14).  It was late afternoon when I excitedly went to the office to take delivery (possibly just before 1600 and presaging a near obsession with this delicious sounding device).

Screencast of weather program on Raspberry Pi

The first RPI had only 256MB of memory and saw little use before we broke the SD socket. So it was replaced by the upgraded RPI with 512MB memory. With twice the memory of the original RPI and an over-clock ability, I was full of anticipation about what this improved, yet still power sipping lilliputian computer was capable of.  In hind sight, there was much to learn about the RPI.  This is the first in a series of blog posts describing how Raspberry Pi’s are used, and how their use has evolved aboard Schooner Mahdee. For the impatient and those who prefer doing rather than reading, the latest version 2 of the Raspberry Pi (RPI-2) can be purchased here and by following that link, you get a great price and can help to support the Raspberry Pi Foundation mission as well as this site.

Weather data on Mahdee is provided by our mast-top Airmar PB-100 weather station. The Airmar PB-100 provides relative and absolute wind direction and speed, barometric pressure, temperature, humidity and dew point, as well as boat magnetic heading, pitch angle and roll angle, GPS position, GPS course and GPS speed. The Airmar data is multiplexed with some boat data such as depth-sounder, water temperature and boat speed through the water before being sent via USB to the RPI. In order for the RPI to decode the Airmar data, the ftdi_sio kernel module must be loaded. And the crucial trick after loading that module, is to execute this special command:

echo 0403 d9a8 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id

Without that change the data is not a readable serial port stream. With that change, the Airmar data is readable. We wrote a script to capture the USB serial data, time stamp each line with computer time and save it to a file. Initially, that data was saved on the RPI SD card which the RPI uses like a hard disk and also has the operating system and programs on it. SD cards have a fixed number of writes in their life, and after about a year, the limit was achieved and the SD card failed. So, we got a new SD card for the operating system and programs and a Passport USB-2 hard drive to hold data and thus preserve the life of the SD card.

When the weather and boat data are being saved, the data are forked and also sent to a serial-to-network converter that provides a pseudo serial port that is available on a network port of the RPI. We then wrote a QT-based program to connect to that port, read the data and display it on the RPI’s HDMI monitor. The QT program requires a GUI on the RPI and has many alarms including a position/anchor alarm, as well as a wind speed alarm. We cross-compiled the QT program to make different executables that run on the various computer architectures we have on Mahdee. An early version of that program was published on my GIT account, but if anyone wants a copy, please let me know so that I can update the version on my GIT account.

In the first versions of the QT program, we discovered that the displayed data was lagging further and further behind because the QT program could not always keep up with the Airmar data feed. This defect became painfully obvious during three sequential southerly gales while sailing north in March off the Oregon coast on our way to Alaska and striving to not unintentionally gibe–the displayed wind gust directions were just not matching the observed effects. It was pitch dark and freezing cold out in the cockpit with boarding seas and driving rain and we really, really wanted to steer from inside Mahdee’s warm, sheltered chart house and that required a good weather display with real-time information. We fixed that problem (later while recovering in a marina in Alaska) by allowing data to be dropped in the QT program so that the displayed data is the most recent data. If we want to analyze all data, we can then retroactively parse the saved file.

Sometimes the data capture would fail which would freeze the data displayed by the QT program. This required us to first notice the data freeze and then find the source of the problem.  We immediately noticed a data freeze when we were hit by a williwaw in a fjord in BC Canada and the displayed wind speed froze at only 56 knots even though conditions and our control of Mahdee were rapidly deteriorating. At the white-out stage, we knew something was wrong with the display.  The fix was usually to manually restart the data capture program, but there were often long gaps with no saved data because we didn’t notice the failure right away (or alternatively we were too busy fighting to control Mahdee in a williwaw). This was a big problem if we were counting on the RPI to sound an alarm–e.g. if the anchor came unset while we were asleep. So we wrote a Cron script to periodically check for file updates and if too much time passes without an update, a script automatically runs to restart the data stream. Alternatively if the external Passport USB drive becomes unavailable, the logger will automatically switch over and use the SD card for data storage. The automatic scripts greatly improved the reliability of our weather and boat data and improved confidence that the alarms will sound when they should. At this point, the RPI became a key piece of safety equipment aboard Mahdee.

Of course, we want the RPI to do more and in the next post we will discuss our experiences loading up (overloading?) the RPI.

Messing about in boats

“There is nothing — absolutely nothing — half so much worth doing as simply messing about in boats. In or out of ’em, it doesn’t matter. Nothing seems really to matter, that’s the charm of it. Whether you get away, or whether you don’t; whether you arrive at your destination or whether you reach somewhere else, or whether you never get anywhere at all, you’re always busy, and you never do anything in particular; and when you’ve done it there’s always something else to do, and you can do it if you like, but you’d much better not.”

Portaging the Canoe

Chirps and Trills

We have a Newport diesel heater in our main saloon. It uses very little fuel – something like a gallon a day – and has a little overflow / return line in case the fuel pot does overfill or we’re underway and it is rough enough for the pot to spill. We purchased it used on Craigslist in 2011, installed it in 2012 but really didn’t use it a lot until 2014.

triller

The photo below was taken in early 2013 when we’d finally gotten around to plumbing the fuel lines and testing it. The previous owner of the heater had, for some reason plumbed the copper overflow pipe out the front of the heater and we set it up, tested it with a glass mason jar secured to the bulkhead, sitting inside a plastic shoebin – as shown here. Very “Rube” but functional. We liked how it worked so David just plumbed the overflow behind the heater tray, drilled a hole in a mason jar lid for the copper pipe to go into and there we had it – a visible system that we could watch but yet contained (though small). Originally, I had planned on enclosing (in a box under the heater) the small gas can shown in the picture sitting in front of the temporarily plumbed overflow. But we worried that we wouldn’t see the overflowing fuel until it was too late so kept the “clear” system in place.

The fuel has rarely ever overflowed. For about a year I’ve had 1/2” of diesel fuel in the bottom of the mason jar from an “oops!” on the pre-start fuel. I could see it through the clear jar and clear bin. I keep a single paper towel and another (empty but capped) mason jar in the bin next to the overflow jar. Sometimes the empty jar has diesel fuel in it because David bleeds the fuel system into the jar and I used that bled fuel as a starter for the Newport heater.

heater1

A few days ago Beryl began to act…peculiar. She is normally a calm and quiet cat, frequently happy and trilling in that Norwegian Forest Cat way and infrequently complaining about her little life aboard. But she has been whining in a cat-like meow way – no trill, no happy, no fun little chirps. Checking the usual food bowl and water bowl culprits, I could see all was good for Beryl. We petted her, we played with her but still the whining persisted.

Beryl has a habit of covering things up when she finds them unpleasant. So, if she upchucks a hairball, she will wander around until she finds a bit of paper or a napkin. A keenex, or paper towel from the trash will do to cover up the offending mess as well. She is consistent in this. If I see papers on the sole, I know what will be under them.

I often give David a paper towel to use as a napkin and he will set it on the main saloon seat next to him. Beryl has recently been taking these paper towels, shredding them a bit and placing them in the clear shoe bin where I keep the lone paper towel that I tear a strip off of to use as a wick in lighting the heater. I thought “oh, how cute, she knows this is a place to keep a paper towel” and I looked at the bin noting that the diesel was a tiny bit over an inch in the mason jar. Huh, wonder how that happened?

Yesterday, the diesel heater was running a bit strangely and I thought it must be time to clean the pot – an occasional affair as the pot fills with a lava rock looking type material that takes up space in the bottom of the pot. I also thought that perhaps that was why the mason jar had risen an inch in diesel. I thought to myself – this diesel is road diesel, almost clear without the familiar red tinge of fuel dock diesel. It’s harder to see this diesel and I’d better be careful to watch the jar.

Fine intentions. When we leave the boat, I turn off the diesel heater. We went to the YMCA last night so the heater was off. As I turned it back on as we returned to a somewhat cold boat, I saw that Beryl had placed all the paper towels and napkins she could find into the shoe bin and I thought – this is nuts, at this rate she’ll be raiding the trash for more! And she whined at me, taking one of the paper towels out of the shoe bin, shredding it and looking at me in a meaningful way that I was missing entirely. I put the paper towel back in to the overflow shoe bin automatically not even putting it in the trash instead!

Today, David and I puttered a bit in the morning, dealt with phone calls and then took the dingy out for a little trip around the nearby surrounds. We did leave the heater on during our brief time away and as we returned to the boat I smelled diesel and thought “odd.” A few minutes later I saw the mason jar was completely full with the overflow going into the shoe bin which was also at the brim! Yikes. I turned off the heater and fuel pump, and I emptied the mess into one of my enamelware kitchen pots noting that it would be less of a mess without all of Beryl’s “extra” paper towels now diesel soaked.

We turned off the bilge pump, opened up the sole and placed a diesel absorbent mat into the bilge directly below the heater as a few ounces of fuel had actually made it onto the sole. David vacuumed the floor as I inspected the area and emptied the diesel-filled shoe bin to the enamel pot. Beryl sat watching the activities with her usual interest in everything we do. When we were done, David and I looked at each other and said “Whew! That was close!” as Beryl chirped and trilled happily that we’d finally dealt with the mess she’d been warning us about for three days.

Google Analytics Alternative