IoT Doorman
- Category: Embedded, IoT
- Employer: Personal
- Project date: 2023
Project Information
IoT Doorman
This project solved a problem that I had for a while. While working, I have the habit of listening to loud music with noise-canceling headphones, something all package delivery guys absolutely love. So I would often fall victim to the dreaded "Looks like we missed you!" letter. In this case, it wasn't the package delivery guy just being lazy, but me not hearing them (completely my fault). Instead of giving every delivery person my number so they can call me, I thought it would be slightly less weird if my doorbell could just message me instead!
This is the system I came up with:
It is driven by an ESP8266 that is constantly in deep sleep mode. The only way to wake the ESP8266 from deep sleep is to set a timer for it and then connect the wake-up pin to its RST pin. When the timer runs out, the wake-up pin goes to ground, and when the RST pin is connected to ground, it resets the ESP. Cool!
Only one problem: I don't know when my doorbell is going to ring. I could check periodically if the doorbell is currently ringing, but that would have quite a high miss rate and would also have poor battery performance. However, I needed to connect it to my doorbell anyway. So why not have the doorbell wake the ESP from its never-ending slumber?
And that's what I did! I had toyed with the idea of using a transistor to control the waking mechanism, but I didn't want to be responsible for frying my apartment building's doorbell system, so I went with the easier but more expensive option of a relay.
Now you may be thinking, "Why is there a second relay on the board?" Well, I happened to notice that while I was at work or at Uni, my phone would buzz, and I could now just watch as the helpless delivery guy tried to get me to open the door, and there was nothing I could do about it.
Unless?
Unless?
Well, since my apartment doesn't have a fancy intercom system, there is just a simple switch to turn the door buzzer on and off. I took the switch off the wall to see if there was anything more happening, but nope, just a switch between 14V and ground.
So now I just had to do what I had done for the doorbell, just the other way round. One control pin of the ESP controlling the relay to bypass the door switch and done!
Some more bells and whistles of the system include providing me with an estimated battery percentage whenever it messages me. The battery life is just under two months, so it's not something I need to maintain much. I can also tell it to open the door by messaging it "/open" or "/power" to switch it into power mode, where it no longer goes into sleep mode until I tell it to (or it dies). This is useful for uploading new code or when it should react more quickly, as the time it takes to connect to the Wi-Fi is about 6 seconds. I ended up using Telegram to message with it, as it is easier and quicker than a WhatsApp bot.
Here are some more pictures of the final setup:
For anyone more interested in the system, I will provide a link to the code on GitHub. I need to mess around with it first though and move some of my sensitive information into a separate file.
If you are planning on building your own, you can follow the schematic. However, you will need to understand how your doorbell and door buzzer work.
Note: I did make a mistake with the setup for the power mode. I messed up a part of the transistor logic, so even if it is in power mode, it will still be reset when the doorbell rings. Oh well, I was thinking about having a PCB made for this. I can fix it then.