Pi Zero Hardware Refresh, Wind Vane, and New Plugins.

The biggest change for the 2016 prototype is the change from the Raspberry Pi 2, to the Pi Zero. This change does a number of beneficial things such as lowering overall cost, increasing battery life, and shrinking the footprint.

Ostensibly I won a Pi Zero from the Hackaday.io contest, though I have yet to receive it. I was hoping to get that one before soldering on the USB port required for this project but it has not shown up yet. Unfortunately I did not have time to get new video so I suspect I won't really be judged very well for the 2nd phase of that contest. Oh well, eventually we'll be able to buy them in stores. Right?....Right?


Getting Mr. Gibbs to run on the Pi Zero took a little effort. The latest changes to the bluetooth stack require a bleeding edge version of Mono, and Mono does not (that I've found anyway) provide armel builds that will run on the Zero. The good news is that building Mono from source on the Pi Zero is pretty straightforward, if time consuming.

![gibbs on zero](/content/images/2016/03/IMG_3393-1.JPG)
*Mr Gibbs up and running on the Pi Zero*

In the interest of saving time between iterations, I went ahead and bought all parts in triplicate to make 3 eventual prototypes.


The new protoboard is 3cm x 7cm to roughly match the size of the Pi Zero. The circuit is very simple, UART tx/rx to the GPS, i2c sda/scl to the HMC5883L compass and MPU-6050 accelerometer, and +5V/grd to everything. I added a 90 degree header to act as a plug for the power regulator, and a 40 pin male header to connect to the Pi.

![protoboard build](/content/images/2016/03/IMG_3432.JPG)

The 40 pin female connector is soldered to the back of the Pi Zero, and the 2 boards snap together via the 40 pin connector, and then the Pi is attached to the 18650 battery holder via double sided tape. The GPS antenna is secured to the end with tape as well.


For an enclosure, I decided to build my own out of 2" PVC pipe which is readily available, cheap, and water tight.

![pvc open](/content/images/2016/03/IMG_3429.JPG)
![pvc closed](/content/images/2016/03/IMG_3430.JPG)

I did some basic tests to ensure it was waterproof in a 5 gallon bucket.

![water test](/content/images/2016/03/IMG_3412.JPG)

I still have a bit more to do in terms of testing and configuration, I'm having some issues with i2c on the Zero, and the new GPS (I changed vendors to save $6, always a good idea) but I'm hopeful these issues will be resolved soon.


The biggest change in terms of software has been to get the Bluetooth Low Energy Wind speed/direction sensor working. This allows a slew of new interesting metrics.

  • Apparent Wind Direction
  • Apparent Wind Speed
  • True Wind Direction
  • True Wind Speed
  • Mast Heel
  • Mast Pitch
  • Mast Bend Beam (Difference in angle left/right from hull sensor to mast sensor)
  • Mast Bend Centerline (Difference in angle front/back from hull sensor to mast sensor)
  • Peak Speed in Knots (peak speed from Polar Chart for current true wind speed/direction)
  • Peak Speed Percent (current speed as a percent of peak)

The last one is the one I am most interested in. The end goal has always been to have Mr. Gibbs process as much objective data as possible and distill it down to simple numbers for the Skipper. In theory I want 3 numbers.

  • Am I going the right direction (AKA, VMC %)
  • Am I going fast (Peak Speed Percent)
  • What should I be doing next (TBD, but one idea is distance until next tack)

With VMC % working last season, and now Peak Speed % too, we're making real progress toward this goal.

The other big development has been the addition of persistence plugins. Currently there are 2, both of which use Sqlite and Dapper to record data. The first is the StateLogger plugin, which simply logs all the values to a set of tables. A new database is started at each boot so that individual days of data can easily be removed.


The second is the PolarRecorder, which takes the current true wind speed/direction and looks up a normalized polar value on the current chart. If the current boatspeed is better than the existing value it updates the polar, if not, it returns the existing value as the peak for metrics. The idea is that over the course of the season we will build out polars for our boat based on empirical data.

polar data

That's all for now, progress is happening quite quickly now since most of the work is in the managed space. My first regatta is mid-April so I'm hoping to have all of the 2.0 issues complete by then.