Tags: moop, raspberrypi
For several years we’ve been using Gumstix single board computers running Linux at the heart of our sailing robots. We used one of these for our transatlantic attempt on Pinta. In the last few months we’ve been hearing a lot of promising talk about the Raspberry Pi, another single board computer with similar specs to the Gumstix but a much lower price. Back in May we finally got hold of a Raspberry Pi and decided to see if we could replace the Gumstix in one of our robot boats. It turned out to be pretty easy!
In our small MOOP boats, the Gumstix is just used for processing and all the low level I/O takes place on a PIC microcontroller. The PIC is linked to the Gumstix via a single serial port. The Raspberry Pi has a 26 pin header which breaks out the serial port (at 3.3 volt logic levels), some GPIO pins and provides pins which can be used to power the board. So we reused an old connector from a PC motherboard and hooked up the Raspberry Pi to the PIC’s serial port and the 5 volt regulated power supply that had powered the Gumstix. We hooked the Raspberry Pi up to a miniature WiFi access point, so we could login remotely using SSH from a WiFi enabled laptop. For the initial setup we plugged in a USB keyboard an a small HDMI monitor, but these were just for setting things up and aren’t needed long term.
Getting the software turned out to be really simple. The Debian Wheezy image for the Raspberry Pi included the GCC compiler. Our Gumstix code is written in C, but normally cross compiled for the Gumstix. A simple edit to the Makefile to change the compiler from the cross compiler to just “gcc” and we we’re able to recompile the code and run it on the Raspberry Pi. The only slight hiccup was that for some historical reason the code depends on the ncurses library, so we had to plug the Pi up to the internet and install the libncurses-dev package. It was really nice to have the compiler actually running on the robot. This is something that’s possible on the Gumstix using a newer version of the operating system, but we’d never had this option. It now means that when we are debugging in the field, we can switch from one laptop to another and just keep the code on the robot and do any editing required there. With the code compiled the control system ran just fine on the Raspberry Pi the first time. However on a second try there seemed to be a problem with the serial communications, messages from the Pi to the PIC were received without any problem but the responses were getting corrupted. On trying again a few weeks later this problem seemed to go away. Maybe it was just a loose connection on the Raspberry Pi’s serial port RX line.
Overall we’re pretty impressed with the Raspberry Pi and its potential for robotics. When compared with the Gumstix its pretty close, but not quite as versatile for I/O. However a Gumstix (Verdex Pro, Netpro and Breakout-vx) board costs us over £200 including import duty, a Raspberry Pi costs about £30. The Raspberry Pi has more RAM, a faster CPU, HDMI output, 2 proper USB 2.0 ports (the Gumstix has 1 USB 1.1 port that uses a mini USB connector). However the Raspberry Pi only has 1 serial port and 8 general purpose IO lines (GPIO), while the Gumstix has 3 serial ports and over 20 GPIO lines. For our MOOP robots, this isn’t a problem as they just need one serial port going to the PIC microcontroller. But, some of our other robots use a lot of the GPIO lines to create a parallel bus to the PIC or they use all the serial ports to talk to other peripherals. Now we can expand the I/O on the Raspberry Pi with USB serial converters, but these can experience higher and less predictable latency which isn’t acceptable for some of the high precision navigation we do with some of our robots. The Raspberry Pi’s power consumption is also a little higher than the Gumstix. According to our variable power supply the Gumstix uses between 200 and 300 milliamps at 5 volts. When the network or CPU are used its nearer 300, when its idle its around 200. The Raspberry Pi seems to need a constant 350 milliamps, although some people have managed to change its linear regulator for a switch mode power supply and this might make things more equal.
We demo’ed the Raspberry Pi MOOP at the Aberystwyth University’s Computer Science Show and Tell on May 11th 2012 and then again at the Machnylleth Raspberry Jam on July 21st 2012.
Unfortunately the boat has a bit of damage to its sail attachment right now, but hopefully we’ll get it fixed soon and we might try and sail a Raspberry Pi powered sailing robot at the World Robotic Sailing Championships in September this year.
Here’s a little video from the Machynlleth Raspberry Jam showing the boat (go to about 3:35).
Unfortunately the MOOPs little journey didn’t quite go as planned. After sailing east for a few hours to begin with, the boat then headed north, then west heading further out to sea than the start point. Then after a few loops she headed north towards the Llyn penninsula, just after 20:00 UTC on the 4th of September we received a message from the SPOT tracker showing the boat to only be a few hundred metres offshore near Porth Ceiriad beach. This is a popular, but remote surfing beach with sand across the middle but rocky cliffs on either side. The beach is about 2 hours drive away from Aberystwyth and unfortunately other commitments meant we couldn’t go and look for her until Wednesday 7th.
We got there about an hour after low tide and attempted to walk along the beach towards the last reported position of the MOOP. Unfortunately there isn’t much of a beach in that area, just lots of large rocks. With an incoming tide and increasingly slow progress over the rocks we were forced to turn back, having only been able to get about 500 metres from the last reported position. There was something white visible through the binoculars, which might have been the sail, but it could have been a buoy from a lobster pot or something else which had washed up. Given the size of the rocks on the beach, the boat could easily be hidden between two of them or smashed to pieces by them. It might have been damaged and then dragged back out to sea again. It doesn’t look like we’ll ever find out.
At approximately 15:30 today we launched the MOOP from a point about 5 nautical miles West of Aberystwyth. We aimed her east towards Ynyslas beach, north of Aberystwyth in the hope that we might recover her easily in a day or so. If we do it will be a good sign that the simple controller works at sea, at least over short distances. We might then try for a longer journey out across the Irish sea. We’ve already had a few messages from the SPOT tracker and its looking like the boat is on course for coming back to the beach.
Over the last month we’ve been preparing one of our 72 cm long Miniature Ocean Observation Platform (MOOP) boats for a sea voyage. Up until now these boats have only been sailed over short distances, mostly in lakes and under close supervision.
For the last month as part of a project we’ve been trying to build a really simplistic controller for the boat, to see how little we can get away with while sailing it at sea. We tried to build a purely analogue controller, which we could keep the boat on course with respect to a given compass heading. It used a pair of opamps to compare the output of the compass (which was a PWM signal transformed into an analogue voltage) with a potentiometer. One of the opamp outputs would drive the rudder motor (a servo without its control board) left, the other right. Unfortunately there was a problem with this circuit which we could never get to the bottom of. This was causing the opamps to short circuit and blow up under certain circumstances. So we decided to replace the opamp system with just a basic microcontroller, which just read the compass and set the position of a rudder servo. The target heading is determined by turning a potentiometer, which is read through one of the microcontroller’s analogue inputs. The sail is just fixed in a beam reach position and is made from part of the cloth from Pinta’s original sail (which we placed before her transatlantic attempt). There are 5 size F 13 amp hour, 1.2 volt NiMH batteries, we think these should be enough for a week or two of sailing. The only other component in the boat is a SPOT satellite tracker, which has its own microcontroller that presses its “ok” button every hour causing it to transmit its location. The SPOT uses its own batteries, so even if the main batteries go flat it should continue to transmit.
Tomorrow we plan to launch the boat from a few miles offshore and sail her back onto the large sandy beach at Ynyslas, a few miles north of Aberystwyth.