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).