DoorBell + Moteino = Awesome

UPDATE: Check out the new version of this, now with bell enable/disable function!

A lonely doorbell activated by a boring push-button at the front door is not very exciting in a world of Arduino and “Internet of Things”. I’ve been wanting to Arduinize the doorbell into the Moteino Framework gateway interface so that I could:

  • observe/count/graph when the doorbell is used
  • get notified when someone rings it if I am not at home (email, SMS etc)
  • play a sound when I am in my lab where I have a hard time hearing the chime (did I hear it or not? should I go upstairs to check? nah… I’m too busy for that)
  • ring the bell if I want to, *remotely* from your mobile device (why not right? just detecting is too boring)

Below is a schematic of what a typical wired door bell circuit looks like, and also a photo of what it looks like in my house. The dotted green rectangle is the circuit that I have physical access to – pictured next to it in my basement (and I don’t have a back door button):

I have a single button (front door) and probably most houses do. So I only care to inject my solution for that front door button. There is typically a 16VAC transformer powered from mains that activates the chime when the switch is pressed. So there are a few issues to solve in order to tap into this circuit, detect button presses and also being able to control it via Moteino:

  • Power our circuit from the 16VAC doorbell transformer. This is a good exercise to  create a DC power source from an AC source. We’ll use a simple half wave rectifier to achieve this
  • Detect when this 16VAC current flows through the wire coming from the outside button. When the button is pressed, the chime will ring and our circuit detects the AC current and outputs a digital HIGH for the Moteino input pin that monitors it
  • Make the Moteino “press” the door bell button when it receives a “RING” wireless message

I will explain these points step by step. Let’s get to work!

1. Getting 5V power from a 16VAC source

This is pretty trivial. We need to tap directly to the 2 terminals of the transformer, this is the 16V AC source that we feed from. All we need is a rectifier diode (1N4004 or 1N4007 will do) + smoothing capacitor (100uF is great, rated at least 25V or more) to go from a full sine wave to a half wave to a low ripple DC outout. My doorbell transformer is 16VAC rated and the peak-to-peak output is somewhere around 40Vpp. We then get a DC output that is around 18V which is too much for the Moteino so we can add a MC7805 5V regulator (which accepts up to 35V input) to get a stable and safe 5V source for the low power electronics. Here’s a schematic that shows how to go from AC to DC with a single rectifier diode and a smoothing capacitor, I tried all of this on a breadboard with a 12VAC transformer but it works the same as the 16VAC one:

Here is what the output on a scope looks like, straight from the rectifier circuit. Adding a the 7805 regulator brings it down to a smooth 5V, just what we’re after:

 2. Detecting AC current presence/flow with digital logic

Once we get the needed 5V DC power, we need to monitor the door bell button and determine when it is pressed. To do this we tap into the third tap – this is where the transformer output is wired to the door bell *through the front door push button*. When the button is pressed, current flows to the bell and the chime solenoid energizes and plays the high note, and when released the solenoid comes to rest and hits the low note. So when the front button is pressed, this third tap (often exposed like in my case) will have flow from the other side of the switch – the transformer.

To detect AC flow we can use a nifty little IC that can detect AC zero-crossing – the H11AA1 optocoupler. I found this video which explains it pretty well and has a schematic. The IC is optocoupled internally so it’s fully isolated and can be used to detect live mains AC zero crossing as well as lower AC like our 16VAC transformer output, it works the same. It basically outputs a short DC HIGH pulse on the DC side when the AC is crossing “zero”. Here’s the output from the IC on my scope – the blue is the 16VAC and yellow is the pulsed output from the H11AA1 – note the blue is 60hz and yellow is 120hz:

To output a constant DC HIGH pulse instead of 120hz pulses, we can do a little trick. Using a single PNP transistor we can invert the logic and we’re almost there. Here’s an article that describes how to invert digital logic with transistors and a diagram excerpt from that article that makes it plain to see what we’re doing. Also the inverted output (compare with previous scope shot):

To smooth it out to DC we use the same principle as in the first part – add a smoothing capacitor that will delay the voltage drop enough to keep it at constant “DC” voltage levels. Here is the breadboard with the PNP transistor, 10uF capacitor (any will do) and a LED for visual indication – this LED input will be shared with the Moteino digital pin that monitors this AC presence.

3. Virtually triggering the door bell via Moteino

Again, quite trivial. The button is just a momentary pushbutton. We can add a small relay in parallel and power it from 2 digital pins like the GarageMote relay.

Here is the complete schematic of this whole circuit. I tried this in DigiKey’s SchemeIt, a polished but otherwise pretty clumsy to use schematic builder:

Here’s the strip board implementation mess-up. I added a green “power” LED on the 16V rectified output, it should always be ON when the circuit is plugged in.

As I mentioned before, there are only 3 connections/taps into the existing circuit. The 2 red/black wires get the power from the 16VAC transformer. The yellow wire is the pushbutton tap which is used for the H11AA1 detector circuit and also on the relay output to simulate a door bell button press.

The Moteino sketch for this is published here. Here’s how this shows up in the gateway interface, and the graph showing me playing around with the door bell at different times in the afternoon:

Last thoughts:

  • The AC taps are not + and – like DC. They are just AC, pick one as reference and the other will sine around it. When we wire our circuit we pick one of the two to become our DC ground and we rectify the other with the diode/cap. To wire this all up correctly to the 3 taps you need to determine between which transformer tap and the chime tap there is 16VAC – that transformer tap will be your 16VAC, the other will be the GND. Otherwise you can short your own circuit when you close the relay, or have a constant ON input (red LED always ON), or perhaps other weird cases I can’t think of now. I guess it’s possible that a button/chime is hooked up backwards on the low side instead (opposite in my schematic above). You can also tell by touching the chime tap to the transformer taps. The one where it will ring the bell (aka chime) is your 16VAC input, the other is GND.
  • If this bell transformer location is difficult to reach, you can get a Moteino+FLASH MEM and wirelessly program any updates to it, the sketch already supports wireless updates.
  • Strip boarding is a pain, prone to errors/shorts and takes a long time so I suppose this could eventually become a new LowPowerLab kit if there’s enough interest, or unless someone else copies it before I bother.

If you have suggestions to improve the circuit or make it easier to understand add your comments below.

7 thoughts on “DoorBell + Moteino = Awesome

  1. Thank you – this is exactly what I had planned to do first as my introduction to Moteinos. Now I’ve no excuse (other than work, kids, pets…). The blog is fantastic. If, no, when I get my first project up and running I’ll blog my results. Keep up the great work.

  2. Exactly what I was looking for! Thanks again for sharing your great work with us Felix!

  3. I believe that the PNP (2N3906) transistor is flipped in the schematic. The collector should be connected to the 10uF cap and the emitter should be connected to the +5 rail.

    • You are correct, I can’t fix that since it was a capture from the online schematic tool and I cant remember if there was a way to flip their transistor symbol or I used the wrong one…

  4. Hi Felix,

    Very good, inspiring blog post. I myself tried something very similar a few years ago. It’s on my web site here: I am a software guy and really struggled to work out how to use the octocoupler properly. I switched to a ACS712 current sensor but I’d still rather use the octocoupler. I moved house since then so I need to build the project again for the new doorbell. I think I need to get a test AC power source and a decent test meter that can handle AC.


Comments are closed.