Letterbox Notification Switch

Version 1: WiFi

Having completed my Smart Home Party Button project with a D1 Mini (ESP8266), I found myself wondering what other possibilities these devices had to offer. Following some time browsing the internet in search of ideas, I settled on creating a Smart Home Letterbox device that would send me a notification whenever mail arrived.

I utilized the Home Assistant ESPhome plugin to flash ESPhome onto the D1 mini. Once the D1 mini was flashed with ESPhome, Home Assistant is able to monitor the unit’s status (including detecting when a switch is pressed, and so on).

I installed the D1 mini into a small project box. It’s powered by a 18650 2600mAh Li-ion battery and I used a DC Voltage Regulator Board to step down the voltage to a constant 5VDC. The external cable connects to a microswitch that when activated, signals new mail has been delivered. I removed the wire lever from the microswitch and replaced it with a spring so it could withstand more force from mail going into the letterbox.

I fitted a WiFi antenna that I’d salvaged from an old PC. Yeah, yeah, I get it – the wiring running to the antenna is completely wrong, it really should be shielded and all that, and hooking it up to the built-in antenna is going to throw the tuning way off… I just bodged the whole thing. After chucking it in my letterbox to test it, it was still picking up WiFi signal, so I never bothered going back to sort it out properly.

I mounted the microswitch inside my letterbox with mounting tape. The spring hangs over the mail slot and when letters enter, it activates the microswitch.

Inside Home Assistant I created an automation that would run when the switch is activated. It sends me a push notification to my iPhone via the Home Assistant iOS app saying “You’ve Got Mail”, with an image of the letterbox pulled from my CCTV cameras at the time of activation. It also announces via my Kitchen Google Home Mini, “Mail has been delivered in the mail box”.

I had this running for the next couple of days, capturing and notifying me about a couple posties, and a guy delivering me a parcel whilst inspecting what that “weird switch” was inside my letterbox.

And then it happened – dead battery – this only lasted a couple days max. Having to remove a box from my letterbox, open it up, charge the battery for a couple hours, close it back up, then reinstall in my letterbox is simply something I’m not going to do… ain’t got no time for that.

I played around with the ESPhome config to try and make the D1 mini (ESP8266) sleep and “wake-up” on switch activation (mail arriving) to save on battery life, this did work during my testing. But, by the time the D1 mini started back up, connected back to the WiFi, then told Home Assistant its been activated, the image from my CCTV cameras was too late, therefore missing the mailman…

Time for plan B.

Version 2: ZigBee

Parts Involved

I decided to steer away from WiFi and use something a little more low powered. I already had a couple cheap ZigBee lights controlled by a Zigbee USB dongle, plugged into my Home Assistant Raspberry Pi. I found a cheap wireless smart switch on AliExpress called the Aqara Wireless Switch D1, which runs on a coin battery, it’s super low powered and easily hackable.

I opened up the switch to expose the PCB inside. I opted for the 2 button switch version over the single switch to future proof it – I’m thinking of adding a second button to reset notifications when the mailbox is opened/emptied (I’m yet to implement something like this, but it’s nice to know I could).

Because the battery clipped into the plastic shell that was removed, the battery then had no way of mounting. I soldered a Button Cell Battery Holder over the top of the original contacts and hot glued under it for support. Now the battery can mount/power the board outside of the original shell.

I soldered wires directly to the microswitches legs – Microswitch extension!!

This version also didn’t last very long before running into problems and needed a battery replacement fairly soon after being put into use. I never actually got around to replacing the battery, and as a result it became a long forgotten project that was never fully great to begin with and was ultimately never properly fixed or finished. To make matters worse, eventually the microswitch started to rust and corrode from being left outside and exposed to the elements in all kinds of weather conditions – rain, humidity, and everything in between took their toll on the components.

I think version 3 is going to need some serious rethinking from the ground up. The plan is to incorporate a big, high-capacity battery so it can run for extended periods without intervention, paired with a solar panel so the whole thing becomes self-sustaining and doesn’t rely on me remembering to swap out batteries. On top of that, I want to swap out the mechanical microswitch for an optical sensor – so that there are no moving parts whatsoever. Moving parts are clearly the weak point here, prone to wear, corrosion, and mechanical failure, especially when left outdoors long-term. Removing them entirely should make the whole setup far more robust and reliable. Watch this space, because version 3 is going to be a much more considered and durable build…