Join 3,554 readers in helping fund MetaFilter (Hide)

Help me understand the electronics in my doorbell
April 4, 2013 6:38 PM   Subscribe

I'd like to hook up a small raspberry pi project to my apartment's doorbell. I've taken the case off to take a look at the wiring and it looks pretty simple, but I have some questions about it; apart from some breadboard experiments I'm an complete newbie to electronics.

The doorbell is shared with everyone else in the building; it's got a button to listen to the person speaking down below, a button to speak to them, and a button to buzz them into the building. What I want to do is attach the pi to the circuit such that it will detect when the doorbell rings and notify me over IM, and then optionally buzz the person in (the practical reason for this is that I have a long narrow apartment and can't hear the buzzer from the bedroom). I'm fine with the software part of this project, getting the network stuff working, etc. What I need help with is the hardware part.

Here is a picture of the inside of the doorbell case - I've labeled the leads corresponding to the door, listen, and talk buttons respectively.

What I'm curious about is this:

* It looks like each of the leads has a twisted pair of wires coming to it. What's with that? I would expect one wire per lead, and it certainly looks like each pair is electrically connected anyways.

* Are the wire colors in some sort of standardized scheme that I can look up or something? (It's not clear from the picture, but all four pairs are bundled up in a larger cable.)

* It looks from the circuit like the wire marked "X" is most likely the ground, right?

* The number on the upper right-side of the circuit board is "2/96", does that mean anything sgnificant?

* Is there a standard or common voltage for these types of doorbell systems? (I do plan on measuring it with a multimeter to before I attach anything else to it, and I'm cognizant that it could have dangerous levels of current.) Am I likely to be able to attach one of these leads to a GPIO pin directly (assuming a resistor of the right type) or would I need some more complex electronics in between?

* Any other advice about this project?

One thing that is vexing me right now if the power setup - I can probably fit some kind of batteries or something in the case along with the pi, but ideally I'd like it to just be powered through the lines in the doorbell itself, or maybe be asleep most of the time and then when the doorbell rings, awaken, connect to the wifi and send me a message.
posted by whir to Technology (5 answers total) 4 users marked this as a favorite
Cheap doorbells and intercoms tend to be skeevy analog circuits that accomplish their goals through trickery and black magic (at least from the perspective of a digital hardware person). I would guess you'll have a tough time interfacing the RPi to the system without causing one or the other (or both) to stop working, possibly permanently. Also, such systems often use AC rather than DC, and your RPi won't like that very much.

Is there a buzzer or bell or something outside the frame, or does the doorbell chime also play through the speaker? If there's a separate bell, you can probably grab enough of a signal there to trigger a GPIO, although you'll probably have to condition it to avoid zappage. You'll need at least diodes and resistors, and would probably be best off using an optoisolator.

To open the door, you can probably use a second optoisolator (perhaps an optotriac) to short the two terminals marked "Door." I assume there's a metal spring or button or something over those terminals, and when you press it, the door unlocks?

For a power supply, you may be able to find an AC signal somewhere (probably 12-18VAC?) but I'm skeptical whether you'd be able to pull enough current from it to run the RPi. (Be careful when you're's unlikely to be 120VAC, but it's not impossible.) Safest and most reliable is to use optoisolators both ways (input and output), plus a separate wall-wart for the RPi. IIRC, RPi is a bit power-hungry and doesn't like to be underfed. An Arduino or Teensy would be plenty adequate for this task.

Let's see...looking more critically at your picture...

Terminals 1 and X go to the speaker, so there will be audio there at least some of the time. If the speaker is also used as a microphone, there will be both higher and lower levels (listen and talk). It'll probably be challenging to get these signals into the RPi in a useful form (but not impossible, if you're dedicated to doing it).

Looking at the Listen and Talk buttons, when you push Listen, 3 is connected to X, then through the speaker and to 1. So audio from the lobby probably arrives on 3, and is shoved through the speaker when you push listen. 1 (not X) is more likely the common line.

When you push Talk, 2 is connected to X, so 1 and 2 are probably connected to the input of an audio amplifier somewhere, and the output of that amp goes to a speaker in the lobby.

Finally, when you press Door, 2 is shorted to 3. In a cheap-n-dirty system, that may directly close the loop for a relay coil or something to unlatch the door. Check this by measuring the current from 2 to 3. You may have to measure in AC. If you see a few tens or low hundreds of mA, then somebody in the lobby will probably hear the door buzzing or clicking open.

HTH. Electronics is fun!

Aha, if there's no other bell (just the speaker) then the system will play the door chime through X and 1, but X will normally be floating (so that it works when you push Talk or Listen).
posted by spacewrench at 7:41 PM on April 4, 2013 [2 favorites]

Also, perhaps 1 will only be connected when somebody in the lobby has dialed your apartment or something. Otherwise, you could open the door at any time by pressing the Door button. In that case, it's likely that things are only powered when your apartment is selected. Unless the RPi boots instantly, you won't be able to use it from doorbell-system power. (However, an Arduino or Teensy probably would work here.)
posted by spacewrench at 7:48 PM on April 4, 2013

Thanks spacewrench, that's super helpful. I have been reading about optoisolators on wikipedia. To clarify a few things:

There are indeed buttons on the outside of the case which short the various pairs of terminals (corresponding to the text on the image).

I can buzz somebody in without anyone having dialed my apartment - in the lobby there are just 8 buttons for the different apartments, and when someone pushes the one for mine I hear a loud grinding / buzzing sound out of the doorbell - I assume it's coming from the big speaker in the photo, but it's not a recorded chime or anything like that. The whole setup seems very analog and low-tech compared to ones I've seen on larger buildings.

Another thing which occurred to me is that since the doorbell is very loud, I could probably just hook up a microphone inside the enclosure that would listen for the volume level going above a certain threshold for the trigger, rather than detecting the electrical signal via wires. I assume powering like a relay or something to close the door terminal would be safer than connecting the incoming doorbell wires directly to my equipment. However, part of the point of this project is to teach myself some electronics, so I'd like to hook up to the doorbell electronically if I can.

I do have an Arduino, and might try going that route, but connecting it to Wifi and doing the IM stuff seems like more of a hassle than with the RPi (not that I've researched it much yet).
posted by whir at 9:18 PM on April 4, 2013

Ah, WiFi is a trick. Someday I plan to implement host-side USB for WiFi so I can use a Teensy and a WiFi dongle as a remote web-controlled GPIO. But that's a big project for another decade.

If your system always live (which is reasonable for only 8 apartments) then you can almost certainly control the door lock with an opto-triac (check the current when you short 2 to 3, but I bet it's just closing a relay's coil). A relay to close the contacts for another relay's coil is overkill -- it would work fine, but now you have to power your relay, which is harder than powering an opto-triac.

Microphone to pick up the buzzer is a reasonable approach, except you'll probably have trouble distinguishing the buzzer from random slightly loud sounds. You can probably pull some of the buzzer sound off into an averaging circuit, and if it accumulates enough electrons during a short enough time, you can assume that the buzzer went off. Open the door, viola!

If you want to play around with pieces of the system before you implement the whole thing (which is an excellent approach), do something like this.

The GPIO line should turn the lock/buzzer in the lobby on and off.

(Of course, the very first thing you should test is if a straight piece of wire between 2 and 3 causes the door to unlock. But I think it will. And if so, then the GPIO/Optotriac thing should work too.)
posted by spacewrench at 9:43 PM on April 4, 2013

It looks like each of the leads has a twisted pair of wires coming to it. What's with that?

It was almost certainly originally designed to be wired up using 4-conductor cable, like modular telephone cable. 8-conductor (4-pair) network cable is so cheap these days that the builder probably just ran that cable instead and treated each pair as a wire.

Are the wire colors in some sort of standardized scheme that I can look up or something?

I don't think so, especially since I don't think they're using the same kind of cable they designed the circuit for.

The number on the upper right-side of the circuit board is "2/96", does that mean anything sgnificant?

Probably that PCB layout was done in February of 1996, or something along those lines.

Is there a standard or common voltage for these types of doorbell systems?

Not really. Commonly doorbells run on 12-18VAC or so, powered by a tiny transformer hidden in your walls somewhere. But this is actually a doorbell+intercom system, so it seems more likely that it's DC. Might be anywhere from 9 to 24 V. Definitely measure it before hooking stuff up.

Am I likely to be able to attach one of these leads to a GPIO pin directly (assuming a resistor of the right type)

Very unlikely. An optotriac as suggested above would work, but I'm also really fond of using small logic-level reed relays for interfacing. Unlike an optocoupler, electrically their outputs act almost exactly like a mechanical pushbutton, so even if the intercom is doing some kind of weird analog magic they should be fine.
posted by hattifattener at 10:49 PM on April 4, 2013

« Older ...that could be useful (for h...   |  I have a friend who has volunt... Newer »
This thread is closed to new comments.