At work, I serve on a team that has an on call rotation. As a heavy sleeper, SMS dispatches to my cellphone are not enough to get me out of bed. I needed a better solution, but what was that going to look like? I have an iPhone X and it’s just not loud enough to wake me, and having the notifications be persistent until acknowledged was a real necessity. I needed something that would almost slap me in the face to get me out of bed for a 3am dispatch. No joke! There just aren’t a lot of solutions out there to literally kick someone out of bed at 3am (heavy sleepers) and I certainly wanted to keep my manager happy by answering pages in a timely manner. Time to build a solution!
Luckily, I have skills in the wireless dark arts as a Ham Radio operator and I knew there was a way to use the free Pi-Star software to make a pocsag pager transmitter. I bought a programmable pager online that would work on the frequency of 439.9875MHz and proceeded to build the transmitter and attach it to my network.
- latest pi-star image on microsd card and configured on the network
- Any USB wifi G or N dongle (the onboard wifi chip on the RPi Zero W sucks)
- OTG to USB adaptor pigtail for wifi dongle
- 15″ SMA whip antenna – the little stubby antennas really suck!
- MMDVM Hotpost board kit (this has the radio and RPi Zero)
- Programmable POCSAG pager that will work on 439.9875MHz (Digital Paging Company in North Hollywood CA Be sure to ask for SKU: R924-430-6V33
- Gmail account to pull the messages of interest from to create page messages and triggers
- Linux box (or VM) with fetchmail configured to pull and parse mail from the gmail account
- I had to write some code to make it all work
- OPTIONAL: an MQTT broker to send actions to home automation such as Domoticz, Hass, etc (in my case, I have a bright light on my night stand that shines in my face that gets turned on to help wake me up)
Setting Up Pi-star
Download pi-star and write the image to the microsd card. Configure pi-star by disabling the built-in wifi chip (in favor of the USB dongle) and set up pi-star to connect to your network. (see pi-star site for more info). Once connected to your network, you should give it a static IP address so your script will always be able to reach it and dispatch messages to it. To do so, you can use the DHCP IP reservation function on your router or edit /etc/dhcpcd.conf to add the static IP by adding something like the following to the end of the file: (change to what’s appropriate for your environment)
NOTE: you need to make sure the / partition is writeable before you edit this file (by default it is not) by running “rpi-rw” and when you’re done, run “rpi-ro” to make the / partion read-only again. Keeping the / partition read only will help protect your sd card from wear.
Next, you must setup pi-star and turn on POCSAG mode and be sure the frequency is set to 439.9875MHz (this process is documented on the pi-star website/wifi – so I won’t go into that here). Once you have pi-star setup in pocsag mode and on the correct frequency, it’s time to program your pager (see pager documentation) and program in the frequency and a CAP code so your pager will respond to page transmissions. With your pager programmed correctly, and pi-star properly configured, you are now ready to install the scripts and set the oncallConnector.sh script up in a crontab. (this assumes you have already configured fetchmail to pull down mail messages from the gmail account you will use to receive on call dispatches). Refer to fetchmail documentation on how to setup IMAP or POP access to gmail.
I call fetchmail and oncallConnection.sh in crontab every minute:
* * * * * /usr/bin/fetchmail &> /dev/null
* * * * * /home/john/oncallConnection.sh &>/dev/null
NOTE: please see the comments within the scripts for info on what needs to be setup (variables) for the script to process your mail.