Sounds simple, right? Wayne had found himself forgetting to send the necessary emails, and thought the process was a bit tedious when he did remember, which became the impetus for the project. There’s a little bit more to it than just being a button that makes it pretty cool though.
“I used an old 512MB Raspberry Pi Model B that I had bought back in 2013 that I never did much with.” Wayne continues. “Because the project needed internet connectivity and the Model B didn’t have wireless LAN, I added a USB dongle. For a display, I decided to use a cheap 16-character by two-line LCD display instead of an LCD panel, because I only needed to know if the email transmission was successful.”
The code on Raspberry Pi was well thought out as well: “Email was handled by msmtp, a lightweight command-line mail transfer agent,” Wayne explains.
“Since the university used Microsoft Exchange, I used Davmail, an open-source program that acts as a gateway between non-Microsoft mail clients and MS Exchange servers. The push-button interface on the EN/EX Notifier could have been either two SPST momentary switches, one for entry and one for exit, or a single momentary on-off-momentary on SPDT rocker switch. I decided to go with the rocker switch, and connected it to Raspberry Pi’s GPIO pins. When the entry or exit button is pressed, it triggers the appropriate bash script to send an email, and displays a message on the LCD display to tell me if it was successful or not.”
Wayne had thought about automating the system by using the room’s light switch. However, with other people occasionally going in and out, he found it better to just make it a dedicated switch.
Exit, stage right
While Wayne will soon not need to use it, he definitely was able to get some use out of it:
“It functions fairly well. The main issue is that the wireless LAN connection is sometimes unreliable, so it doesn’t send a message when I push the button, but that is mostly due to my office being far away from the nearest router. I’ve had connection problems with other computers, so it’s not caused specifically by Raspberry Pi. I could probably improve the reception by using an adapter with an external antenna, or by using a wired Ethernet connection instead.”