Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. How To - Doorbell Automation Hack

How To - Doorbell Automation Hack

Scheduled Pinned Locked Moved My Project
106 Posts 29 Posters 93.5k Views 26 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A arjen

    Yeah i know. Does it matter? It's seperated by the relay from the rest right?
    Or am I saying something stupid here.... :confused:

    petewillP Offline
    petewillP Offline
    petewill
    Admin
    wrote on last edited by
    #47

    @arjen Can you post pictures of the rest of the wiring? It's still strange that you have to have it connected to normally closed. That is most likely why your doorbell is ringing when it's first powered on.

    My "How To" home automation video channel: https://www.youtube.com/channel/UCq_Evyh5PQALx4m4CQuxqkA

    1 Reply Last reply
    0
    • A Offline
      A Offline
      arjen
      wrote on last edited by
      #48

      Sure, no prob.
      relay.jpg
      This is the relay, at the moment a 6 port, didn't had a one port available.
      The green wire is connected to IN1 on the relay and pin4 on the arduino.
      back_print.jpg
      the backside of the print. The bottom row 'S' is pin 9 on the arduino, 'M' and 'K' is pin3 and Ground to doorbellbutton.
      front_print.jpg
      front side. The brown and blue on the left are 5V to the relay, on the right red and blue are input doorbellbutton.

      1 Reply Last reply
      1
      • korttomaK korttoma

        For the NC problem change:

        #define RELAY_ON 1
        #define RELAY_OFF 0
        

        to:

        #define RELAY_ON 0
        #define RELAY_OFF 1
        
        korttomaK Offline
        korttomaK Offline
        korttoma
        Hero Member
        wrote on last edited by
        #49

        Did you try my suggestion?

        @korttoma said:

        For the NC problem change:

        #define RELAY_ON 1
        #define RELAY_OFF 0
        

        to:

        #define RELAY_ON 0
        #define RELAY_OFF 1
        
        • Tomas
        1 Reply Last reply
        0
        • petewillP Offline
          petewillP Offline
          petewill
          Admin
          wrote on last edited by
          #50

          Yeah, try @korttoma's suggestion. If that doesn't work, can you post a pic of the relay connections (all)?

          My "How To" home automation video channel: https://www.youtube.com/channel/UCq_Evyh5PQALx4m4CQuxqkA

          1 Reply Last reply
          0
          • D Offline
            D Offline
            drock1985
            wrote on last edited by
            #51

            Huh, I have the same problem as @arjen is describing too, the only difference is i'm using a 2x raly vs. his 4. I don't have an issue with the relay being on, since my node is always powered on, the pull always goes high. Might just change it in the code/wiring though when I get the Arduino IDE working again.

            Quick question: do you have the relay board powered by the Arduino, or another 5V source?

            My Projects
            2 Door Chime Sensor
            Washing Machine Monitor

            petewillP 1 Reply Last reply
            0
            • A Offline
              A Offline
              arjen
              wrote on last edited by
              #52

              Made the changes to the sketch as suggested, and now I can connect it to NO.
              Just to make sure I didn't made a mistake while soldering, used a fresh nano and made all connections again. In the sketch the changes still need to be made, however as far as i could test this morning all is working fine now!
              Thanks for all the tips!

              The relay is powered by the same powersource as the arduino (6 port powered usb hub 2A).

              1 Reply Last reply
              0
              • D drock1985

                Huh, I have the same problem as @arjen is describing too, the only difference is i'm using a 2x raly vs. his 4. I don't have an issue with the relay being on, since my node is always powered on, the pull always goes high. Might just change it in the code/wiring though when I get the Arduino IDE working again.

                Quick question: do you have the relay board powered by the Arduino, or another 5V source?

                petewillP Offline
                petewillP Offline
                petewill
                Admin
                wrote on last edited by
                #53

                @drock1985 the relay should be powered by the same 5v power source as the Arduino but not from the arduino. It can draw too much power and cause issues when connected to the arduino.

                @arjen Great! I just noticed the selection pin (can't think of the correct name right now) on your relay. I wonder if switching that would allow you to use the original code as well as the NO connections?

                My "How To" home automation video channel: https://www.youtube.com/channel/UCq_Evyh5PQALx4m4CQuxqkA

                1 Reply Last reply
                0
                • N Offline
                  N Offline
                  Newzwaver
                  wrote on last edited by
                  #54

                  Excellent project, great work.. So I need to pick your mind.... I have a doorbell that can change music and volume. I hope to be able to fully control it by zwave using this app with Vera...Any ideas.....

                  petewillP 1 Reply Last reply
                  0
                  • N Newzwaver

                    Excellent project, great work.. So I need to pick your mind.... I have a doorbell that can change music and volume. I hope to be able to fully control it by zwave using this app with Vera...Any ideas.....

                    petewillP Offline
                    petewillP Offline
                    petewill
                    Admin
                    wrote on last edited by
                    #55

                    @Newzwaver Hmm. I doubt this would work for you to fully control it but you may still be able to trigger it. How do you control it now? Through an app or something?

                    My "How To" home automation video channel: https://www.youtube.com/channel/UCq_Evyh5PQALx4m4CQuxqkA

                    1 Reply Last reply
                    0
                    • Moshe LivneM Offline
                      Moshe LivneM Offline
                      Moshe Livne
                      Hero Member
                      wrote on last edited by
                      #56

                      Hello all - sorry I have been away for so long...
                      This bring back memories http://forum.mysensors.org/topic/1620/mysensored-doorbell
                      I wish I found a way of triggering the notification from the ring and not the other way around, as this way when something happen to your arduino the doorbell will not ring. Didn't happen yet - it works perfectly for 6 months but I would feel more relaxed if it was the other way around. Oh well...

                      petewillP 1 Reply Last reply
                      0
                      • Moshe LivneM Moshe Livne

                        Hello all - sorry I have been away for so long...
                        This bring back memories http://forum.mysensors.org/topic/1620/mysensored-doorbell
                        I wish I found a way of triggering the notification from the ring and not the other way around, as this way when something happen to your arduino the doorbell will not ring. Didn't happen yet - it works perfectly for 6 months but I would feel more relaxed if it was the other way around. Oh well...

                        petewillP Offline
                        petewillP Offline
                        petewill
                        Admin
                        wrote on last edited by
                        #57

                        @Moshe-Livne Cool! You can look at it the other way around on the Arduino processing the ring issue you raised. I now have the ability to turn off the ring if I want to. So I guess there is some give and take :)

                        My "How To" home automation video channel: https://www.youtube.com/channel/UCq_Evyh5PQALx4m4CQuxqkA

                        Moshe LivneM 1 Reply Last reply
                        0
                        • petewillP petewill

                          @Moshe-Livne Cool! You can look at it the other way around on the Arduino processing the ring issue you raised. I now have the ability to turn off the ring if I want to. So I guess there is some give and take :)

                          Moshe LivneM Offline
                          Moshe LivneM Offline
                          Moshe Livne
                          Hero Member
                          wrote on last edited by
                          #58

                          @petewill ummmm you could still cut the ring even if it was the other way around with a relay. Sorry to be a pain :-) can't fight my mold hehehe. generally I find the reliability of dorrbells (especially the old wired kind) to be excellent. mine has been working flawlessly for at least 35 years.

                          petewillP 1 Reply Last reply
                          0
                          • Moshe LivneM Moshe Livne

                            @petewill ummmm you could still cut the ring even if it was the other way around with a relay. Sorry to be a pain :-) can't fight my mold hehehe. generally I find the reliability of dorrbells (especially the old wired kind) to be excellent. mine has been working flawlessly for at least 35 years.

                            petewillP Offline
                            petewillP Offline
                            petewill
                            Admin
                            wrote on last edited by
                            #59

                            @Moshe-Livne Ok, I must have misunderstood. I thought you wanted the bell to ring no matter what then just detect the signal so you could send it to your gateway. Either way, that's why MySensors is so great, you can do pretty much what ever YOU want, not what someone else wants :)

                            My "How To" home automation video channel: https://www.youtube.com/channel/UCq_Evyh5PQALx4m4CQuxqkA

                            Moshe LivneM 1 Reply Last reply
                            0
                            • petewillP petewill

                              @Moshe-Livne Ok, I must have misunderstood. I thought you wanted the bell to ring no matter what then just detect the signal so you could send it to your gateway. Either way, that's why MySensors is so great, you can do pretty much what ever YOU want, not what someone else wants :)

                              Moshe LivneM Offline
                              Moshe LivneM Offline
                              Moshe Livne
                              Hero Member
                              wrote on last edited by
                              #60

                              @petewill My original plan was to unintrusively detect the ring and trigger the arduino without effecting the bell circuit. However, it proved to be a bit more complicated and 2 dead arduinos and several other fried components later I gave up.

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                mike0913
                                wrote on last edited by
                                #61

                                I am new to home automation but curious if this same setup would work by having the arduino centrally located with the transformer in a closet and use the extra connections on the existing 4 conductor wire from the transformer to connect the new relay installed in the chime?

                                All this saves is some extra space and having to run 5V to the chime but one could use a larger arduino for additional automation projects rather than dedicated to just the chime.

                                Very nice tutorial- very easy to follow. Thanks

                                1 Reply Last reply
                                0
                                • D Offline
                                  D Offline
                                  drock1985
                                  wrote on last edited by
                                  #62

                                  Hey @mike0913 ,

                                  You can check out what I did with my Doorbell hack here (http://forum.mysensors.org/topic/2293/how-to-2-door-chime-automation-hack-thanks-petewill), it may help with your situation. Basically, I used the 16VAC input from the doorbell to power my Arduino, relays, and actual doorbell chime itself. Due to confined space, I had to mount mine in an external box below the existing door chime.

                                  My Projects
                                  2 Door Chime Sensor
                                  Washing Machine Monitor

                                  1 Reply Last reply
                                  0
                                  • N Offline
                                    N Offline
                                    Newzwaver
                                    wrote on last edited by
                                    #63

                                    @petewill, thanks for the reply and sorry it took me so long. I have decided to keep it to a small project starting with the remote on off, then moving to a trigger to my camera. I plan on breaking the doorbell down once the wife is out of the house for a day, lol. Thanks again.

                                    1 Reply Last reply
                                    0
                                    • petewillP petewill

                                      Hi Everyone,

                                      I put together this quick how to video for hacking your doorbell to work with MySensors. It's pretty basic and the code is based on the Relay Actuator sketch. It has two main features: controlling if the doorbell rings with an on/off switch and sending a triggered state whenever it's pressed. The silence feature can be useful if a child (or you) is taking a nap. The triggered state can be used for many different things like starting a security camera, sending an alert or text message, playing custom sounds via Sonos or other device, etc. Another note, the doorbell will still function even if your home automation the controller is down for some reason.

                                      Here are the additional details:
                                      https://youtu.be/nMIcalwpstc

                                      Fritzing Doorbell Wiring_bb.png

                                      /*
                                       * The MySensors Arduino library handles the wireless radio link and protocol
                                       * between your home built sensors/actuators and HA controller of choice.
                                       * The sensors forms a self healing radio network with optional repeaters. Each
                                       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                                       * network topology allowing messages to be routed to nodes.
                                       *
                                       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                                       * Copyright (C) 2013-2015 Sensnology AB
                                       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                                       *
                                       * Documentation: http://www.mysensors.org
                                       * Support Forum: http://forum.mysensors.org
                                       *
                                       * This program is free software; you can redistribute it and/or
                                       * modify it under the terms of the GNU General Public License
                                       * version 2 as published by the Free Software Foundation.
                                       *
                                       *******************************
                                       *
                                       * REVISION HISTORY
                                       * Version 1.0 - PeteWill
                                       *
                                       * DESCRIPTION
                                       * This sketch is used to control a doorbell ring with a relay as well as send an
                                       * alert when the buttons is pressed.  Connect the button to ground and digital
                                       * pin 3.  The relay controlling the doorbell is conntected to pin 4.
                                       * 
                                       * Watch the How To video here: https://youtu.be/nMIcalwpstc
                                       */
                                      
                                      
                                      #include <MySensor.h>
                                      #include <SPI.h>
                                      #include <Bounce2.h>
                                      
                                      #define NODE_ID 16 // or set to AUTO if you want gw to assign a NODE_ID for you.
                                      
                                      #define DOORBELL_PIN  3      // Arduino Digital I/O pin number for the doorbell button 
                                      #define RELAY_PIN  4         // Arduino Digital I/O pin number for the relay 
                                      #define DOORBELL_CHILD_ID 0  //ID of the doorbell
                                      #define SWITCH_CHILD_ID 1    // Id of the switch that will control doorbell sound
                                      #define RELAY_ON 1
                                      #define RELAY_OFF 0
                                      
                                      Bounce debouncer = Bounce();
                                      
                                      MySensor gw;
                                      MyMessage switchMsg(SWITCH_CHILD_ID, V_LIGHT);
                                      MyMessage doorbellMsg(DOORBELL_CHILD_ID, V_TRIPPED);
                                      
                                      unsigned int doorbellDelay = 1000; // interval at which to keep the doorbell button sensor triggered (milliseconds). This is used to stop people (kids) from pressing it too often
                                      unsigned int ringTime = 700; //How long the doorbell relay is on (in milliseconds)
                                      unsigned long doorbellMillis;  //Used to keep track of the last doorbell button press
                                      unsigned long doorbellTimer;  //Used to keep track of doorbell ring time
                                      byte doorbellPreviousVal;  //Used to keep track of doorbell button pressed state
                                      boolean ringDoorbell;  //Used to initiate the ring doorbell if statement
                                      boolean doorbellSound; //Used to keep track if the doorbell should sound or be silent.  Value recieved from doorbell on/off switch
                                      boolean doorbellOff = true;  //Used to keep track of doorbell ring state
                                      
                                      void setup()
                                      {
                                        gw.begin(incomingMessage, NODE_ID);
                                      
                                        // Send the sketch version information to the gateway and Controller
                                        gw.sendSketchInfo("Doorbell Monitor", "1.0");
                                      
                                        // Setup the button and activate internal pull-up
                                        pinMode(DOORBELL_PIN, INPUT_PULLUP);
                                      
                                        // After setting up the button, setup debouncer
                                        debouncer.attach(DOORBELL_PIN);
                                        debouncer.interval(5);
                                      
                                        // Register all sensors to gw (they will be created as child devices)
                                        gw.present(SWITCH_CHILD_ID, S_LIGHT);
                                        gw.present(DOORBELL_CHILD_ID, S_MOTION);
                                      
                                        // Make sure relays are off when starting up
                                        digitalWrite(RELAY_PIN, RELAY_OFF);
                                        // Then set relay pins in output mode
                                        pinMode(RELAY_PIN, OUTPUT);
                                      
                                        // Set doorbellSound to last known state (using eeprom storage)
                                        doorbellSound = gw.loadState(SWITCH_CHILD_ID);
                                      }
                                      
                                      void loop()
                                      {
                                        gw.process();
                                          unsigned long currentMillis = millis();
                                        //Check to see if doorbell button was pushed.
                                        if (currentMillis - doorbellMillis > doorbellDelay) //used to stop doorbell from being pressed too frequently
                                        {
                                          debouncer.update();
                                          // Read doorbell button value
                                          byte doorbellDetect = !debouncer.read();//read, then reverse the value so it will send correct trigger state to controller
                                      
                                          if (doorbellDetect != doorbellPreviousVal)
                                          {
                                            //Serial.print("doorbellDetect Value: ");
                                            //Serial.println(doorbellDetect);
                                            gw.send(doorbellMsg.set(doorbellDetect)); 
                                            if (doorbellDetect == 1)
                                            {
                                              ringDoorbell = true;
                                              doorbellTimer = currentMillis;
                                            }
                                            doorbellMillis = currentMillis;
                                            doorbellPreviousVal = doorbellDetect;
                                          }
                                        }
                                      
                                        if (ringDoorbell)
                                        {
                                          if (doorbellSound)
                                          {
                                            if (doorbellOff)
                                            {
                                              digitalWrite(RELAY_PIN, RELAY_ON);
                                              //Serial.println("Doorbell sounded.");
                                              doorbellOff = false;
                                            }
                                            else
                                            {
                                              if (currentMillis - doorbellTimer > ringTime)
                                              {
                                                ringDoorbell = false;
                                                digitalWrite(RELAY_PIN, RELAY_OFF);
                                                //Serial.println("Doorbell off.");
                                                doorbellOff = true;
                                              }
                                            }
                                          }
                                        }
                                      }
                                      
                                        void incomingMessage(const MyMessage & message) {
                                          // We only expect one type of message from controller. But we better check anyway.
                                          if (message.isAck()) {
                                            Serial.println("This is an ack from gateway");
                                          }
                                      
                                          if (message.type == V_LIGHT) {
                                            // Change relay state
                                            doorbellSound = message.getBool();
                                            // Store state in eeprom
                                            gw.saveState(SWITCH_CHILD_ID, doorbellSound);
                                      
                                            // Write some debug info
                                            Serial.print("Incoming change for sensor:");
                                            Serial.print(message.sensor);
                                            Serial.print(", New status: ");
                                            Serial.println(message.getBool());
                                          }
                                        }
                                      
                                      riochickenR Offline
                                      riochickenR Offline
                                      riochicken
                                      wrote on last edited by
                                      #64

                                      @petewill

                                      Thanks for the code! For some reason it is not functioning on my arduino pro, the relay doesnt do anything when I push the button on pin 3, I do see within the Vera that the button is being pushed I have no clue what is going wrong..

                                      This is the output from the serial monitor:
                                      send: 16-16-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:0
                                      send: 16-16-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=ok:1.5.3
                                      send: 16-16-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
                                      sensor started, id=16, parent=0, distance=1
                                      send: 16-16-0-0 s=255,c=3,t=11,pt=0,l=16,sg=0,st=ok:Doorbell Monitor
                                      send: 16-16-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
                                      send: 16-16-0-0 s=1,c=0,t=3,pt=0,l=0,sg=0,st=ok:
                                      send: 16-16-0-0 s=0,c=0,t=1,pt=0,l=0,sg=0,st=ok:
                                      Pushing button
                                      send: 16-16-0-0 s=0,c=1,t=16,pt=1,l=1,sg=0,st=ok:1
                                      send: 16-16-0-0 s=0,c=1,t=16,pt=1,l=1,sg=0,st=ok:0
                                      Pushing button
                                      send: 16-16-0-0 s=0,c=1,t=16,pt=1,l=1,sg=0,st=ok:1
                                      send: 16-16-0-0 s=0,c=1,t=16,pt=1,l=1,sg=0,st=ok:0

                                      Anybody that can help me out?

                                      Thanks!

                                      Kind regards,

                                      Richard

                                      riochickenR 1 Reply Last reply
                                      0
                                      • riochickenR riochicken

                                        @petewill

                                        Thanks for the code! For some reason it is not functioning on my arduino pro, the relay doesnt do anything when I push the button on pin 3, I do see within the Vera that the button is being pushed I have no clue what is going wrong..

                                        This is the output from the serial monitor:
                                        send: 16-16-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:0
                                        send: 16-16-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=ok:1.5.3
                                        send: 16-16-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
                                        sensor started, id=16, parent=0, distance=1
                                        send: 16-16-0-0 s=255,c=3,t=11,pt=0,l=16,sg=0,st=ok:Doorbell Monitor
                                        send: 16-16-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
                                        send: 16-16-0-0 s=1,c=0,t=3,pt=0,l=0,sg=0,st=ok:
                                        send: 16-16-0-0 s=0,c=0,t=1,pt=0,l=0,sg=0,st=ok:
                                        Pushing button
                                        send: 16-16-0-0 s=0,c=1,t=16,pt=1,l=1,sg=0,st=ok:1
                                        send: 16-16-0-0 s=0,c=1,t=16,pt=1,l=1,sg=0,st=ok:0
                                        Pushing button
                                        send: 16-16-0-0 s=0,c=1,t=16,pt=1,l=1,sg=0,st=ok:1
                                        send: 16-16-0-0 s=0,c=1,t=16,pt=1,l=1,sg=0,st=ok:0

                                        Anybody that can help me out?

                                        Thanks!

                                        Kind regards,

                                        Richard

                                        riochickenR Offline
                                        riochickenR Offline
                                        riochicken
                                        wrote on last edited by
                                        #65

                                        @riochicken

                                        Never mind, I didnt know I had to enable both switches within the arduino interface... ahum..

                                        Thanks anyhoe!

                                        Kind regards

                                        Richard

                                        1 Reply Last reply
                                        0
                                        • riochickenR Offline
                                          riochickenR Offline
                                          riochicken
                                          wrote on last edited by
                                          #66

                                          Excellent hack, works like a charm! I added two extra activations for my doorbell so it rings two times short and one longer time... Is there a way to create a variable in the Vera options so you can change the number of time the relay activates? Now I added them in the code but that is not really handy when the thing is build in and such... :)

                                          Thanks!

                                          petewillP 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          19

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular