The advent of the ESP8266 microcontrollers opened up a more interesting approach. These are programmable microcontrollers with a built in wifi interface. They are tiny and also only cost about a pound each. So my plan was: build a new doorbell push from scratch, which talks to the wifi network. The old doorbell has an electromechanical sounder, which I'm reusing by replacing the driver circuit.
|ESP-01 on stripboard|
The theory of operation is as follows: the ESP-01 module will be put in deep sleep mode when idle. The button is wired between the ESP's reset pin and ground, so when someone pushes the button to ring the bell, it pulls reset low and wakes the device from deep sleep. The ESP-01 has an on board power LED which is always on and would drain the batteries quite quickly, so I've cut the track supplying power to that LED - the module now draws 20µA when in deep sleep mode, so I expect the batteries to last a while. When the ESP resets, it immediately associates with the wifi network and makes two HTTP requests - one directly to the sounder (more on this later) and the other to my home server. A php script on the server sends out "doorbell rang" instant messages to both myself and Mel via XMPP - this solves the problem of hearing the bell in the office, since the XMPP notification pops up on my workstation and phone.
|Everything just fits!|
The web requests that the button makes include the current battery voltage, so I can figure out when to change the batteries. Its now been in use for about 15 weeks and the reported battery voltage has fallen from about 3.182v to 3.053v, which I think is pretty reasonable.
|The finished doorbell push||On the door frame|
SounderAs mentioned, I'm re-purposing the old electromechanical sounder by replacing the old circuit board and driving the solenoid directly. The old sounder was powered by 3 C cells. Unlike the button, the sounder will need to remain connected to the wifi all the time, so batteries aren't really an option. I've opted to using a USB power supply, and with no need for the batteries there's now a lot of space inside the sounder for my new circuit.
I'm using an ESP-12F in the sounder - it's a bit overkill really, but I wanted to have an output that didn't have to be pulled up on boot. The mini-USB port is connected to an LM1117T-3.3 linear regulator to provide the 3.3v supply voltage. The solenoid is driven by an RFD14N05L field effect transistor and I've included a fairly chunky capacitor to help with the high power requirements of the solenoid. Of course there's also a reverse biassed diode in parallel with the solenoid to absorb the back-EMF (although no magic smoke was released before I bothered adding it).
The whole thing is soldered up onto stripboard and just pushed into the battery compartment of the sounder (having removed the battery contacts).
The sounder connects to the wifi network as soon as it is powered up and sits there waiting for an HTTP request. Making a request to "/" returns a status page, requesting "/ring" causes it to fire the striker and make the classic "ding-dong".
|The old electromechanical sounder with an ESP-12F installed|
Problems to be aware ofReceiving a notification on your phone to say the doorbell is being rung when you're a few hundred miles away is infuriating because you know you're going to have to drive up to the postal depot to collect a parcel when you get home. :)
Source codeSource code for the project is available in Subversion:
Could you wake up the esp everyday to do some test monitoring?ReplyDelete
You would need a timer to wake up the ESP. I think the ESP can be made to do this with some external wiring, or alternatively an external timer.ReplyDelete
Do you have a diagram for the two units?ReplyDelete
Unfortunately I can't find the diagrams I did for this project, but you should be able to piece them together from the description - the circuits are all pretty trivial.Delete
Any chance you'll do a write up/post the code for the home server side of things? This is exactly the project I'm looking for. Always been curious if the DHL guy actually knocks/rings the doorbell or not! ha.ReplyDelete
Any chance you will do a write up about the home server side of things? I would love to get something like this going at my place!ReplyDelete
The server-side code is pretty simple - it uses the sendxmpp script (http://sendxmpp.hostname.sk/ - ships as a standard part of Scientific Linux 7) to send XMPP messages in response to the doorbell button's HTTP requests. The server-side code is available through subversion:Delete
Probably being thick, but I don't understand howReplyDelete
gets translated to the IP address of the sounder.
Through DNS, as usual...Delete
Maybe I asked the wrong question. I couldn't see any reference to /doorbell.nexusuk.org in any of the source code. So I still don't understand.Delete
I'm not sure I understand the question.Delete
The source code (https://subversion.nexusuk.org/projects/doorbell/button/button.ino) contains the line:
errors |= make_request("http://doorbell.nexusuk.org/ring") != HTTP_CODE_OK;
So how does the DNS know to translate that to 192.168.xx.xx ?Delete
The DNS server publishes an A record for doorbell.nexusuk.org. See https://en.wikipedia.org/wiki/Dns for information on how DNS works.Delete
So basically, you've added it to a database of sorts that resides on your server?ReplyDelete
Yes, DNS is a system that underpins the whole internet - it is how any domain name (such as doorbell.nexusuk.org, or indeed www.google.co.uk) is converted into an IP address.Delete