Back in November I wrote about "Boat Alarm", a free service I'd developed for monitoring your boat. The original Boat Alarm client ran on an Arduino Uno R3 microprocessor with a CC3000 WiFi shield. Unfortunately the CC3000 proved to be unreliable, and I no longer recommend that WiFi hardware. I've switched to using the Adafruit HUZZAH ESP8266 for the client hardware (shown above). This microprocessor is Arduino-compatible and also has built-in support for WiFi. It has the added benefit of being very inexpensive. You can learn more about the Adafruit HUZZAH ESP8266 here.
Note: Pay attention to input voltages. Except for RX/TX, the ESP8266 only works with 3.3V and pins are not 5V tolerant. If using a USB adapter for monitoring shore power, step down the 5V output with a 5:3 voltage divider. Alternatively just use a 3.3V DC power supply.
The new client monitors shore power on digital pin 2, but you can modify the source code to monitor something else, or use another pin if you prefer. Shore power is monitored by means of sensing the output of a USB adapter plugged into your vessel's mains power (stepped down to 3.3V or less). As before, an analog pin is required to measure the battery voltage. The range of ESP8266's analog to digital converter (ADC) is only 1.0V, so you need to step down the battery voltage with a voltage divider. I combined the battery power supply with the voltage divider as shown below. The red wire supplies VBat and the yellow wire supplies Vbat/16.
The client software is configured via the Alarm array. Alarm fields in order are:
- alarm name
- alarm pin
- report value (true to report value, false not to report)
- expected value (if digital, otherwise ignored)
- low threshold (if analog)
- high threshold (if analog)
- scale (if analog)
The default configuration is as follows:
{ "Power:ShorePowerLoss", "D2", false, HIGH },
{ "Power:BatteryVoltageLow", "A0", true, 12600, 12000, INT_MAX, 16.0 }
};
The second alarm senses battery voltage on analog port 0 (A0) where the normal range is above 12V (i.e., 12000mV), using a 16:1 voltage divider to scale the input voltage.
As for testing, the new version has been running on Arriba for over a week and has already detected one power outage. There is also a test device, which logs its output here.
The web service is pretty much the same as before, except when registering you can now specify your country and timezone. There is also now a way to view recent alarms, accessible from the update page.
The web service is pretty much the same as before, except when registering you can now specify your country and timezone. There is also now a way to view recent alarms, accessible from the update page.
OVER.
Comments
Post a Comment