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. General Discussion
  3. Doorbell detection

Doorbell detection

Scheduled Pinned Locked Moved General Discussion
12 Posts 3 Posters 2.7k Views 4 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.
  • Puneit ThukralP Offline
    Puneit ThukralP Offline
    Puneit Thukral
    wrote on last edited by
    #3

    Thanks @mfalkvidd for your quick response. I get a sense how pulse power meter example will be useful. The sketch is too complex for me to understand. Correct me if I am wrong, that the pulse powermeter sketch is an overkill for my application. Will be asking for too much, if you could guide me on how to adapt the sketch .
    Thanks.

    mfalkviddM 1 Reply Last reply
    0
    • Puneit ThukralP Puneit Thukral

      Thanks @mfalkvidd for your quick response. I get a sense how pulse power meter example will be useful. The sketch is too complex for me to understand. Correct me if I am wrong, that the pulse powermeter sketch is an overkill for my application. Will be asking for too much, if you could guide me on how to adapt the sketch .
      Thanks.

      mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by mfalkvidd
      #4

      @Puneit-Thukral something like this should be sufficient

      // Enable debug prints
      #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      #include <MySensors.h>
      
      #define DOORBELL_RING_TIME 3000 // Assume the doorbell is ringing for 3 seconds
      #define DIGITAL_INPUT_SENSOR 3  // The digital input you attached your light sensor.  (Only 2 and 3 generates interrupt!)
      #define CHILD_ID 1              // Id of the sensor child
      MyMessage msg(CHILD_ID, V_TRIPPED);
      
      bool ringing = false;
      
      void setup() {
        pinMode(DIGITAL_INPUT_SENSOR, INPUT_PULLUP);
      
        attachInterrupt(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), onPulse, RISING);
      }
      
      void presentation() {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Doorbell", "1.0");
      
        present(CHILD_ID, S_DOOR);
      }
      
      void loop() {
        if (ringing) {
          // Let controller know the doorbell is ringing
          send(msg.set(true));
          ringing = false;
          wait(DOORBELL_RING_TIME);
          // Turn off ringing at controller
          send(msg.set(false));
        }
        sleep(0); // Sleep until there is a new interrupt
      }
      
      void onPulse() {
        ringing = true;
      }
      
      Puneit ThukralP 1 Reply Last reply
      0
      • Puneit ThukralP Offline
        Puneit ThukralP Offline
        Puneit Thukral
        wrote on last edited by
        #5

        Thank you so much! :100: :+1:

        zboblamontZ 1 Reply Last reply
        1
        • Puneit ThukralP Puneit Thukral

          Thank you so much! :100: :+1:

          zboblamontZ Offline
          zboblamontZ Offline
          zboblamont
          wrote on last edited by
          #6

          @Puneit-Thukral BUT..... Why NOT interfere.... I understand your desire to NOT physically interfere but it is illogical... LED=DC=Signal ? No ? A figure of 8 cable connection should not be impossible.... Once removed it is a two tiny holes...

          Puneit ThukralP 1 Reply Last reply
          0
          • zboblamontZ zboblamont

            @Puneit-Thukral BUT..... Why NOT interfere.... I understand your desire to NOT physically interfere but it is illogical... LED=DC=Signal ? No ? A figure of 8 cable connection should not be impossible.... Once removed it is a two tiny holes...

            Puneit ThukralP Offline
            Puneit ThukralP Offline
            Puneit Thukral
            wrote on last edited by
            #7

            @zboblamont Hi, @zboblamont could you please guide me how you think the setup should be.

            zboblamontZ 1 Reply Last reply
            0
            • mfalkviddM mfalkvidd

              @Puneit-Thukral something like this should be sufficient

              // Enable debug prints
              #define MY_DEBUG
              
              // Enable and select radio type attached
              #define MY_RADIO_NRF24
              //#define MY_RADIO_RFM69
              
              #include <MySensors.h>
              
              #define DOORBELL_RING_TIME 3000 // Assume the doorbell is ringing for 3 seconds
              #define DIGITAL_INPUT_SENSOR 3  // The digital input you attached your light sensor.  (Only 2 and 3 generates interrupt!)
              #define CHILD_ID 1              // Id of the sensor child
              MyMessage msg(CHILD_ID, V_TRIPPED);
              
              bool ringing = false;
              
              void setup() {
                pinMode(DIGITAL_INPUT_SENSOR, INPUT_PULLUP);
              
                attachInterrupt(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), onPulse, RISING);
              }
              
              void presentation() {
                // Send the sketch version information to the gateway and Controller
                sendSketchInfo("Doorbell", "1.0");
              
                present(CHILD_ID, S_DOOR);
              }
              
              void loop() {
                if (ringing) {
                  // Let controller know the doorbell is ringing
                  send(msg.set(true));
                  ringing = false;
                  wait(DOORBELL_RING_TIME);
                  // Turn off ringing at controller
                  send(msg.set(false));
                }
                sleep(0); // Sleep until there is a new interrupt
              }
              
              void onPulse() {
                ringing = true;
              }
              
              Puneit ThukralP Offline
              Puneit ThukralP Offline
              Puneit Thukral
              wrote on last edited by
              #8

              @mfalkvidd Hi, I got the setup running. However, as long as I am connected to the FTDI adapter, the sensor works fine. But when connected to 2 AA batteries through a buck up converter, the sensor does not communicate with domoticz.
              I read that LM393 needs 3.3 V and I have measured the voltage across Vcc and Gnd on LM393, its 3.3 V

              mfalkviddM 1 Reply Last reply
              0
              • Puneit ThukralP Puneit Thukral

                @mfalkvidd Hi, I got the setup running. However, as long as I am connected to the FTDI adapter, the sensor works fine. But when connected to 2 AA batteries through a buck up converter, the sensor does not communicate with domoticz.
                I read that LM393 needs 3.3 V and I have measured the voltage across Vcc and Gnd on LM393, its 3.3 V

                mfalkviddM Offline
                mfalkviddM Offline
                mfalkvidd
                Mod
                wrote on last edited by
                #9

                @Puneit-Thukral what does the debug output of the node and the gateway say?

                Puneit ThukralP 1 Reply Last reply
                1
                • Puneit ThukralP Puneit Thukral

                  @zboblamont Hi, @zboblamont could you please guide me how you think the setup should be.

                  zboblamontZ Offline
                  zboblamontZ Offline
                  zboblamont
                  wrote on last edited by
                  #10

                  @Puneit-Thukral Perhaps an outline of your circuit and what is sensing what may help narrow down the issues. Were I looking at something which fires an LED, there is DC supplying it, which should be easy enough to tap (low voltage DC line) to initiate a response from your node. I would be inclined to test a signal input to light onboard LED on external LED lit, then refine the sketch to carry out the action so it narrows problems to a software issue.... Right now this is Stevie Wonder playing golf in the dark....

                  1 Reply Last reply
                  1
                  • mfalkviddM mfalkvidd

                    @Puneit-Thukral what does the debug output of the node and the gateway say?

                    Puneit ThukralP Offline
                    Puneit ThukralP Offline
                    Puneit Thukral
                    wrote on last edited by
                    #11

                    @mfalkvidd Hi
                    On connecting the FTDI cable, the sensor works just fine. On disconnecting the FTDI it stops working. I figured its a power source issue. So, first tep to debug, I connected a 9v battery to RAW and GND - sensor node worked fine. I measured voltage across VCC and GND with the 9V battery - output across VCC and GND was 3.36 V and with 2 AA batteries connected through a buck boost converter, I measure 3.39 V across VCC and GND.

                    With the AA batteries, the small LED next to pin 9 on the pro-mini glows fainter than on the 9 V (across RAW/GND) and also blinks every few seconds.

                    Is there any way, I can fix this?

                    mfalkviddM 1 Reply Last reply
                    0
                    • Puneit ThukralP Puneit Thukral

                      @mfalkvidd Hi
                      On connecting the FTDI cable, the sensor works just fine. On disconnecting the FTDI it stops working. I figured its a power source issue. So, first tep to debug, I connected a 9v battery to RAW and GND - sensor node worked fine. I measured voltage across VCC and GND with the 9V battery - output across VCC and GND was 3.36 V and with 2 AA batteries connected through a buck boost converter, I measure 3.39 V across VCC and GND.

                      With the AA batteries, the small LED next to pin 9 on the pro-mini glows fainter than on the 9 V (across RAW/GND) and also blinks every few seconds.

                      Is there any way, I can fix this?

                      mfalkviddM Offline
                      mfalkviddM Offline
                      mfalkvidd
                      Mod
                      wrote on last edited by mfalkvidd
                      #12

                      @Puneit-Thukral I have to agree with with zboblamont. We're blind here. How is everything wired to your node? Which transport are you using? Which booster? And, again, what does the debug output say?

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


                      33

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.1k

                      Posts


                      Copyright 2025 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