Tech: NetSender, boat monitoring and beyond

Winter for me means less sailing but more electronics and coding. I decided it was time to revamp Boat Alarm, a free service for monitoring a boat's critical signals. I started development almost 2 years ago and it has proven extremely handy being able to monitor my boat's shore power status and battery voltage remotely. One downside however is that the Arduino client needs to be reprogrammed in order to do new tasks. I therefore decided to write a general-purpose client that is entirely reconfigurable via the web.

The new client is called NetSender and, like its predecessor, it runs on an ESP8266 WiFi-enabled microcontroller. I'm using the Adafruit HUZZAH ESP8266 Breakout (top photo) which is great value at US$10. The new service is called NetReceiver and, like its predecessor, it is built on Google Cloud Platform App Engine. It is considerably more powerful since all actions are defined via settings configured from a web page. Below is a screenshot of Arriba's settings:

There's a lot here so let's go through it. First, is the list of devices. These are the ESP8266 microcontrollers running NetSender which are located onboard and tasked with doing work. Arriba currently has just one device, Arriba1.  

Second, is the list of sensors, which measure physical properties such a voltage. Arriba has two, one for DC battery voltage measured on A0 and another for AC shore voltage measured on D12. The battery voltage is stepped down via a 16:1 voltage divider, and since an ESP8266 analog port value of 1023 corresponds to 1V, sensor values need to be scaled by 0.016. Shore power is either on (240V) or off (0V), and since a digital port is either 1 or 0, the scale is 240.

Third, is the list of actuators, which are secondary devices attached to a microcontroller pin which perform a physical action. In other applications I use NetSender to control relays, but on Arriba I'm simply turning a green LED on and off, based on the value of an Alarm variable.

Finally, there is the list of triggers, which are actions that get taken when various sensor conditions occur. This is where it gets interesting. Triggers can have preconditions which must be true before a trigger will fire. For example, the first trigger, ShorePowerRestored, sends an email when the shore power is 240V, but only if Alarm is "on." The ResetShorePowerAlarm sets the Alarm "off", in effect ensuring that the ShorePowerRestored notification email only goes out once. The BatteryVoltageLow and ShowerPowerOff triggers have no preconditions and send emails for as long as their respective sensor conditions occur (subject to a minimum notification period).

It is also possible to set up time-based actions (not shown) called crons - short for cron jobs. I use these at home to control irrigation solenoids.

I'll be writing more about NetSender/NetReceiver which is still under development. In the meantime, take a look at the source code here and the service which is running at