Due to other, exciting distractions (which I will mention in a later post), I haven’t had a chance to keep the blog up to date. Still, work progresses on the boat, and that’s the important part. Last month, with the keel now in its new position about 30mm further back along the hull, and sealed into place, it was time to add the electronics board.
Posts From Category: System Design
A quick look at the almost-complete Sailboat Guidance System (SGS). The board on the left is Igor. Otto is on the right, and the main CPU (Mother) is hidden underneath. The ribbon cable brings all the I/O to and from the boards. The red insulating tape is to remind me of some of the last remaining wires which need to be connected. You can also just about make out the DC/DC converter which is just underneath the ribbon cable at the bottom of the picture.
After a lunchtime conversation with a friend of mine, I ditched some of the earlier design considerations around message-passing and MQ-based systems in favour of the NoSQL database Redis.
Redis is an open source, BSD licensed, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.
That’s according to the official blurb on the web site, at least. It has several interesting components which are useful for Beoga Beag. It has a rudimentary pub/sub architecture pattern, it is extremely lightweight, it stores its database in memory rather than on a disk (so it’s less likely to burn through the Compact Flash file system), and it has an “append-only file” (AOF) archive mechanism.
As of about an hour ago, Igor and Mother exchanged communication. It was awkward, stilted communication, like a first date, but they talked! One of the issues with the RS232 stream is that the kernel is chatty. I’ve suppressed a lot of the boot-up messages, but there are still all those /etc/rc startup messages. As the ALIX board only has one serial port, those messages are sent to Igor. To avoid sending Igor into a tail-spin, or more importantly, sending the boat into a tail-spin, Igor ignores all RS232 output when Mother boots, until the magic word is sent over the wire. The magic word is XYZZY. Anyone want to try and figure out where that comes from?
There are four power supplies on board the boat. The main voltage rail is 12 volts, give or take. The solar panels feed into that via two separate DC to DC converters. Ideally, they would provide a 13.7v “float” voltage to the main rail. That voltage is the ideal float voltage for a sealed lead-acid battery at 20 degrees C.
There are two problems with this. Firstly, it is unlikely the battery will be pegged at 20C. In the Northern latitudes, we can expect the night-time temperature to drop well below that level. Likewise, once the boat catches the trade winds, the battery temperature will increase dramatically. I have concerns that the temperature could get well up into the 40’s, due to the fact that the battery is enclosed inside the hull.
In order to test the spiffy, new Wind Direction Indicator mentioned in a previous post, I assembled the mechanical components (without the potentiometers) and mounted it outside. As we live in a wind-swept area, with a high concentration of sea salt in the air, it was a useful test of how the system would perform. What I couldn’t test was the effect of high temperature/humidity in a salt-water environment. To do that, I’d have to move to the Caribbean (which seems like a good idea, given the Irish summer we’ve had so far!).
Anyway, I digress. After a few weeks of spinning freely in the breeze, I disassembled the unit to examine the condition of the internal parts, and the news is not good.
So, while debating the different merits (or otherwise) of various mounting solutions, someone suggested using a 3D printer to actually print the housing for the masthead wind direction indicator. The more I thought about that plan, the better I liked it. As it happens, 091 Labs in Galway have a working 3D printer, from the Mendel90 family. What’s more, they are trying to get a 3D printing service off the ground! I wasn’t customer number one, but I was probably pretty close.
The new ALIX board has arrived. It’s to the left of the picture, sitting on top of a copy of the infamous Lyon’s Notes (which is appropriate). Also, the initial Atmel board with USBtiny programmer cable, serial cable to same development system, and a couple of WRAP boards thrown in for good measure.
It’s running my custom version of NanoBSD quite nicely, and can see the GPS without any difficulty. The GPS unit is a BU-353 unit (the USB version) which is out of the shot. It’s attached to the window, and gazing at the man-made stars. To give a breakdown of what’s in that photograph, the ALIX is on the left. In the USB port is the GPS, the RS-232 cable at the top of the board is communicating with my development machine (running FreeBSD). The red CAT5 cable is connecting the board to the “house network.” The Atheros CM9 radio is a miniPCI card mounted on the underside of the board. It works on 5.8GHz and on 2.4GHz. In this case, I’m using 5.8GHz because (apparently) it has better cross-water characteristics and the band isn’t as crowded. The mini coax cable is at the top-left of the picture, connected to a short, 9dBi antenna. You can also see a 12v cable with barrel plug. At the top-right of the picture is a WRAP board, also developed by PC Engines. It was being used as a testbed for the operating system, but that is no longer needed thanks to the ALIX.
Now that the hull is looking solid, it’s time to start thinking again about the wind direction indicator. It is possible to detect wind speed by using an ultrasonic sensor and receiver, and measuring the delay between the two. You need to account for temperature changes and gusts can cause issues, but it is fairly reliable and has no moving parts. Generally, you use two transducers offset by a distance of perhaps 20cm for the North/South computation, and another pair in the East/West direction. I think if we were using a larger hull, such as a 4m boat, this would be a good plan. But, for the 2.4m (or the 1.2m) boat, it’s just too big and awkward. Also, this jury is undecided about how well they would work, over the long haul.
After much tweaking and hacking with configuration files and kernel build options, I finally have a FreeBSD 8.3-RELEASE kernel and install running on a Wrap board. Technically, it’s NanoBSD, which is a scaled-down FreeBSD install, which boots from Compact Flash. The WRAP board is the PC Engines forerunner to the ALIX. When National Semiconductor and AMD stopped making Geode chips, the guys at PC Engines had to stop making their very popular WRAP board. I still have a few of them tucked away, for emergencies such as this.
I’ve been asked recently, about the software platforms used on board Beoga Beag. This seems as good a time as any, to talk about the various layers. As mentioned previously, the lower layer is a custom board, running an ATmega8 Atmel processor. The software (Igor and Otto) is custom-written in C for the boat.
Looking at the system power design, the majority of the circuits will run off a +5 volt rail. Those elements which need a different voltage, such as the main processor board, will derive their own requirements from the main Vcc rail.
There will be at least two Vcc busses on board. Labeled, oddly enough, as Vcc1 and Vcc2. The difference between them is that Vcc1 is always on, at all times, and Vcc2 (through VccN) are selectable by Igor.
The main processor runs off Vcc2, but Igor (and Otto) both run off Vcc1. In situations where voltage levels are critical, Vcc2 will be switched off and the boat will continue on whatever course had previously been set, until either voltage levels are healthy, the specified “wake-up” time has elapsed, or there are critical issues which require Mother to get involved. A critical situation could be something like a dramatic wind shift, or an error such as a mis-reading from a sensor.
The Kalopa motor control board was designed as a general-purpose Atmel board with ancillary electronics for a wide variety of purposes. It includes two H-Bridge motor controllers, driven by two 16 bit PWM outputs. You can exchange one of the motor controllers for an 8-channel servo controller, also using one of the PWM outputs. It has a standard RS232 port with an RJ45 connector on the end. There is a MAX232 to convert logic levels to proper RS232 voltages. If you want to use radio control, you can instead populate the board with an R5-434 radio receiver. It will listen for data on 434MHz and feed it to the Atmel. The processor itself is the bog-standard Atmel ATmega8 with 8k of code and about 512 bytes of RAM.
The main computer on board Nostromo in the film Alien was called Mother. It seems only right that we should call our main processor by the same name.
In terms of the system architecture, we’re planning on using two separate computer control planes to manage and steer the boat from start to finish.
At the lowest level, a custom Atmel (ATmega8) board will act as a basic “autohelm”, driving the boat to a specific True Wind Angle or TWA. As the breeze shifts, so too will the boat, to maintain that TWA. This is a basic PID algorithm for controlling the rudder and mainsail in relation to the specified TWA and is very similar in design and implementation to your average sailboat autohelm. This is the control board, also known as Otto or Otto von Helm, to give him his full title. Otto will most likely be assisted by Igor, in charge of power management and the boat environment. It is Igor who will turn on and off the other systems on board, including the main system (Mother).