Hacking the doorbell

I bought a new doorbell. It actually came as a set, with two ringers. One is battery operated and the other is mains powered, plugging straight into the wall. I once again find myself attempting to keep up with Nick. Having seen his doorbell project I knew exactly what I had to do: it was time to hook my doorbell up to an Arduino board and put it on the internet.

Repurposed

The red wire is +3V, the black is ground. The doorbell chime unit used to draw its power from two AA batteries, so now it gets the same three volts from the Arduino instead.

The short dangling white wire is actually the antenna for wireless reception of the signal from the remote button, while the long white wire once completed the circuit to the buzzer. The Arduino treats it as an analog signal (and uses the built in pullup resistors to ‘steer’ the input to high). I should probably use it to drive a transistor to close a digital switch instead. This way works for now though.

The USB cable currently supplies the power and also acts as a serial line, down which the message that the doorbell has been triggered is sent. Eventually I’d like to use an ethernet shield, or even an ethernet-enabled Arduino like this one (which I do hope will be available soon!).

Here’s the Arduino sketch (tweaked slightly from Nick’s blog post).

int ledPin = 13;   // LED connected to digital pin 13
int potPin = 0;    // white doorbell wire to analog pin 0
int val = 0;

long time = 0;
long debounce = 5000;

void setup() {
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
  Serial.begin(9600);           // open serial port at 9600 baud
  digitalWrite(14 + potPin, HIGH); // set pullup on the analog pin
                                // (analog 0 = digital 14, a1 = d15, etc)
}

void loop() {
  val = analogRead(potPin);
  if (val < 100) {              // if the circuit is completed
  // (for me, it generally drops from 1023 to ~ 15 when 'ringing')
    if (millis()-time > debounce) {
      Serial.println("ON");
      digitalWrite(ledPin, HIGH);   // sets the LED on
      delay(500);                   // ...wait for half a second
      digitalWrite(ledPin, LOW);    // and turns the LED off
      time = millis();
    }
  }
}

To hook it up to my house’s twitter feed, I just need to open the serial line on the attached computer, doing something like this every time a new line is added

curl -u email@example.com:password -d status="There's somebody at the door" http://twitter.com/statuses/update.xml

Update: it’s now housed in an Altoids tin.

32 Comments »

RSS feed for comments on this post.

  1. I have a very similar wireless doorbell, but obviously without this extreme modding. Sometimes my doorbell chimes when there’s no one there. It is very scary. Just thought I’d warn you.

    Comment by infobunny — May 14, 2008 #

  2. Thanks. Actually, my previous wireless doorbell did that too. I guess the radio signal is prone to interference.

    Comment by Roo — May 14, 2008 #

  3. You should fix up a simple webcam to it, so that it takes a snap of your visitor and posts it to a flickr stream. Kind of a ‘Who’s at Roo’s?’.

    Comment by Kim — May 14, 2008 #

  4. That would be fun. I’m also thinking it would be helpful to know when ‘attempted deliveries’ were no such thing. I’m convinced I frequently get a “sorry we missed you” slip through the door when the delivery person has neither rung the doorbell nor knocked on the door. It might be a bit geeky to use my timestamped database of doorbell events as evidence when complaining though.

    Comment by Roo — May 14, 2008 #

  5. “neither rung the doorbell nor knocked on the door.”

    That has got me thinking… we need a vibration sensor for the cases where the visitor doesn’t ring the bell but knocks instead. Could also be used to spot things being posted through the letterbox.

    Comment by Nick O'Leary — May 14, 2008 #

  6. Yes.. as I typed it I was thinking of piezo elements. I wonder if I could mount something in the wooden panel next to the door, and still pick up enough vibrations when the door is knocked…

    Comment by Roo — May 14, 2008 #

  7. It seems that you might be able to get away with some sort of sound detector or something.. you would have most of the same problems with the analog nature of sound versus the analog nature of a vibrations. By that I mean to say that “when is a knock not really a knock?” (via sound.) But you would have to solve that question using vibrations, also, no?

    Comment by Chris — May 25, 2008 #

  8. It needs a converted cellphone with camera , so I can answer the door where ever I am, then a SMS operated door opener I can always be in for the parcels guy :-)

    Comment by Geoff — May 26, 2008 #

  9. I always wanted an outside door mat that weighed whoever was standing there :-)

    Comment by Geoff — May 26, 2008 #

  10. The hidden scales sound like fun. Combine it with a rangefinder and you could offer visitors a meal based on their Body Mass Index.

    I was actually looking at SMS operated door locks the other day, thinking that it would be handy to be able to go out without having to take keys. (Especially as I’m better at remembering my phone than my keys). My wife wasn’t convinced. In fact, she said “I’m not paying 10p every time I want to open the front door”.

    Comment by Roo — May 27, 2008 #

  11. Great idea. Could use an accelerometer chip instead of a piezo to detect knock.

    Comment by px-2 — August 21, 2008 #

  12. How about taking a webcam apart, and mounting the lens inside your peephole? Then, when the doorbell is rung, you can be emailed, or even MMS’d an image of the person at the door…

    Comment by richieacc — August 21, 2008 #

  13. Knock-detectors: do-it-yourself and commercial.

    Comment by Wim L — August 21, 2008 #

  14. Let me compare that to my setup :-)
    When someone rings the doorbell and i’m not at home a popup on my PC opens and shows the person at the door (when the PC is online). Otherwise I get an email with the photos. The doorcom calls my mobile phone and I can talk to that person. Of course I can open the door remotely… Or the garage when a mailmal wants to leave a parcel…

    Comment by jb — August 22, 2008 #

  15. I’ve been reading all this stuff, and I have to say it – hand on heart. You people really should get out more.

    Comment by Martini — September 11, 2008 #

  16. But if I’m out, how am else am I supposed to know if someone has rung the doorbell unless it’s being logged on the internet?

    Comment by roo — September 11, 2008 #

  17. Hi there – I stumbled across this article and became very excited… exactly what I’ve been looking for.

    I’m still trying to figure out how the code “sketches” work… but have a solid background in C/C++, C#, Java, so should be no problem.

    However, when the device receives the serial data from the push button, how are you calling your other script that sends the e-mail? It’s this command:

    “curl -u email@example.com:password -d status=”There’s somebody at the door” http://twitter.com/statuses/update.xml

    Where is the file “curl” located and how do you call that from the code on your controller device?

    Thanks!

    Comment by Patrick — January 3, 2009 #

  18. curl is a tool for talking to web servers. In this case (via the -d option) it’s being used to make an HTTP POST. The computer I was using as a bridge from the Arduino to the web is a Mac, which has curl ready to go on the command line. If you’re using any sort of Linux, it should Just Work, otherwise you’ll want to find a copy of Curl or handle the HTTP POST in whatever way is most comfortable for you.

    Comment by Roo — January 4, 2009 #

  19. So, do you have a separate app on your Mac that reads the serial data from the Arduino when the button is pressed?

    It doesn’t look like the Arduino language has much to it, unless you extend it with your own C/C++ code.

    My idea was to have some application on the PC listening to the Arduino COM port for any data that it sends, and then handle the “ring” accordingly. In my case, I don’t want to POST anything anywhere, just send an e-mail from the local machine.

    Comment by Patrick — January 4, 2009 #

  20. Yep, that’s right. The Arduino is good at interfacing with hardware, but when I want to use an input to do something webby I had to read the serial line and handle the event on a computer.

    A nice alternative, if you want to avoid having a computer running the whole time, might be to use an Ethernet shield which plugs into your Arduino like this one from Nuelectronics or this (announced but unreleased) one from Tinker.

    I have not played with an Arduino Ethernet shield yet. From what little I know about the Ethernet shields, I’d imagine that using one to send an email should be pretty straightforward. I’ve been jealously watching Nick’s experiences with a pre-release one from Tinker. He gave a great presentation at HomeCamp which is well worth watching.

    Comment by Roo — January 4, 2009 #

  21. Was just googling for wireless doorbells and your blog came up. The internet is a tiny place I tell yer! Nice geekout, well done.

    x
    Katie

    Comment by Shinykatie — January 14, 2009 #

  22. I’ve recently built one of these for my Windows server at home. Found your site when looking for suitable code to run on the Arduino — thanks for that!

    @Patrick – I had to write some Perl code to listen to the incoming serial stream and do something based on that data. My write up and Windows-compatible Perl code is here if you’re interested…

    http://www.grantgibson.co.uk/blog/index.php/2009/03/29/putting-doorbell-online/

    Grant

    Comment by Grant Gibson — March 30, 2009 #

  23. Hello colleagues, good piece of writing and nice
    urging commented here, I am in fact enjoying by these.

    Also visit my homepage – 7zip download xp chip

    Comment by 7zip download xp chip — January 15, 2014 #

  24. Great site. Plenty of useful information here.
    I’m sending it to some friends ans also sharing in delicious.
    And certainly, thank you for your effort!

    Comment by european university accredited — January 18, 2014 #

  25. I was able to find good information from your blog posts.

    my homepage: best online games of aall time (the-pluc.net)

    Comment by the-pluc.net — January 20, 2014 #

  26. I have been browsing online more than three hours today,
    yet I never found any interesting article like
    yours. It is pretty worth enough for me. Personally, if all webmasters and bloggers
    made good content as you did, the internet will be much more useful than ever before.

    Comment by men polo t-shirts uk — January 20, 2014 #

  27. Howdy! Someone in my Facebook group shared this site with
    us so I came to look it over. I’m definitely loving the information.
    I’m bookmarking and will be tweeting this to my followers!
    Fantastic blog and great design and style.

    my web blog – printable fire safety tips for kids [Kandice]

    Comment by Kandice — January 24, 2014 #

  28. It is perfect time to make some plans for
    the future and it is time to be happy. I’ve learn this post and if I may
    I wish to counsel you some fascinating issues or tips.

    Perhaps you can write subsequent articles referring to this article.
    I wish to read more issues approximately it!

    my blog :: CSR Racing Cheats (Octavio)

    Comment by Octavio — January 27, 2014 #

  29. When it comes to living a long and healthy life, there are
    two necessary ingredients: diet and fitness.

    There aren’t many food allergy diary apps out there, but if that is what you want from
    a food diary then Food Allergy Detective is definitely the
    best. For lunch you can have a salad, a turkey sandwich on wheat
    bread, or you can go with a meal if you are eating out.

    Review my homepage: how to have a smaller waist – Marla,

    Comment by Marla — January 29, 2014 #

  30. You have to be careful here as the sizing isn’t consistent amongst manufacturers.

    The CFM measure is useful for determining the vacuuming ability.
    Human beings would have a greater chance at a longer lifespan if the world’s air and water were cleaner and
    free of chemicals.

    Comment by http://yfrog.com/ — February 5, 2014 #

  31. Do not believe the tag stamped for the jewelry like 14 karat or 18
    karat because that might be done easily. I need to say, they really have a very lot of cheap deals
    going on at the website, I recently bought my partner a sharp looking Beaded Bauble Bracelet for under $20.
    You should use soap to your minimum since some soaps can contain heavy chemicals, which slowly degrade your silk fabric.

    Comment by Marylin — February 6, 2014 #

  32. Link exchange is nothing else except it is simply
    placing the other person’s web site link on your page at suitable place and other person will also do similar in favor of you.

    Review my blog

    Comment by Twitter hack — February 18, 2014 #

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WordPress with GimpStyle Theme design by Horacio Bella.
The postings on this site are my own and don't necessarily represent my employer's positions, strategies or opinions.