Moving The Snail Mail To WiFi

[Zak] loves getting a notification on his phone when he gets physical mail. Enough to wire his mailbox slot with an ESP8285 to send him alerts. Previously, [Zak] used a cellular-based solution as the mailbox slot was not within WiFi range. However, the network provider for the A9G GPRS module decided to move to different towers, and suddenly the module didn’t work. Unable to find a provider that had sensible pricing, he got to work redesigning the module.

The mailbox was now in a WiFi network range, meaning he no longer had to use cellular. This dramatically simplifies the design and uses an ESP-M2 module (think ESP8266 but with embedded flash). To maximize battery life, the ESP is entirely off most of the time. A reed switch triggers a 74LVC1G98 NAND gate with an inverted input. This enables the 3.3 voltage regulator. A 4uF capacitor holds the voltage regulator on for 716ms, giving the ESP8266 time to boot and drive the second pin of the logic gate so it can stay on. Once the web request completes (a call to a PHP server that takes 4-5 seconds, including WiFi association), it pulls the pin low, and the system powers off. With a custom server, [Zak] can include a few goodies, such as temperature and humidity from the SHT32-DIS sensor.

So far, the system has been chugging along for seven months and over 110 mail notifications and has only dropped 0.3v, suggesting that the battery should hold out for another year or two before recharging. The code and schematics are up on GitHub. We love the low-power focus and the handy circuit explanation that makes it easy to use in other projects.

22 thoughts on “Moving The Snail Mail To WiFi

  1. Could have saved more power by dropping the 74LVC1G98, using the switch to trigger the regulator through a resistor, and then a fet contrled by the micro to keep it on, and turn it off.

    1. And on the software / network side, I reckon the time it spends on the wi-fi connection could be greatly reduced by switching this from a “push” notification (actively connect to a wi-fi AP, make HTTP connection) to a “pull” – have a wireless receiver in range which *listens* for 802.11 frames broadcasted by the ESP – like, get it to do beacon frames. Powered on and announcing its presence, another computer within earshot just needs its wireless adapter put into monitor mode and then a tool like airodump-ng just needs to be detect wireless packets with the ESP’s source MAC and then run a shell script or whatever to do the actual notification. No actual connection between ESP and AP needs to be made in that case, so the seconds awake could become milliseconds.

      Or, if it’s super important that the “you’ve got mail” messages are encrypted and can’t be spoofed, go as far as completing the wi-fi connection, but don’t bother going up the stack – no waiting for a DHCP IP or using DNS to lookup addresses or opening a TCP connection to a HTTP server. Just have the listening thing trigger mail notification when it detects the ESP complete the connection handshake with the router.

      That stuff is much easier to do if you have an AP with open firmware (ie openwrt) since then you can make the access point the thing listening for radio comms coming from your mailbox.

      Okay, might sound a bit complicated, but I reckon for something which ideally has a battery that lasts for years per charge, going lower in the network protocol layers could make an appreciable difference if it means the radio can be on for much less time.

  2. To save a bit more on battery life. Could have dropped the 74LVC1G98, and used the switch to trigger the regulator, then a fet controlled by the micro to keep it on.

  3. This reminds me of when I set up a wifi doorbell and used a battery to power it, and ultimately got frustrated of changing the batteries all the time and drilled through the wall to get power from the wall outlet.

    Batteries are good as UPS. I don’t like to use them as my primary power source.

  4. I truly do not see the point of this. As was pointed out the last time you featured this guy’s work, you can sign up for free to have the post office (at least in the U.S.) send you a picture of whatever it is they are delivering that day. It works fine, and you actually get to see the item so you can decide how quickly you might want to retrieve it.

    1. The person doing this is from the UK (in their blog post about the original version, they mentioned “Royal Mail” – the postal service in the UK)

      Their GitHub profile also specifies that they are located in the UK.

      The postal service here (in the UK, where I also live) is falling apart nowadays – it is impressive if we even get mail on a regular basis. I seriously doubt that it would be possible to ask Royal Mail to do this.

      Also, there is no law against hand-delivering letters and other objects to other peoples mailboxes, unlike in the US (its called tampering with federal mail or something iirc) – having a mailbox sensor covers deliveries from other sources as well.

  5. Is there conformal coating or similar on the board? I can’t imagine something like that board working outdoors for too long without any weather protection
    I made a motion detector for the yard and it worked for a grand total of 3 days. The dew was enough to short the perfboard connections and drain the 2Ahr cell

    That day I learned dipping circuit boards in a can of wood varnish works as a surprisingly good method to do humidity protection. Its messy and takes a bit of time to dry but its almost as good as encapsulation

  6. This is one of the applications where the rather high power consumption of the ESP is not a problem because it needs to run very rarely. With less than 100mA of running consumption you can get 10-20 hours from a pair of AA, which means years of mail notifications.

  7. If I did this, here’s how it would go: The mail carrier drops off some mail and I get a “You’ve got mail” notification. A little later the Amazon delivery driver puts a package in my box and I get another “You’ve got mail notification.” I go check the mail, I open the box and now I get a third “You’ve got mail” notification. My wife comes home, she’s seen three “You’ve got mail” notifications and doesn’t know whether we got mail and I already retrieved it or if we got mail and later got some packages, so she checks it again, I get another “You’ve got mail” notification. Later on I need to mail a letter myself, I open the box and get another “You’ve got mail” notification.

    1. This may be true with your mailbox, but not with Zak’s.

      However, if you look at the picture shown in the article, you will notice it is a letter flap, as commonly used in the UK (if you read the first blog post that the creator of this device wrote, it is confirmed that they are indeed in the UK, where Royal Mail is the national postal service). These are normally mounted on or beside a door/garden gate.

      There are two typical configurations for these. If the non-street-facing side is in an indoor area, there is often nothing behind it (except maybe a secondary flap to help block draughts) and whatever is inserted through it will land on the floor, where it can be picked up, with no need to open the flap again, so the sensor does not trigger. If the non-street-facing side is outdoors (for example, if the letter flap is on a garden gate) there is typically a letter box mounted behind it to catch any letters and protect them from the generous precipitation common in Britain. There is a large door on the letterbox that the recipient can open to retrieve their post. The second configuration is also used in some apartment buildings, where there are many letter boxes in a central location (one for each apartment), as seen in Zak’s original blog post. In this case, the only difference is that the large access door is always locked and is on the same side as the letter flap, however it remains a separate point of access.

      Trying to retrieve the letters through the letter flap is generally not practiced due to the inconvenience (the flap is spring-loaded, and too narrow for most hands to fit through). Therefore, the detector would not be triggered when you go to get your post.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.