An Electronics Project for Sailboat Racing

I’ve always thought it was fun to do small electronics hardware hacking projects. I also really enjoy sailing. I had an idea for an onboard electronic gadget I could make to help with sailboat racing. It took four years — but it works!

I’ve always thought small electronics projects were cool — the challenge and elegance of creating a digital device that does one thing extremely well, composed of parts stripped down to the core needs, rather than building software in the common environment of general-purpose laptops and servers. I took some classes on this in college (I actually have a minor in Electrical & Computer Engineering), and occasionally thereafter built some small devices on platforms like Arduino or particle.io, but it had been a while since my last hack, and I was rusty.

Then I had an idea for a device I could use on a regular basis. It would combine two things I really liked — digital technology, and sailboat racing. The Raspberry Pi platform gives you a ton of power. The marine environment makes engineering quite complicated. This took a lot longer than expected (especially with a pandemic in the middle) but the result is really cool:

An LCD without a case sits on a desk. It is displaying a user interface showing several instrument readings and calculations provided by my Raspberry Pi-based software.
An almost-final version of the UI active on the unassembled touchscreen LCD, running on demo data
A photo of an LCD displaying boat performance telemetry in the cockpit
The completed device, in use on the water

This story is about what I made, how I did it, and some things I learned in the process. The entirety is very long, so I’ve broken it up into separate chapters, one blog post each.

Marine electronics project — table of contents

  1. Project background
  2. The platform
  3. A digression on suppliers…
  4. The software
  5. Power and packaging
  6. Fabrication and assembly
  7. Mounting and installation (take one)
  8. Installation (take two) — Success!

Background: Sailing Fast Upwind

You can’t just point a sailboat any direction you want; sailing upwind requires zig-zagging diagonally across the wind field. How high into the wind you “point” is a tradeoff between sailing more directly at your goal and the absolute forward speed of the boat. For each boat, there’s an optimal angle to sail into the wind — the best tradeoff between power (speed) captured from the wind, and progress toward your upwind goal (“velocity made good” or VMG), as opposed to laterally.

Sailboats heading at different angles to the wind, with different forward speeds and different upwind progress velocities.
Sailing at different points of sail to the wind means different maximum speeds

In mathematical terms, the VMG is the cosine of your forward velocity (boat speed) along your angle to the wind.

But it’s slightly more complicated than that — the optimal angle to sail is also a function of the wind speed you encounter. Depending on whether the weather is windier or calmer, you need to adjust and steer a bit differently.

There’s a service you can pay for that will run some calculations about the particulars of your sailboat — the make & model, as well as the sizes of the sails you carry, and they will send you a spreadsheet that displays something called the polars of your boat, as well as targets. This is done by physics modeling software called a Velocity Prediction Program, or VPP.

The Targets Table is simpler, so I’ll explain it first: For a few evenly spaced wind speeds, it tells you what angle into or away from the wind you should aim for, and how fast you should expect to be going, for optimal upwind or downwind sailing. You can print this out on a little card, laminate it, and refer to it while you’re trying to sail fast:

Two tables, one for upwind, one for downwind VMG. Each row of the table is keyed by the true wind speed, and displays the target boat speed, apparent wind speed and angle, and true wind angle for optimal VMG sailing.
The Targets Table for my sailboat. Based on the currently-observed True Wind Speed (TWS) it provides a target boat speed (BS), apparent wind speed (AWS), apparent and true wind angles (AWA and TWA), and heeling moment you should experience if you’re sailing optimally. (Sharp-eyed sailors should note that the downwind table shown here is calculated for a poled-out 115% genoa.)

As you’re sailing you look at your instruments to note the true wind speed (TWS). Referring to that row, you can tell how fast your boat speed (BS) should be, as well as how high into the wind you should point (TWA or AWA if you’re referencing true or apparent wind angle respectively). Your first objective is to adjust your direction to point at the right TWA/AWA. Then if your forward speed is lower than the specified BS, adjust your sail trim until you get up to the right speed.

So as an example, in 12 knots of wind (1 knot = 1 nautical mile / hr ≈ 1.15 mph), you should be pointing at 41° off the true wind angle on one tack or the other; and if you’re doing everything right, the boat’s forward speed should max out at 5.8 kts. That will give you optimum VMG for those conditions.

If your goal is heading directly downwind, you refer to the lower table — instead of running directly 180 degrees off the wind, this table says you’ll actually get there fastest by zigzagging down at 172-174 degrees to either side.

I’m not exactly very good at it, but I really enjoy racing my sailboat. I’m always trying to learn how to go a bit faster. Tools like this give me something specific to aim for, rather than just guessing if something “feels faster” (from a VMG perspective) or not. There are limitations though. For one thing, I have some electronic instruments for measuring wind speed/direction, and the boat’s speed and heading. But from those, you need to look at the wind instrument, do the lookup into a printed card, then glance back at the speedometer, and then figure out what to do.

A B&G instrument display showing boat speed, true wind angle, direction and speed, and compass heading of a boat.
A B&G instrument display showing readings from boat speed and wind sensors, arranged around a compass.

The math isn’t hard but it is distracting, especially when you’re also trying to scrutinize your sails and keep an eye on the racecourse. And also, those tables work for a race course that is a direct upwind-downwind “racetrack” but sometimes race courses are shaped like triangles or diamonds and knowing the target speed for those other points of sail requires looking at a different (much larger) table (called the polars table) that would be too cumbersome to use by eye.

The Goal

Electronics manufacturers will sell you a fancier instruments package (like the B&G Hercules H5000) that can ingest the polars table and run the real time target calculations for you for any point of sail — but that costs thousands of dollars… display sold separately. (Are you kidding me?!) I wanted a better interface for performance calculations, and hopefully at much less cost. Most of the math to perform, after all, is fairly simple — just some basic trig like sines and cosines.

I figured I could build a device that shows me what I want. It should have a LCD display that would give me clear directions — “head up/down by X degrees, increase speed by Y tenths of a knot” that would reduce the cognitive attention load and let me focus more on the boat and the race, while still giving me the data I need as quickly and clearly as possible. It needs to talk to my existing marine instrument network. And it needs to be waterproof.

And, friends, it took three years of off-and-on work (and another year of procrastinating before I finally got it fully installed onboard), but I actually built it:

An embedded hardware device of a computer with an LCD inside a plastic enclosure sits on a desk. A dashboard of various (blank) instrument readings and calculations is shown on the LCD.
The completed device on my desk, powered on but not hooked up to sensors

I learned a lot along the way, about marine data networks (NMEA2000), Raspberry Pi computing (which is awesome), electronics integration and electrical systems, 3d modeling, and even a thing or two about CNC machining. This has been a lot of fun. (It also is cheaper than buying an H5000, but in the end, it was also more expensive than I would have thought — and definitely took way longer to make than the shipping lead time for an existing device.) The rest of these blog posts share the details of how I built it (with some critical help from a few friends).

Links to each chapter will appear in the table of contents below as they are posted–stay tuned!

Marine electronics project — table of contents

  1. Project background
  2. The platform
  3. A digression on suppliers…
  4. The software
  5. Power and packaging
  6. Fabrication and assembly
  7. Mounting and installation (take one)
  8. Installation (take two) — Success!

3 thoughts on “An Electronics Project for Sailboat Racing”

  1. I’ve enjoyed your hardware posts.. now I fantasize about making a “new train in X minutes” sign to sit on my desk and in my living room

    1. You should make it! That same impulse has crossed my mind, too.
      You could probably put that together with an Arduino wifi breakout board + an HD44780-style character LCD.

  2. Pingback: 3-D printed case for Raspberry Pi & LCD – The Gremblog

Leave a Comment

Your email address will not be published. Required fields are marked *