The postal service in the United States and many other countries is very impressive. For an amount of money that is trivial to most people, you can send a letter to a recipient anywhere in the country and it will reach their mailbox in mere days. But as amazing as that is, the postal service isn’t always perfect. Some days they may deliver your mail at a later time than on other days. That means you might open up your mailbox just to find it empty. To avoid that situation, fmarzocca has built a wireless mailbox monitoring system, dubbed "Postino," and they have put together a tutorial explaining how you can, too.
This system was actually built for a friend of fmarzocca whose mailbox isn’t in a particularly convenient location. The friend asked fmarzocca if there were any IoT gadgets on the market that could help him monitor his mailbox. There weren’t any that fit the bill, but fmarzocca figured it would be possible to make one. The main requirements for this system were that it be able to run off of battery for an extended period of time, that it could communicate wirelessly, and that it be capable of checking for mail just once a day — constantly checking for mail day and night would needlessly drain the battery.
An Espressif ESP8266 WiFi microcontroller module is used as the brains of the operation. It can wake up at intervals defined by a separate DS3231 Real-Time Clock (RTC), and remain dormant the rest of the time. The RTC’s EEPROM chip was removed to reduce its power consumption. When it does wake up the ESP8266, the microcontroller checks a VL6108 Time-of-Flight sensor to see if any mail is present. The time-of-flight sensor can measure the time it takes for light to reach an object and then be reflected back, which tells the ESP8266 if the light hits mail before the mailbox door. It then updates the status on a REST (REpresentational State Transfer) server. Power is provided by a 3V CR123, which should last quite a while in a low power consumption device like this.