Saturday, May 19, 2018

Almost

Nina almost got a Flaka yesterday. She said that for the very first time, the board kept turning while she was sliding backwards. She probably finished the 360 degree rotation, and maybe even a bit more. But she did not realize she was done until afterwards, so she fell onto the sail. But still, that's big progress.

We sailed Lewis Bay in NE wind yesterday for the first time. In NE, we usually go to Duxbury, Chapin, or other spots, but the tide was too low yesterday morning for most of those, and the wind was predicted to drop early. Lewis Bay was a bit gusty, but otherwise quite nice. But there was a surprising amount of ferry and boat traffic.

I almost got to test my Raspberrry Pi Zero "plug and play" GPS while windsurfing for the first time yesterday. Here's what the setup looks like:
It's a Raspberry Pi Zero, a Stratux GPYes USB GPS dongle, a 2500 mAh USB battery pack, a USB cable, some vecro, a zip lock bag, and a waterproof back. The cost for the entire setup is about $50 - about 1/4th or 1/5th of a GW-60 GPS watch. I did wear this while windsurfing, but encountered one little problem: the battery had switched itself off! No test data this time, bummer.

I had noticed a few times before that the battery turned itself off, but was never quite able to figure out when that happens. When it happened before, I thought that I had forgotten to charge the battery, or that the battery was dying - but I was wrong. A little internet search yesterday showed that the "sleep" function is standard for USB battery packs. They are meant to charge phones, which usually happens at 0.5 amps or more. If the current drops below 0.1 A, they decide that the phone is sufficiently charged, and go to sleep. Lazy bastards!

I did a bit more testing with a USB tester today at home, and discovered why the sleep issue was so confusing. Using a variety of USB dongles and hub, I saw that the battery goes to sleep after about 30 seconds if the current is continuously below 0.1 A. It turns out that the Pi Zero uses just about 0.1 A when it's doing nothing. A USB GPS dongle needs about 20-40 mA, so when the dongle is plugged in, the current increases to about 0.13 A. Therefore, the battery always stays on when I test at home.

One of the things that needs current is WiFi. It's usually on when I'm at home, although the script that starts the logging turns if off when a GPS dongle is connected to extend the battery life; that drops the current by about 20-30 mA. When the dongle is pulled and the logging stops, the WiFi is automatically turned back on.

But what happens when WiFi is on, but no network is available (which is usually the case when windsurfing)? It turns out that not being connected to a network has about the same effect as turning WiFi off - the current drops to about 70 mA (with no GPS dongle connected). So that's what happened yesterday! I turned the Pi on before rigging, and connected the dongle about 15 minutes later ... without checking if the battery still was on. But the lazy thing had gone to sleep.

The little test failure just underscores that you can't see much when you're flying blind - the Pi GPS logger needs some kind of display. I've got a little 2.13 in e-paper hat that has exactly the same form factor as the Pi Zero, and got the demo programs to run. Getting it to work with the logger will require a bit of trickery, since there don't see to be any Java drivers for the display. For now, I'll probably go with some primitive form of inter-process communication between the logger and a Python or C program for the display, maybe through a file on a RAM disk. That's the easiest solution that comes to mind, and would make it quite easy to support other kinds of displays, too.