Some recommendations: Always use sockets for the microcontroller. Then if something goes wrong, you can easily unplug it. Likewise, if you choose to use boards like the author, only solder the pins you're using. Then it's easier to unsolder if needed. Great video BTW. I'm thinking of doing the same type of project, with the addition of a solar cell to keep the LIPO charged. I'm also going to add IR LEDs and IR receiver to actually see if something is in the mailbox.
Thanks for the tips. I do use headers or 'sockets' for some projects, but that's normally during the development phase when I'm writing and flashing my own code and there is a high probability of me bricking something. However, when ready to roll into 'production, I like to make my controller units as small as possible and place in a 3D printed enclosure. The sockets just add additional height that I don't need. Plus there is the possibility (although remote) of the board working loose from the socket... especially in a situation where exposed to vibration. Honestly, for the small cost of the controller and components, it's hard to beat soldered connections for reliability. If something does go wrong down the road, I just rebuild it. But I do appreciate you sharing other alternative ideas. A removeable controller is definitely needed in situations where you can't flash updates over-the-air and have to flash via USB. Good luck with your mailbox project. I think solar would solve the problem I had with battery life, but I've since switched over to using Zigbee and a Zigbee sensor, which provides 10x the battery life over the wifi version.
Oh my... what a build! Good job. I recently bought a $10 wireless door bell that has a 1100 foot range from Amazon. I soldered a magnetic reed switch, also from Amazon, (like on the windows/doors of a security system), screwed the switch on the mail box and plugged the door bell into a wall socket. Works perfectly for less than $25 and 20 minutes to install.
Yeah... tends to be a bit more complicated that it needed to be... but that's par for the course for most of my projects! I have since upgraded the original sensor and control box with a Zigbee reed switch. It took a couple of tries to get the right sensor (metal mailbox really kills the signal) and I needed to add a repeater/router to the outlet on the front porch, but it has been working flawlessly for six months.. all on a single battery and with no wires inside (or outside) the mailbox. But the doorbell idea is a really good one! Thanks for watching and taking time to leave a comment... and sharing another great option for a mailbox sensor.
Top tip from my recent work building a very low quiescent current RF beacon; put a generic optoisolator between the battery positive rail and the resistor for the resistive divider. You can then use a GPIO pin to turn on the divider via the optocoupler LED. The added series resistance is negligable, you can always tweak the derived voltage in the code.
Thanks for a great idea! I published a video a few weeks ago where I ran a very un-scientific study of two different designs to try to improve my battery life. I am NOT an electrical engineer (just a wannabe hobbyist) but the main take-away was that the ESP32 dev boards continue to draw power even when the ESP32 chip itself goes into deep sleep. Likely the UART chip and/or the power regulator. The voltage divider probably isn't having a big impact in this case as compared to the draw from the "sleeping" ESP dev board. I've actually switched over to using a Zigbee door sensor since I did this video. Great battery life, but it has it's own challenges with signal strength inside a metal mailbox! Thanks again for the great suggestion. I love how much I'm able to learn from the people that watch my videos and provide ideas on how to make something better.
I use a Ring doorbell that I absolutely hated, chucked the POS in the mailbox! it works well enough... but I like your idea and will do this when the ring finally rings its last bell.
I should state that while the wifi version worked well, I did get tired of the short battery life due to the hungry nature of Wifi. I have since replaced the original system with a Zigbee sensor. I didn't have a Zigbee network when I built the original wifi system. But the Zigbee sensor gives me 6-9 months of battery (shorter in the winter) vs. the 4-6 weeks with the wifi version. But other than the battery life, the wifi version worked very well and reliably.
Thanks. I wish I could take more credit that I deserve for the display. But this secret is in the custom button card available via HACS: github.com/custom-cards/button-card This custom button can do amazing things and I use it throughout my various Lovelace pages. I'd be happy to cover my Lovelace displays in a future video... or I'm considering trying my first live stream soon, where I could talk about it and do some Q&A of my various projects as well. Thanks for taking time to watch and to comment!
@@ResinChemTech Well, I have that to look forward to. It's really well done. My HA build is in the works so I still have a lot of time before I'll be to that stage.
Nice project, thanks for sharing. I recently did a similar project, deep sleep is nice but I found a power latch circuit works better. That way, the board is powered down completely and a dual MOSFET turns on power, the ESP32 itself can switch off power, once done, via a GPIO. Ralph Bacon has a nice design using a Si4599 IC. This way you don't have deep sleep current draw and you don't have to guess a value that determines how long your board is powered on
That's a great solution. For me, I eventually added a Zigbee hub and network to Home Assistant. Once I did that, I swapped out my original wifi version for a simple Zigbee door sensor. It did require me to install a Zigbee repeater (router) via a smart outlet on my front porch to extend the mesh to reach the mailbox, but it has been working great for over a year. The advantage is not only battery life (I'm getting 7-8 months off of a CR2032 battery... a little less in the cold winter vs. summer), but I also no longer have any wiring inside or outside the mailbox... just the simple Zigbee magnetic switch attached where the original wired reed switch was. But for those where Zigbee may not be an option, your solution is a good one! I think if I could have completely powered down the ESP32, then the battery life would have been much, much longer than what I was currently getting. Thanks for taking time to share it.
@@ResinChemTech I still need to experiment with Zigbee. I have had great success using LoRa on 868Mhz instead of WiFi, which helped a lot with battery life
How about using an ESP32 with external antenna mounted on the wooden post? I forget the ESP models but they have connectors to use instead of built in wifi antennas.
Yeah... I need to pin a comment or update the description. I originally did this over 3 years ago and struggled with battery life... but that was before I had a Zigbee network. I long ago replaced the WiFi version with a simple Zigbee door sensor. No controller, no wires and battery life of around 9 months. I did initially have some signal issues inside of the metal mailbox, but once I built out the Zigbee network a bit more and added a router on the front porch in the form of a smart plug, it is been rock solid... works every time and nothing is outside of the box and exposed to the weather. But I do appreciate the comment and recommendation.
YAML, nice walk-through. Ultimately, everyone will have to understand what's under the hood. I'll be reviewing your code for some takeaways. Maybe a video on how you set up the phone notification via SMS. I haven't researched this one yet. I found Verison what not sending text to me that I forwarded from google( I believe, it's been a long time ago)
Thanks! I like to try to cover at least a bit of the YAML/automation and then point people to the related blog or Github for the full code and/or deeper explanation. My push notifications are currently done via Home Assistant and the Home Assistant mobile/companion app, so they technically don't use SMS. It's pretty straight forward once setup, as our phones are defined devices in HA and all I have to do is issue a service call to that device (e.g. myphone.notify) with the text and type of message. The actionable notifications are really nice... so example if I send a push notification that says the garage lights were left on, there is an action right in the message that says "turn lights off" that I can just tap. But I'll definitely consider doing a longer, more in-depth video on this process. Thanks again for watching and taking time to comment!
That's a cool idea... if you can maintain battery life. I eventually gave up on trying to improve the battery life enough with wifi and moved over to a Zigbee sensor. While it took some tweaking to get a reliable signal from the sensor when inside the metal mailbox, I've currently been running without issue... and on the same battery... for over 6 months (with 40% still left on the battery). I did a separate video on trying to improve battery life with the wifi version, but I didn't have a lot of luck, likely due to the voltage regulator on the ESP32 board. But if you can design something that allows everything to truly go into deep sleep with very, very low draw on the battery, it would be a cool setup to get a photo as the notification that mail was delivered! Let me know how it goes and if you do end up building something.
@@ResinChemTech Can you link to the video of the zigbee sensor? Thats also what I did, but the battery didnt last very long. Do you have an external battery connected to it?
I didn't do a video on the Zigbee sensor version (the video I referenced above was my attempt to extend battery life on the wifi version... which ended up not making much of a difference anyway). I basically just removed everything from the wifi version and installed a Zigbee door sensor inside the mailbox. I did have to add a Zigbee smart plug to the front porch to extend the Zigbee mesh... but otherwise it has been working great. I got nearly 8 months out of the first battery (the built-in CR2032... no external battery or any other external device). I have noticed that the new battery I installed in the fall is draining a little faster, but I blame that on the cold weather here in Indiana. But it has been running for almost 5 months... and is still at 37% battery. But here is the video I referenced above on trying to extend the battery life for the wifi version: th-cam.com/video/OykXRflaKe0/w-d-xo.html ... but again, this has nothing to do with the Zigbee version.
I didn't see any provisions to provide a sync state? In case the mail carrier opens, and closes, the door twice (because he/she missed an envelope) or if another family member opens the mailbox before the mail has been delivered. Wouldn't this cause an out of sync issue that causes you to have to go to the mailbox and cycle the door reed switch, to get it back in sync? Maybe an optical sensor (that is only powered when the ESP32 awakes) mounted to the top and looking for a reflective surface on the bottom would be helpful. Then any envelope or mail that is put in the mailbox would break the beam and send a discrete (you for sure have mail).
I handle that (mostly) via the automations and scripts in Home Assistant. In the first situation (mail carrier opens twice), we still receive the voice notification that mail was delivered. I use an input_boolean in HA as the "flag", so I can always reset the state just by clicking on the button in Lovelace (I don't have to go to the mailbox and cycle the door to reset the state). The same thing would happen if I take out mail to be picked up by the carrier. In that case, I just toggle the input_boolean in HA to the proper state either before or after I take the mail out. It doesn't happen often that it gets out of sync, but it can/does happen on occasion. Your idea of an optical sensor is interesting, but it wouldn't solve the problem of when I take out mail to be picked up. I'd break the beam putting in my outgoing mail and the same problem would result. That's why I use the HA scripts and input_booleans to handle those types of situations. Just as an FYI, I'm currently on V2 of the mailbox that uses a standalone Zigbee reed switch. It's nice because there are no wires or exposed components, but it has signal problems with the metal mailbox. So, I am now working on V3 (back to wifi), but with a power hat that ought to result in longer battery life since the step-down converter isn't needed (that always draws battery). I'm doing a battery study at the moment and will do an updated mailbox video on the results when done.
@@ResinChemTech I look forward to your updated mailbox video and battery study. One thought - a low power uC to detect the mailbox door opening, and use the enable pin of your regulator to boot up the power hungry wifi enabled esp32. The uC could be powered with a very low loss linear regulator, taking very little battery power between activations. Basically the idle current would be the shutdown current of the switching regulator, the resistive divider for voltage detection, and whatever the uC needs.
I'm actually waiting on a few parts, but I'm going to expand this to a few different versions in a side-by-side comparison. One is what I mentioned above.. a power hat with a 3.7V LiPO battery and then another version with my 7.4V battery, but without the step up/down (since the ESP on board converter will handle the 7.4V). In all these versions (including the original), I do have the ESP32 go into deep sleep until awakened by a reed sensor on a GPIO pin... at which point, it awakens for 90 seconds to connect to wifi and send updated data (including battery voltage via voltage divider) to Home Assistant. So, in normal circumstances, the ESP32 is only 'awake' for 3 min./day. But I also want to integrate a low voltage relay trigger to shut down the circuit and protect the battery when a low voltage is hit. I had a number of the 7.4V batteries ruined in the original version because the step up converter continued to draw power (all the way down to 1V) if I didn't catch it in time... like when traveling. So, I want to build in a 'failsafe' that will simply kill the circuit if I don't replace a low battery in time. More to come....
You can find a full list of parts that I used (with Amazon links) in my related blog article: resinchemtech.blogspot.com/2021/06/youve-got-mail-mailbox-sensor-for-home.html But here's the link for the ElectroCookie solderable breadboard: amzn.to/3vx2AjQ
Excellent video. Thank you for letting us know about the Home Assistance . This is cool since I do not have web page. I was going to use a IOT device but this might be easier. I purchased similar magnetic switches that you are using in your mailbox. I purchased 10 of them to put in all my doors and windows in my house. I just need to make a decision on a circuit board. There are so many choices for us, (Raspberry pi, microbit, Arduino,etc). Are you using the ESP 32 for all the doors and windows? Thank you!
Thanks... and thanks for watching and commenting. To answer your question, I use Zigbee sensors for all my door and motion sensors. The advantage of Zigbee over wifi is primarily battery life... and the fact that each device does not need its own controller or board. The disadvantage is that a Zigbee hub is needed (if you have one of the new Amazon Alexa devices, it may have Zigbee and can serve as that hub). In fact, I have since upgraded my mailbox to use a Zigbee sensor instead of wifi. Not only better battery life, but I only need the door sensor... so no other wires or mounting of a controller is needed. But to answer your question, I used the ESP32 board. This was due to its ability to go into 'deep sleep' and conserve battery life.. and could be woke up by an external sensor (the door sensor in the case of the mailbox). Something like a Raspberry Pi would draw way too much power and quickly drain any batteries that might be attached to run it. I have a follow up video to the original mailbox video, where I try to improve the battery life (th-cam.com/video/OykXRflaKe0/w-d-xo.html), but I also talk about replacing the original system with a Zigbee sensor - jump ahead to about 24-25 minutes if you just want to see that part.... and I've even improved the original reliability of that with a Zigbee router (smart plug) in my front porch. Sorry for the lengthy reply... but Zigbee is probably a much better solution for any sort of door/window sensor... and a lot of motion sensors as well. And yes, the Zigbee sensors integrate nicely with Home Assistant as well. Let me know if I can help out any further!
@@ResinChemTech Thanks ! It is not too much detail to me since the more information the better. I appreciate the new link and additional info. I have a 3.? volt Lithium battery in a box waiting for me since I purchased it for a robot. I forgot since what I was going to use it to build a robot but my Dad got sick a over 5 years years ago and I had to stop tinkering with electronics to help him. Now that he has passes on, I started again. I will stay in touch. Again, thank you! " Happy Fathers Day" if you are a father!
Love your videos! Just wandered if you considered a tilt sensor. It would simply slightly. I use a very cheap mercury switch , 3d printed a small holder to put it in and then stuck to mailbox door.
Thanks! I didn't really think about a tilt sensor. But like most DIY projects, there are always multiple ways to accomplish the same outcome. Thanks for watching and taking time to suggest the use of a tilt sensor. Just out of curiosity, the tilt sensor has to be wired back to the controller, right? How did you deal with wiring that was connected to the moving door... or did you put everything in your 3D enclosure and stick that to the door?
@@ResinChemTech sorry for the delay, i just saw your reply. I am using an rf read switch device ( battery powered) in back of mailbox, I tapped into the read switch with 2 wires leading inside the mailbox up to the lid. Then 3d printed little holder for a small mercury switch and double sided 3m sticky stuff to the mailbox lid. I also put a better antenna on the rf sensor to help it make the distance to the house. everything is IN the mailbox accept the antenna
Just finished the hardware part, the sensor is working, but i cannot figure our the HA button-card config. Could you share your button card code? And thank you for sharing.
You should note that I'm using a custom-button card here, available via HACS, but here is the Lovelace YAML that shows mail has been delivered: aspect_ratio: 1.2/1 color: rgb(0,255,0) color_type: icon entity: input_boolean.mail_delivered name: No Mail state: - color: rgb(128,128,128) icon: mdi:mailbox value: 'off' - color: rgb(255,0,0) icon: mdi:mailbox-up name: Mail! styles: icon: - animation: blink 2s ease infinite value: 'on' type: custom:button-card
Fantastic video! A couple questions: 1. Did you need to think about weather sealing the stuff under the wood? No chance water gets on? 2. Did you ever find that the buck converter interferes with the wifi connection?
Thanks! To answer your questions: On the first version, I really didn't do anything to 'seal' the components other than the 3D printed cases they were in. It's pretty well protected where I mounted it, but at one point the entire mailbox was buried under snow (that DID kill the wifi!). While the system still functioned, I did notice some corrosion on the ESP32 pins. So, I rebuilt it, but covered all the pins in hot glue to help prevent the corrosion. I didn't notice any wifi problems, but the buck converter did lead to battery drain and at one point, destroyed the Li-ion battery because it went low when I was out of town, but kept draining the battery down to nearly 1V. By that time, I had added a Zigbee hub so I switched over to just a simply Zigbee door sensor. Problem with that is the metal mailbox pretty much blocks the signal when the door is closed. I'm currently working on a new version (back to wifi), but will be testing a couple of different designs and doing a side-by-side battery comparison. I'll release a video on that, probably in the next few weeks depending upon battery test results. But I hope to get more than the 1 month battery life I originally had in the first version.
@@ResinChemTech wow, that's a ton of new info, thanks! If only there were a way to attach the reed sensor to a ZigBee sensor... and get the device out of the Faraday cage. All the standard ZigBee door sensors have the reed sensor right next to the radio.
Yeah... I toyed with the idea of trying to build some sort of Zigbee sensor that would support an external antenna, but most off-the-shelf antennas are made for the hub/coordinator and not the end point devices and everything I came up with was either too big and bulky for inside the mailbox. I did violate my own rule on modifying existing structures and drilled a small hole (about the size of a pencil) on the back side of the mailbox that is line of sight to the hub, which is just inside the front porch. This actually improved reliability significantly, but the sensor still drops off the network from time-to-time. When that happens, it won't rejoin no matter what I do, so I have to delete the device from HA, unmount the Zigbee sensor, bring it back inside, pair it again and then add it back to Home Assistant! So, the wifi version was much more reliable and stable. The biggest issue with that was the 25-30 day battery life. That's what I'm hoping to study/improve upon in the next video. I'm actually building a 'test rig' with servos that will simulate opening the mailbox... then track battery voltage in a MySQL database. Still working on getting it all setup though!
@@ResinChemTech 1. Bummer not being able to attach an antenna or separate reed switch to a door sensor 2. Andreas Spiess has a video about putting LoRa inside his mailbox, and claims that is finally strong enough to get through the metal cage (no holes) 3. I was also wondering about some mechanical coupling. What if the mailbox door pulls a string or rod (much like servos couple) that teaks an external reed switch/door sensor?
It's really just a generic wired, NO magnetic reed sensor. But I have the full list of the parts and related Amazon links that I used in my related blog article: resinchemtech.blogspot.com/2021/06/youve-got-mail-mailbox-sensor-for-home.html
I've been averaging about a month off a full charge.... a little longer in summer, shorter in the winter. Theoretically, based on the draw of the ESP32 when in deep sleep, the battery should last significantly longer. But I suspect that the ESPHome implementation is either not putting the ESP32 into the absolute lowest (deepest) sleep possible, or more likely, the 5V step up/step down regulator is drawing from the battery even with the ESP32 is asleep. It's on my list of projects to revisit this... possibly using something like 4 AA batteries and eliminating the regulator to see what kind of battery life I might get.
@@ResinChemTech Yes, the regulators will always have a current draw. I would even look at bypassing the internal 3.3v regulator on the ESP32 module. You do that by simply wiring 3.3 volts (2.2 - 3.6 V) to the 3.3 V pin. The internal regulator won't draw any current when back fed voltage on it's output. If you use LiFePo4 the max voltage is 3.7 but quickly drops to 3.4. Maybe put a 3.6 v zener across it as a safety.
Thanks for the ideas! The one in the video was actual v2, as the original worked for over a year, but after spending time completely buried under snow for 2 days this past winter (FYI, snow does an excellent job of completely blocking WiFi!), some of the connections were getting corroded. I weather-proofed the second one a bit better. Ideally, I'd like to tinker with a Zigbee door sensor (now that I have a Tasmotized Zigbee hub), but will probably have to add some sort of external antenna (and maybe a externally mounted Zigbee router), as I suspect putting the switch inside a metal mailbox will pretty much kill any signal back to the hub. If I can get a Zigbee sensor to work, it will alleviate the battery issue, plus no external wiring will be needed nor will there be any exposure to the elements. Maybe v3 or v4!
@@ResinChemTech I agree about the ZigBee. I just got ZigBee up and running so I need to go try it to see if it will work. I also bought some ZigBee outlet switches (that plug into an outlet) and plan to place them around the house to act as ZigBee repeaters. Hopefully one will be able to reach the mailbox.
I spun up a Sonoff Zigbee hub flashed with Tasmota a few months ago and placed centrally in the house. I paired a couple of Aquar door sensors for the garage entry and service doors and they have been rock solid (with great battery life so far). I also have a Sonoff S31 Lite Zigbee outlet, but have yet to use it. I'm figuring I might be able to plug this into the outlet on the front porch to extend the mesh to the mailbox, but need to find a way to weatherproof it, as the Sonoff S31 is not rated for outdoor use and it's dimensions make it difficult to enclose into any sort of standard outdoor outlet box.
I have toyed with that idea, but we have a pretty strict HOA and not sure if I'd get dinged for it. In addition, everything is pretty inconspicuous at this point (you have to really look for it to see it). Adding a solar panel would draw attention... and I'm guessing the solar panel might go "missing" at some point as well. But I appreciate the suggestion. Thanks for watching!
Actually, the two small wires from the reed switch are enclosed in shrink tubing and taped into the upper corner of the mailbox. Really not noticeable unless you are really looking for them. About the only thing really visible to the carrier is the reed switch itself. My bigger concern is that when they stuff packages into the box and potentially rip the switch from the side. But so far, that hasn't happened.
Well, maybe it's close... but package delivery definitely isn't. And our particular mail deliverer despises getting out of his vehicle so he will do his best to cram any sort of package that he possibly can into the box instead of walking it up to the porch. So, yes, most "regular" mail is nothing but ads and flyers nowadays, but we still get a lot of online orders delivered by USPS and those are the ones I especially don't want just sitting out there waiting to be taken.
Some recommendations: Always use sockets for the microcontroller. Then if something goes wrong, you can easily unplug it. Likewise, if you choose to use boards like the author, only solder the pins you're using. Then it's easier to unsolder if needed. Great video BTW. I'm thinking of doing the same type of project, with the addition of a solar cell to keep the LIPO charged. I'm also going to add IR LEDs and IR receiver to actually see if something is in the mailbox.
Thanks for the tips. I do use headers or 'sockets' for some projects, but that's normally during the development phase when I'm writing and flashing my own code and there is a high probability of me bricking something. However, when ready to roll into 'production, I like to make my controller units as small as possible and place in a 3D printed enclosure. The sockets just add additional height that I don't need. Plus there is the possibility (although remote) of the board working loose from the socket... especially in a situation where exposed to vibration. Honestly, for the small cost of the controller and components, it's hard to beat soldered connections for reliability. If something does go wrong down the road, I just rebuild it.
But I do appreciate you sharing other alternative ideas. A removeable controller is definitely needed in situations where you can't flash updates over-the-air and have to flash via USB. Good luck with your mailbox project. I think solar would solve the problem I had with battery life, but I've since switched over to using Zigbee and a Zigbee sensor, which provides 10x the battery life over the wifi version.
Oh my... what a build! Good job. I recently bought a $10 wireless door bell that has a 1100 foot range from Amazon. I soldered a magnetic reed switch, also from Amazon, (like on the windows/doors of a security system), screwed the switch on the mail box and plugged the door bell into a wall socket. Works perfectly for less than $25 and 20 minutes to install.
Yeah... tends to be a bit more complicated that it needed to be... but that's par for the course for most of my projects!
I have since upgraded the original sensor and control box with a Zigbee reed switch. It took a couple of tries to get the right sensor (metal mailbox really kills the signal) and I needed to add a repeater/router to the outlet on the front porch, but it has been working flawlessly for six months.. all on a single battery and with no wires inside (or outside) the mailbox.
But the doorbell idea is a really good one! Thanks for watching and taking time to leave a comment... and sharing another great option for a mailbox sensor.
I believe that the current ESP32 boards run on 3.3V and include a 3.3V voltage regulator
Top tip from my recent work building a very low quiescent current RF beacon; put a generic optoisolator between the battery positive rail and the resistor for the resistive divider. You can then use a GPIO pin to turn on the divider via the optocoupler LED. The added series resistance is negligable, you can always tweak the derived voltage in the code.
Thanks for a great idea! I published a video a few weeks ago where I ran a very un-scientific study of two different designs to try to improve my battery life. I am NOT an electrical engineer (just a wannabe hobbyist) but the main take-away was that the ESP32 dev boards continue to draw power even when the ESP32 chip itself goes into deep sleep. Likely the UART chip and/or the power regulator. The voltage divider probably isn't having a big impact in this case as compared to the draw from the "sleeping" ESP dev board. I've actually switched over to using a Zigbee door sensor since I did this video. Great battery life, but it has it's own challenges with signal strength inside a metal mailbox!
Thanks again for the great suggestion. I love how much I'm able to learn from the people that watch my videos and provide ideas on how to make something better.
I use a Ring doorbell that I absolutely hated, chucked the POS in the mailbox! it works well enough... but I like your idea and will do this when the ring finally rings its last bell.
I should state that while the wifi version worked well, I did get tired of the short battery life due to the hungry nature of Wifi. I have since replaced the original system with a Zigbee sensor. I didn't have a Zigbee network when I built the original wifi system. But the Zigbee sensor gives me 6-9 months of battery (shorter in the winter) vs. the 4-6 weeks with the wifi version.
But other than the battery life, the wifi version worked very well and reliably.
Very nice. The Home Assistant display is really quite nice also. Would love to see a video on how you made that.
Thanks. I wish I could take more credit that I deserve for the display. But this secret is in the custom button card available via HACS: github.com/custom-cards/button-card
This custom button can do amazing things and I use it throughout my various Lovelace pages. I'd be happy to cover my Lovelace displays in a future video... or I'm considering trying my first live stream soon, where I could talk about it and do some Q&A of my various projects as well. Thanks for taking time to watch and to comment!
@@ResinChemTech Well, I have that to look forward to. It's really well done. My HA build is in the works so I still have a lot of time before I'll be to that stage.
Nice project, thanks for sharing. I recently did a similar project, deep sleep is nice but I found a power latch circuit works better. That way, the board is powered down completely and a dual MOSFET turns on power, the ESP32 itself can switch off power, once done, via a GPIO. Ralph Bacon has a nice design using a Si4599 IC. This way you don't have deep sleep current draw and you don't have to guess a value that determines how long your board is powered on
That's a great solution. For me, I eventually added a Zigbee hub and network to Home Assistant. Once I did that, I swapped out my original wifi version for a simple Zigbee door sensor. It did require me to install a Zigbee repeater (router) via a smart outlet on my front porch to extend the mesh to reach the mailbox, but it has been working great for over a year.
The advantage is not only battery life (I'm getting 7-8 months off of a CR2032 battery... a little less in the cold winter vs. summer), but I also no longer have any wiring inside or outside the mailbox... just the simple Zigbee magnetic switch attached where the original wired reed switch was.
But for those where Zigbee may not be an option, your solution is a good one! I think if I could have completely powered down the ESP32, then the battery life would have been much, much longer than what I was currently getting. Thanks for taking time to share it.
@@ResinChemTech I still need to experiment with Zigbee. I have had great success using LoRa on 868Mhz instead of WiFi, which helped a lot with battery life
How about using an ESP32 with external antenna mounted on the wooden post? I forget the ESP models but they have connectors to use instead of built in wifi antennas.
Yeah... I need to pin a comment or update the description. I originally did this over 3 years ago and struggled with battery life... but that was before I had a Zigbee network. I long ago replaced the WiFi version with a simple Zigbee door sensor. No controller, no wires and battery life of around 9 months. I did initially have some signal issues inside of the metal mailbox, but once I built out the Zigbee network a bit more and added a router on the front porch in the form of a smart plug, it is been rock solid... works every time and nothing is outside of the box and exposed to the weather.
But I do appreciate the comment and recommendation.
YAML, nice walk-through. Ultimately, everyone will have to understand what's under the hood. I'll be reviewing your code for some takeaways. Maybe a video on how you set up the phone notification via SMS. I haven't researched this one yet. I found Verison what not sending text to me that I forwarded from google( I believe, it's been a long time ago)
Thanks! I like to try to cover at least a bit of the YAML/automation and then point people to the related blog or Github for the full code and/or deeper explanation. My push notifications are currently done via Home Assistant and the Home Assistant mobile/companion app, so they technically don't use SMS. It's pretty straight forward once setup, as our phones are defined devices in HA and all I have to do is issue a service call to that device (e.g. myphone.notify) with the text and type of message. The actionable notifications are really nice... so example if I send a push notification that says the garage lights were left on, there is an action right in the message that says "turn lights off" that I can just tap. But I'll definitely consider doing a longer, more in-depth video on this process.
Thanks again for watching and taking time to comment!
I've been contemplating doing this but with an esp32cam module that takes a picture of the content, maybe use opencv to detect mail too
That's a cool idea... if you can maintain battery life. I eventually gave up on trying to improve the battery life enough with wifi and moved over to a Zigbee sensor. While it took some tweaking to get a reliable signal from the sensor when inside the metal mailbox, I've currently been running without issue... and on the same battery... for over 6 months (with 40% still left on the battery).
I did a separate video on trying to improve battery life with the wifi version, but I didn't have a lot of luck, likely due to the voltage regulator on the ESP32 board. But if you can design something that allows everything to truly go into deep sleep with very, very low draw on the battery, it would be a cool setup to get a photo as the notification that mail was delivered! Let me know how it goes and if you do end up building something.
@@ResinChemTech Can you link to the video of the zigbee sensor? Thats also what I did, but the battery didnt last very long. Do you have an external battery connected to it?
I didn't do a video on the Zigbee sensor version (the video I referenced above was my attempt to extend battery life on the wifi version... which ended up not making much of a difference anyway). I basically just removed everything from the wifi version and installed a Zigbee door sensor inside the mailbox. I did have to add a Zigbee smart plug to the front porch to extend the Zigbee mesh... but otherwise it has been working great. I got nearly 8 months out of the first battery (the built-in CR2032... no external battery or any other external device). I have noticed that the new battery I installed in the fall is draining a little faster, but I blame that on the cold weather here in Indiana. But it has been running for almost 5 months... and is still at 37% battery.
But here is the video I referenced above on trying to extend the battery life for the wifi version: th-cam.com/video/OykXRflaKe0/w-d-xo.html ... but again, this has nothing to do with the Zigbee version.
Small note: Windows key + ++ will give you a magnifying glass. You can either set it to full screen or a lens in the settings.
I didn't see any provisions to provide a sync state? In case the mail carrier opens, and closes, the door twice (because he/she missed an envelope) or if another family member opens the mailbox before the mail has been delivered. Wouldn't this cause an out of sync issue that causes you to have to go to the mailbox and cycle the door reed switch, to get it back in sync? Maybe an optical sensor (that is only powered when the ESP32 awakes) mounted to the top and looking for a reflective surface on the bottom would be helpful. Then any envelope or mail that is put in the mailbox would break the beam and send a discrete (you for sure have mail).
I handle that (mostly) via the automations and scripts in Home Assistant. In the first situation (mail carrier opens twice), we still receive the voice notification that mail was delivered. I use an input_boolean in HA as the "flag", so I can always reset the state just by clicking on the button in Lovelace (I don't have to go to the mailbox and cycle the door to reset the state). The same thing would happen if I take out mail to be picked up by the carrier. In that case, I just toggle the input_boolean in HA to the proper state either before or after I take the mail out.
It doesn't happen often that it gets out of sync, but it can/does happen on occasion. Your idea of an optical sensor is interesting, but it wouldn't solve the problem of when I take out mail to be picked up. I'd break the beam putting in my outgoing mail and the same problem would result. That's why I use the HA scripts and input_booleans to handle those types of situations.
Just as an FYI, I'm currently on V2 of the mailbox that uses a standalone Zigbee reed switch. It's nice because there are no wires or exposed components, but it has signal problems with the metal mailbox. So, I am now working on V3 (back to wifi), but with a power hat that ought to result in longer battery life since the step-down converter isn't needed (that always draws battery). I'm doing a battery study at the moment and will do an updated mailbox video on the results when done.
@@ResinChemTech I look forward to your updated mailbox video and battery study.
One thought - a low power uC to detect the mailbox door opening, and use the enable pin of your regulator to boot up the power hungry wifi enabled esp32. The uC could be powered with a very low loss linear regulator, taking very little battery power between activations. Basically the idle current would be the shutdown current of the switching regulator, the resistive divider for voltage detection, and whatever the uC needs.
I'm actually waiting on a few parts, but I'm going to expand this to a few different versions in a side-by-side comparison. One is what I mentioned above.. a power hat with a 3.7V LiPO battery and then another version with my 7.4V battery, but without the step up/down (since the ESP on board converter will handle the 7.4V). In all these versions (including the original), I do have the ESP32 go into deep sleep until awakened by a reed sensor on a GPIO pin... at which point, it awakens for 90 seconds to connect to wifi and send updated data (including battery voltage via voltage divider) to Home Assistant. So, in normal circumstances, the ESP32 is only 'awake' for 3 min./day.
But I also want to integrate a low voltage relay trigger to shut down the circuit and protect the battery when a low voltage is hit. I had a number of the 7.4V batteries ruined in the original version because the step up converter continued to draw power (all the way down to 1V) if I didn't catch it in time... like when traveling. So, I want to build in a 'failsafe' that will simply kill the circuit if I don't replace a low battery in time. More to come....
@@ResinChemTech That sounds very interesting!
where do you purchased the breadboard? I like it with presolder connected rails.
You can find a full list of parts that I used (with Amazon links) in my related blog article: resinchemtech.blogspot.com/2021/06/youve-got-mail-mailbox-sensor-for-home.html
But here's the link for the ElectroCookie solderable breadboard: amzn.to/3vx2AjQ
Excellent video. Thank you for letting us know about the Home Assistance . This is cool since I do not have web page. I was going to use a IOT device but this might be easier. I purchased similar magnetic switches that you are using in your mailbox. I purchased 10 of them to put in all my doors and windows in my house. I just need to make a decision on a circuit board. There are so many choices for us, (Raspberry pi, microbit, Arduino,etc).
Are you using the ESP 32 for all the doors and windows? Thank you!
Thanks... and thanks for watching and commenting. To answer your question, I use Zigbee sensors for all my door and motion sensors. The advantage of Zigbee over wifi is primarily battery life... and the fact that each device does not need its own controller or board. The disadvantage is that a Zigbee hub is needed (if you have one of the new Amazon Alexa devices, it may have Zigbee and can serve as that hub). In fact, I have since upgraded my mailbox to use a Zigbee sensor instead of wifi. Not only better battery life, but I only need the door sensor... so no other wires or mounting of a controller is needed.
But to answer your question, I used the ESP32 board. This was due to its ability to go into 'deep sleep' and conserve battery life.. and could be woke up by an external sensor (the door sensor in the case of the mailbox). Something like a Raspberry Pi would draw way too much power and quickly drain any batteries that might be attached to run it. I have a follow up video to the original mailbox video, where I try to improve the battery life (th-cam.com/video/OykXRflaKe0/w-d-xo.html), but I also talk about replacing the original system with a Zigbee sensor - jump ahead to about 24-25 minutes if you just want to see that part.... and I've even improved the original reliability of that with a Zigbee router (smart plug) in my front porch.
Sorry for the lengthy reply... but Zigbee is probably a much better solution for any sort of door/window sensor... and a lot of motion sensors as well. And yes, the Zigbee sensors integrate nicely with Home Assistant as well. Let me know if I can help out any further!
@@ResinChemTech Thanks ! It is not too much detail to me since the more information the better. I appreciate the new link and additional info.
I have a 3.? volt Lithium battery in a box waiting for me since I purchased it for a robot. I forgot since what I was going to use it to build a robot but my Dad got sick a over 5 years years ago and I had to stop tinkering with electronics to help him. Now that he has passes on, I started again.
I will stay in touch. Again, thank you! " Happy Fathers Day" if you are a father!
Love your videos! Just wandered if you considered a tilt sensor. It would simply slightly. I use a very cheap mercury switch , 3d printed a small holder to put it in and then stuck to mailbox door.
Thanks! I didn't really think about a tilt sensor. But like most DIY projects, there are always multiple ways to accomplish the same outcome. Thanks for watching and taking time to suggest the use of a tilt sensor. Just out of curiosity, the tilt sensor has to be wired back to the controller, right? How did you deal with wiring that was connected to the moving door... or did you put everything in your 3D enclosure and stick that to the door?
@@ResinChemTech sorry for the delay, i just saw your reply. I am using an rf read switch device ( battery powered) in back of mailbox, I tapped into the read switch with 2 wires leading inside the mailbox up to the lid. Then 3d printed little holder for a small mercury switch and double sided 3m sticky stuff to the mailbox lid. I also put a better antenna on the rf sensor to help it make the distance to the house. everything is IN the mailbox accept the antenna
Just finished the hardware part, the sensor is working, but i cannot figure our the HA button-card config. Could you share your button card code? And thank you for sharing.
You should note that I'm using a custom-button card here, available via HACS, but here is the Lovelace YAML that shows mail has been delivered:
aspect_ratio: 1.2/1
color: rgb(0,255,0)
color_type: icon
entity: input_boolean.mail_delivered
name: No Mail
state:
- color: rgb(128,128,128)
icon: mdi:mailbox
value: 'off'
- color: rgb(255,0,0)
icon: mdi:mailbox-up
name: Mail!
styles:
icon:
- animation: blink 2s ease infinite
value: 'on'
type: custom:button-card
@@ResinChemTech yes I installed the custom card, just struggled with the syntax. Thank you very much for the assistance!
Fantastic video! A couple questions:
1. Did you need to think about weather sealing the stuff under the wood? No chance water gets on?
2. Did you ever find that the buck converter interferes with the wifi connection?
Thanks! To answer your questions:
On the first version, I really didn't do anything to 'seal' the components other than the 3D printed cases they were in. It's pretty well protected where I mounted it, but at one point the entire mailbox was buried under snow (that DID kill the wifi!). While the system still functioned, I did notice some corrosion on the ESP32 pins. So, I rebuilt it, but covered all the pins in hot glue to help prevent the corrosion.
I didn't notice any wifi problems, but the buck converter did lead to battery drain and at one point, destroyed the Li-ion battery because it went low when I was out of town, but kept draining the battery down to nearly 1V. By that time, I had added a Zigbee hub so I switched over to just a simply Zigbee door sensor. Problem with that is the metal mailbox pretty much blocks the signal when the door is closed.
I'm currently working on a new version (back to wifi), but will be testing a couple of different designs and doing a side-by-side battery comparison. I'll release a video on that, probably in the next few weeks depending upon battery test results. But I hope to get more than the 1 month battery life I originally had in the first version.
@@ResinChemTech wow, that's a ton of new info, thanks!
If only there were a way to attach the reed sensor to a ZigBee sensor... and get the device out of the Faraday cage. All the standard ZigBee door sensors have the reed sensor right next to the radio.
Yeah... I toyed with the idea of trying to build some sort of Zigbee sensor that would support an external antenna, but most off-the-shelf antennas are made for the hub/coordinator and not the end point devices and everything I came up with was either too big and bulky for inside the mailbox. I did violate my own rule on modifying existing structures and drilled a small hole (about the size of a pencil) on the back side of the mailbox that is line of sight to the hub, which is just inside the front porch. This actually improved reliability significantly, but the sensor still drops off the network from time-to-time. When that happens, it won't rejoin no matter what I do, so I have to delete the device from HA, unmount the Zigbee sensor, bring it back inside, pair it again and then add it back to Home Assistant!
So, the wifi version was much more reliable and stable. The biggest issue with that was the 25-30 day battery life. That's what I'm hoping to study/improve upon in the next video. I'm actually building a 'test rig' with servos that will simulate opening the mailbox... then track battery voltage in a MySQL database. Still working on getting it all setup though!
@@ResinChemTech 1. Bummer not being able to attach an antenna or separate reed switch to a door sensor
2. Andreas Spiess has a video about putting LoRa inside his mailbox, and claims that is finally strong enough to get through the metal cage (no holes)
3. I was also wondering about some mechanical coupling. What if the mailbox door pulls a string or rod (much like servos couple) that teaks an external reed switch/door sensor?
What was the name of the read sensor you used
It's really just a generic wired, NO magnetic reed sensor. But I have the full list of the parts and related Amazon links that I used in my related blog article: resinchemtech.blogspot.com/2021/06/youve-got-mail-mailbox-sensor-for-home.html
How long does the battery last on the mailbox sensor?
I've been averaging about a month off a full charge.... a little longer in summer, shorter in the winter. Theoretically, based on the draw of the ESP32 when in deep sleep, the battery should last significantly longer. But I suspect that the ESPHome implementation is either not putting the ESP32 into the absolute lowest (deepest) sleep possible, or more likely, the 5V step up/step down regulator is drawing from the battery even with the ESP32 is asleep. It's on my list of projects to revisit this... possibly using something like 4 AA batteries and eliminating the regulator to see what kind of battery life I might get.
@@ResinChemTech Yes, the regulators will always have a current draw. I would even look at bypassing the internal 3.3v regulator on the ESP32 module. You do that by simply wiring 3.3 volts (2.2 - 3.6 V) to the 3.3 V pin. The internal regulator won't draw any current when back fed voltage on it's output. If you use LiFePo4 the max voltage is 3.7 but quickly drops to 3.4. Maybe put a 3.6 v zener across it as a safety.
Thanks for the ideas! The one in the video was actual v2, as the original worked for over a year, but after spending time completely buried under snow for 2 days this past winter (FYI, snow does an excellent job of completely blocking WiFi!), some of the connections were getting corroded. I weather-proofed the second one a bit better. Ideally, I'd like to tinker with a Zigbee door sensor (now that I have a Tasmotized Zigbee hub), but will probably have to add some sort of external antenna (and maybe a externally mounted Zigbee router), as I suspect putting the switch inside a metal mailbox will pretty much kill any signal back to the hub. If I can get a Zigbee sensor to work, it will alleviate the battery issue, plus no external wiring will be needed nor will there be any exposure to the elements. Maybe v3 or v4!
@@ResinChemTech I agree about the ZigBee. I just got ZigBee up and running so I need to go try it to see if it will work. I also bought some ZigBee outlet switches (that plug into an outlet) and plan to place them around the house to act as ZigBee repeaters. Hopefully one will be able to reach the mailbox.
I spun up a Sonoff Zigbee hub flashed with Tasmota a few months ago and placed centrally in the house. I paired a couple of Aquar door sensors for the garage entry and service doors and they have been rock solid (with great battery life so far). I also have a Sonoff S31 Lite Zigbee outlet, but have yet to use it. I'm figuring I might be able to plug this into the outlet on the front porch to extend the mesh to the mailbox, but need to find a way to weatherproof it, as the Sonoff S31 is not rated for outdoor use and it's dimensions make it difficult to enclose into any sort of standard outdoor outlet box.
You should make it solar
I have toyed with that idea, but we have a pretty strict HOA and not sure if I'd get dinged for it. In addition, everything is pretty inconspicuous at this point (you have to really look for it to see it). Adding a solar panel would draw attention... and I'm guessing the solar panel might go "missing" at some point as well. But I appreciate the suggestion. Thanks for watching!
Nice
Thanks! I hope you found something useful.
Imagine being the mail guy and you open someone's mailbox and you see a ton of wires
Actually, the two small wires from the reed switch are enclosed in shrink tubing and taped into the upper corner of the mailbox. Really not noticeable unless you are really looking for them. About the only thing really visible to the carrier is the reed switch itself. My bigger concern is that when they stuff packages into the box and potentially rip the switch from the side. But so far, that hasn't happened.
wow i th ought paper mail was extinct....
Well, maybe it's close... but package delivery definitely isn't. And our particular mail deliverer despises getting out of his vehicle so he will do his best to cram any sort of package that he possibly can into the box instead of walking it up to the porch.
So, yes, most "regular" mail is nothing but ads and flyers nowadays, but we still get a lot of online orders delivered by USPS and those are the ones I especially don't want just sitting out there waiting to be taken.