The Problem

I live in an apartment with a front lobby and a buzzer that lets people in. Having a button to push to remotely unlock a door is pretty neat, but you know what’s neater? Being able to do it from your phone. That’s what I set out to do in this project.

I saw a post on Twilio’s blog with a run down of quick rundown of how they did their system. (Twilio is a company that does messaging API’s for phones, so you can do things like have a server respond to SMS messages). The article suggested using an optocoupler, something I had never heard of. I found a good explanation of one here and the specs for one here. The gist of it is that an optocoupler provides isolation between the doorbell circuit and the circuit that your Raspberry Pi or Arduino is running on. When current runs through one end, a light turns on which the other end detects and allows current through its end. So when someone hits the doorbell, a light inside the optocoupler goes on, the recieving side sees it, and that signal gets propagated to your RPi all without subjecting your board to the high powered stuff coming out of your wall.

That was well and good, but I needed to know where to put this thing in my system. I also needed to know what kind of voltages I was dealing with. The first step was to take some measurements.

Diagramming the Doorbell

Luckily, my friend Jason is an electronics wizard (see electrical engineer). He let me borrow his Multimeter, and I set to work.

Here is a picture of my doorbell:

Here it is in terms of the individual components:

![Components of door bell system]({{ site.url }}/assets/Doorbell-comps.svg)

I made this with the Digikey SchemeIt tool. We have 2 buttons: the outside door bell, and the inside button for the door buzzer. We have 2 coils which affect the hammer that rings the bell. These are inductors. We have the mechanism that unlocks the door which I’m calling a resistor. And finally we have the big giant metal piece which I’m calling the platform (and using the European resistor symbol for.

Here are the components wired up. There are three wires coming in, one goes to the button, one goes to the “platform” and the third goes to a screw in the middle of the platform but isolated from the platform.

![Components with wall connections]({{ site.url }}/assets/Doorbell-wall.svg)

The first thing I measured was across the button. I measured 19 V AC. Uh oh. I remembered mostly how DC works from taking physics, but whatever I learned about AC was out the window. What this did tell us is that was that we had an AC source component that we didn’t know about before, so we can add that to the diagram. This is likely from a doorbell tranformer like this one which converts the 120 V/AC house power down to 16 or 24V.

Based on this diagram, I was confused. When I pushed the inside button, why didn’t the bell ring?

I enlisted Jason’s help. We discovered another component which was a switch between the inductors and the hammer. When we put a piece of paper in between the switch, the bell didn’t ring. This led us to the following diagram:

![System with added hammer switch component]({{ site.url }}/assets/Doorbell-switch.svg)

The hammer-switch was default closed. When current comes through the inductors, it creates a magnetic field that pulls the hammer into the bell. This also pulls the hammer-switch and opens that connection. This stops the current flowing through the inductors (and reverses the magnetic field). The hammer goes back to its original position, and the hammer-switch closes. This happens very rapidly which causes the extremely loud ringing of the bell.

After thinking about how the current could flow to cause the hammer switch to behave like it does, and to allow pressing the buzzer button and not ring the bell, we came up with this diagram:

![System with everything connected]({{ site.url }}/assets/Doorbell-wired.svg)

Plan to hook up the RaspberryPi

With the system diagrammed, it was time to decide how to hook it up. Again with Jason’s help, here’s what we came up with:

![System with raspberry pi hooked up]({{ site.url }}/assets/Doorbell-pi.svg)

The first added component is a Rectifier. It converts AC voltage into DC voltage. This will allow us to detect when there is AC voltage running through the bell, and it will convert it to DC voltage which we can run to the RaspberryPi. Not pictured here is a “buck” which will be needed to reduce the high DC output of the rectifier to something that the RaspberryPi can handle.

The second added component is a mechanical relay. This is a device which when voltage is applied mechanically moves to connect two wires. In this case, the 2 wires are the ends of the interios button. This will allow the RaspberryPi to activate the door buzzer.

Next Steps

If it sounded a little bit like I did not know what I was talking about for that last part, it’s because I do not. My next steps are to select some components and order them. I’ll make a follow up post about that. I’ll also be watching some Khan Academy videos about AC circuits and will report back any pertinent findings.

(edit 2016-12-4: Elaborated more on hammer-switch)