Before I go reinventing someone elses wheel....


M M
 

Does anybody have something like the below already operational?
or even close?
We have a few repeaters at hilltop sites...  each site has internet,
and around 400 AH of 12 volt battery.   Each site as internet brought
in via an Ubiquity 5 gig microwave shot.  The Ubiquity and the router
are run off the 12 volt battery.

And occasionally a site loses AC power.

We'd like to set up a Pi (connected to the router via an ethernet
cable) to run off the battery bank and use a 5 volt wall wart to
function as the local AC power sensor.  Or maybe the wall wart
drives a relay coil and the relay contacts are used to tell the
Pi that the AC power has failed.

On a power fail we'd like the Pi to send an email message to a list
of addresses (probably 8 to 10 addresses)...   Something like
"AC power has failed at (site name) at (local time) on
(day of week) (date)"...
i.e. "AC power has failed at Mike's house at 14:30 on Sunday
October 31 2021".

Then when AC power returns it goes through it's cold boot cycle
and then sends an email (to the same list)... something like
"AC power has returned at (site name) at (local time) on
(day of week) (date)".

And every so often (settable) it sends a status message to a
separate list of email addresses... something like "(site name)
AC power monitor is on line, the last power fail was at (time)
on (day of week) (date), last power return was at (time) on
(day of week) (date)".  Initially the status email will probably
be daily at noon, but once the folks are comfortable that
the unit is reliable the status messages will probably be
backed off to weekly.

Note that when the Pi cold boots it has to note the time,
day and date from it's RTC board, then it needs to wait a
minute or so (to allow the microwave internet link to
re-establish), then pings the us.ntp.org server to verify
the link is actually up (and BTW to verify the actual time
and date).

Comments, suggestions, etc are welcome.

I don't mind buying a commercial product as
long as there isn't a  monthly charge and it's
a stand-alone device (i.e. not cloud based).

Thanks in advance

Mike WA6ILQ   (callsign //at// gmail //dot// com)



Mark Griffith
 

Hi,

While you can easily monitor the power, the email thing becomes complicated.

Software to send an email exists for the Pi and depending upon which software you use, can be difficult or less difficult to set up.  The problem is in getting to an email hosting site over the Internet.  The email software on the Pi needs to be setup with a ""host" defined, which is an email server on the Internet that agrees to accept and process your email.  Getting that part done is not simple and there are all sorts of blocks put in the way to prevent little email systems from doing this to hold down the email spam that exists.

I have done this myself for several corporations (before I retired) and it's a royal pain in the kiester.

However, I have setup a system where I use a PiGate RMS device to do this by using the Winlink system has the email host.  This assumes you have a Winlink account, which is free.

In this system, you could have the PiGate RMS monitor a couple pins on the GPIO that are connected to a 120V relay.  When the power goes out the pins are shorted and the power outage detected.  Then you wait some time and keep checking the pins to see if they remain shorted.  This prevents sending an email on just a power blip.  Then the software composes and sends and email through the Internet to your email address, as long as it is not your Winlink address.

You could probably do something similar using a regular PiGate to send the email over a VHF radio connection to a Winlink RMS station.  Or perhaps use PAT.

Once you get over the email thing, it's pretty simple.

I have a commercial device at my shack which is 16 miles away from my home.  It monitors power, temperature, and for flooding, but it uses a landline to make a call to my cell phone.  It was not expensive.  There are, I believe, commercial power monitors that will use the Internet, but they work by updating a host site which then sends email to you.  This is not very cheap.

Some food for thought.

Mark
KD0QYN

On Mon, Nov 1, 2021, 3:40 AM M M <wa6ilq@...> wrote:

Does anybody have something like the below already operational?
or even close?
We have a few repeaters at hilltop sites...  each site has internet,
and around 400 AH of 12 volt battery.   Each site as internet brought
in via an Ubiquity 5 gig microwave shot.  The Ubiquity and the router
are run off the 12 volt battery.

And occasionally a site loses AC power.

We'd like to set up a Pi (connected to the router via an ethernet
cable) to run off the battery bank and use a 5 volt wall wart to
function as the local AC power sensor.  Or maybe the wall wart
drives a relay coil and the relay contacts are used to tell the
Pi that the AC power has failed.

On a power fail we'd like the Pi to send an email message to a list
of addresses (probably 8 to 10 addresses)...   Something like
"AC power has failed at (site name) at (local time) on
(day of week) (date)"...
i.e. "AC power has failed at Mike's house at 14:30 on Sunday
October 31 2021".

Then when AC power returns it goes through it's cold boot cycle
and then sends an email (to the same list)... something like
"AC power has returned at (site name) at (local time) on
(day of week) (date)".

And every so often (settable) it sends a status message to a
separate list of email addresses... something like "(site name)
AC power monitor is on line, the last power fail was at (time)
on (day of week) (date), last power return was at (time) on
(day of week) (date)".  Initially the status email will probably
be daily at noon, but once the folks are comfortable that
the unit is reliable the status messages will probably be
backed off to weekly.

Note that when the Pi cold boots it has to note the time,
day and date from it's RTC board, then it needs to wait a
minute or so (to allow the microwave internet link to
re-establish), then pings the us.ntp.org server to verify
the link is actually up (and BTW to verify the actual time
and date).

Comments, suggestions, etc are welcome.

I don't mind buying a commercial product as
long as there isn't a  monthly charge and it's
a stand-alone device (i.e. not cloud based).

Thanks in advance

Mike WA6ILQ   (callsign //at// gmail //dot// com)



Bill Buhler
 

Hi,

I've lashed together things like this in the past as one off shell scripts.

For the email side I suggest smtp-cli running on a raspberry pi, there is a walk through at http://www.logix.cz/michal/devel/smtp-cli/ . It supports smtp authentication, which will let you use a modern mail service like Gmail, outlook.com, etc to be the sending mailbox. For ease I would just build one service email address on one of the free services and then use the subject line to specify the site the message originated from. 

You could write a script that checks the gpio pin status controlled by your relay / wall wart every minute or two and based on that sends a message for either power up or down. With another script that triggers at boot time to announce it has booted and the ac mains state.

Finally cron can be set to send a watchdog email x times a day with the system uptime listed for comfort that everything is working as planned.

Best of luck!

73 - Bill Buhler AF7SJ 






-------- Original message --------
From: M M <wa6ilq@...>
Date: 11/1/21 2:40 AM (GMT-07:00)
To: RaspberryPi-4-HamRadio@groups.io
Subject: [RaspberryPi-4-HamRadio] Before I go reinventing someone elses wheel....

Does anybody have something like the below already operational?
or even close?
We have a few repeaters at hilltop sites...  each site has internet,
and around 400 AH of 12 volt battery.   Each site as internet brought
in via an Ubiquity 5 gig microwave shot.  The Ubiquity and the router
are run off the 12 volt battery.

And occasionally a site loses AC power.

We'd like to set up a Pi (connected to the router via an ethernet
cable) to run off the battery bank and use a 5 volt wall wart to
function as the local AC power sensor.  Or maybe the wall wart
drives a relay coil and the relay contacts are used to tell the
Pi that the AC power has failed.

On a power fail we'd like the Pi to send an email message to a list
of addresses (probably 8 to 10 addresses)...   Something like
"AC power has failed at (site name) at (local time) on
(day of week) (date)"...
i.e. "AC power has failed at Mike's house at 14:30 on Sunday
October 31 2021".

Then when AC power returns it goes through it's cold boot cycle
and then sends an email (to the same list)... something like
"AC power has returned at (site name) at (local time) on
(day of week) (date)".

And every so often (settable) it sends a status message to a
separate list of email addresses... something like "(site name)
AC power monitor is on line, the last power fail was at (time)
on (day of week) (date), last power return was at (time) on
(day of week) (date)".  Initially the status email will probably
be daily at noon, but once the folks are comfortable that
the unit is reliable the status messages will probably be
backed off to weekly.

Note that when the Pi cold boots it has to note the time,
day and date from it's RTC board, then it needs to wait a
minute or so (to allow the microwave internet link to
re-establish), then pings the us.ntp.org server to verify
the link is actually up (and BTW to verify the actual time
and date).

Comments, suggestions, etc are welcome.

I don't mind buying a commercial product as
long as there isn't a  monthly charge and it's
a stand-alone device (i.e. not cloud based).

Thanks in advance

Mike WA6ILQ   (callsign //at// gmail //dot// com)



Basil Gunn
 

Mike,

I've done something similar with detecting when my well pump comes on.
The email part was pretty straight forward because Linux has a number of
command line email clients.

I used:
mutt - email client
postfix - email server
paclink-unix - winlink support

For the AC detection circuit I used a Linrose B2150A3 Amber Neon Pilot light as
an Opto-isolated AC Voltage Sensor. Some links below for reference:

* [[https://forum.arduino.cc/index.php?topic=403547.0 | How to detect AC voltage (not measuring)]]
* [[https://www.hackster.io/porrey/vacsensor-0fe427 | Opto-Isolated AC Voltage Sensor]] - Daniel Porrey
* [[https://www.amazon.com/Linrose-B2150A3-Amber-105-125VAC-Pilot/dp/B008JFSOQU/ref=sr_1_3?ie=UTF8&qid=1439643695&sr=8-3&keywords=Linrose+pilot+light | Linrose B2150A3 Amber 105-125VAC Neon Pilot Light]]

I would run the RPi from 12 Volts using some buck regulator.

/Basil n7nix


Jeremy Edwards
 

Spitballing an idea....

I wonder if you might consider setting up a HTML page with live system info on the PI...

...and then use a free monitoring tool like uptime robot to get your emails:



Jeremy Edwards

"To acquire knowledge, one must study; but to acquire wisdom, one must observe."


On Mon, Nov 1, 2021 at 8:05 AM Basil Gunn <basil@...> wrote:

Mike,

I've done something similar with detecting when my well pump comes on.
The email part was pretty straight forward because Linux has a number of
command line email clients.

I used:
  mutt - email client
  postfix - email server
  paclink-unix - winlink support

For the AC detection circuit I used a Linrose B2150A3 Amber Neon Pilot light as
an Opto-isolated AC Voltage Sensor. Some links below for reference:

* [[https://forum.arduino.cc/index.php?topic=403547.0 | How to detect AC voltage (not measuring)]]
* [[https://www.hackster.io/porrey/vacsensor-0fe427 | Opto-Isolated AC Voltage Sensor]] - Daniel Porrey
* [[https://www.amazon.com/Linrose-B2150A3-Amber-105-125VAC-Pilot/dp/B008JFSOQU/ref=sr_1_3?ie=UTF8&qid=1439643695&sr=8-3&keywords=Linrose+pilot+light | Linrose B2150A3 Amber 105-125VAC Neon Pilot Light]]

I would run the RPi from 12 Volts using some buck regulator.

/Basil n7nix






Jeremy Edwards
 

Curious how this topic progressed have any solutions been tried that I could learn from? 


Jeremy Edwards

"To acquire knowledge, one must study; but to acquire wisdom, one must observe."

On Tue, Nov 2, 2021, 7:13 AM Jeremy Edwards via groups.io <mini338=gmail.com@groups.io> wrote:
Spitballing an idea....

I wonder if you might consider setting up a HTML page with live system info on the PI...

...and then use a free monitoring tool like uptime robot to get your emails:



Jeremy Edwards

"To acquire knowledge, one must study; but to acquire wisdom, one must observe."


On Mon, Nov 1, 2021 at 8:05 AM Basil Gunn <basil@...> wrote:

Mike,

I've done something similar with detecting when my well pump comes on.
The email part was pretty straight forward because Linux has a number of
command line email clients.

I used:
  mutt - email client
  postfix - email server
  paclink-unix - winlink support

For the AC detection circuit I used a Linrose B2150A3 Amber Neon Pilot light as
an Opto-isolated AC Voltage Sensor. Some links below for reference:

* [[https://forum.arduino.cc/index.php?topic=403547.0 | How to detect AC voltage (not measuring)]]
* [[https://www.hackster.io/porrey/vacsensor-0fe427 | Opto-Isolated AC Voltage Sensor]] - Daniel Porrey
* [[https://www.amazon.com/Linrose-B2150A3-Amber-105-125VAC-Pilot/dp/B008JFSOQU/ref=sr_1_3?ie=UTF8&qid=1439643695&sr=8-3&keywords=Linrose+pilot+light | Linrose B2150A3 Amber 105-125VAC Neon Pilot Light]]

I would run the RPi from 12 Volts using some buck regulator.

/Basil n7nix






M M
 

I'm the original poster....   In reply to your question....

First, I was mistaken on a couple of the details...

We have nine sites. And adding two more by April of 2022.
Each site has internet either provided by the site owner, or we brought it in via an Ubiquity 5 gig microwave shot.  The Ubiquity, the Cisco router, the laptop power brick, and a few other items are run off a 600w APC UPS that has no internal battery but is connected to the 12 volt site battery (400 amp-hour) which has it's own Samlex charger.

We plan on running a Pi off of a buck converter off of the site battery. The Pi will be connected to the router via an ethernet cable (preferred) or wireless - each site has an old residential Dlink, Linksys or some other brand only for wifi-cellphone use while we are on site.   (when you can pick them up for $5 each at thrift stores, why not?)

We will use a wall wart feeding a DC relay as the local AC power sensor... dry contacts grounding a GPIO pin.  When the Pi sees the power go away it starts
a routine that checks every minute for 5-10 minutes to see if it's a momentary or a "hard" outage (could be as short as 10 min, could be a week... a few years ago one forest fire burned out the power lines to one site and the site was on generator for a month.    Someone had do a round trip of 30 miles of highway plus 15 miles of 4x4 roads every other day for 51 days with ten 5-gallon jerry cans of gasoline on each trip.

On a power fail the Pi will to send an email message to a list of addresses (probably 8 to 10 addresses)...   
The email will contain the site name, the local time, date, day of week, system uptime, and any other Pi-connected sensor info... Inside temp, outside temp, humidity, etc.

On a power return, it depends on if the duration exhausted the battery (which is primarily there for the repeaters). Each site has a low voltage disconnect circuit to prevent killing the batteries with overdischarge...

If the Pi is still running (i.e. the disconnect didn't activate) then the system will send a "power is restored" email similar to the above.

If the disconnect did activate and the Pi has to reboot then it will note the parameters for the restoral email (time, day and date, etc from it's RTC board), then wait until the microwave internet link re-establishes (i.e. wait until it actually can send the email).

Once the link is up it pings the us.ntp.org server to verify the link is actually up (and BTW to verify the actual time and date).  Then it sends the email, with a note as to the time of the actual power return.

And a cron job will send the periodic status message that I mentioned in the original posting.

Again, I don't mind buying something, even ham built, as long as there isn't a  monthly charge and it's a stand-alone device (i.e. not cloud based).

One person pointed me to this:   https://www.amazon.com/gp/product/B089QQNKJL

It's financially attractive, and the fact that is has three AAA cells inside to make 4.5 volts to power it while the power is off can be worked around... The three cells could die and leak... we've not been to some of the sites in years.

The workaround is two pieces of wooden dowel the diameter of a AAA cell, with a brass thumbtack pressed into one end and a wire soldered to the thumbtack. You can get 4.5 volts from a buck regulator off the site battery.

The biggest issue with that device is that there is a company monitoring it and actually sending the emails, and cloud companies have a habit of evaporating.

Since I posted the original message we've been focused on other things... we had to move 3 systems from one building to another at one mountaintop, we had to replace 4 antennas at another mountaintop, and the Thanksgiving holiday happened (my wife decided that we were going to do a Thanksgiving trip to another state... I drove  600+ miles / about 12 hours each way and we spent a week visiting family).

I'm probably going to be building up something using a Pi ver 2, a metal case (https://www.amazon.com/Flirc-Raspberry-Pi-Zero-Case/dp/B08837L144),
and using the ideas presented in the previous postings.

Again - comments, suggestions, pointers to products - even a 1-man ham company in a garage - are welcome.

Mike WA6ILQ   (callsign //at// gmail //dot// com)