I’m building an enhanced version of the Cellular-Enabled Power Outage Detector (Cellular-Enabled Power Outage Detector w/ SMS Notifications - Hackster.io) for monitoring houses in the winter when you are away.
The current hardware design uses a Notecarrier-F, ESP32 Feather, a temp/humidity sensor, battery% sensor, OLED screen and monitors the USB state (power from wall) through a digital input on the Feather.
I’m using the “Sleepy Sensor Application” Arduino sketch (Arduino Low power (with deep sleep) sample code for Notecard - #4 by zfields) to wake up the Feather every 30 minutes, take the 4 sensor readings (temp, humidity, battery% and power (0 or 1). This is sent to the Notehub through sensors.qo and then routed to Adafruit.io to view the dashboard and to send SMS alerts.
The all works great except if the power goes out, it takes 30 minutes for the device to wake up and transmit this info to Notehub and onto SMS. I want the notification of a power outage to be fast.
Enter AUX GPIO mode to the rescue. I have connected F_USB to AUX1 on the Notecarrier. I want to configure this in a similar way to the “Cellular-Enabled Power Outage Detector” mentioned above by setting the following on the Notecarrier:
{
“req”:“card.aux”,
“mode”:“gpio”,
“usage”:[
“input-pulldown”,
“off”,
“off”,
“off”
],
“sync”:true,
“file”:“power-outage.qo”
}
How do I add this AUX GPIO function to my device? Do I just run the above commands to the Notecarrier one time through a serial connection or add the info the the Arduino sketch such as in Problems “Setting GPIO mode with Notefile” from Feather ESP32
How and where do I integrate the power state in the notefile power-outage.qo with current one in sensors.qo? Do I just set up another route in Notehub to send the power state in power-outage.qo to the same feed at Adafruit.io as the power state in sensors.qo and let it just get updated only when there is a change?
Do I need to change my Arduino code and remove the power object from sensors.qo? If I do this I’m not sure the intial power value will be send to Adafruit, just a change. It will also run every time the Feather reboots every 30 minutes.