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. Announcements
  3. 💬 Door, Window and Push-button Sensor

💬 Door, Window and Push-button Sensor

Scheduled Pinned Locked Moved Announcements
110 Posts 36 Posters 22.5k Views 32 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.
  • tianaT Offline
    tianaT Offline
    tiana
    wrote on last edited by
    #99

    Thanks for fast reply, actually 900nA is to big number and i prefer to use xxx_POWER_PIN to cut the power of the NRF module.
    I am building switch powered with CR2032 battery and i want to extend battery live as much as possible, for a switch is not needed to keep radio alive, i need it ON only when transmit signal

    mfalkviddM 1 Reply Last reply
    0
    • tianaT tiana

      Thanks for fast reply, actually 900nA is to big number and i prefer to use xxx_POWER_PIN to cut the power of the NRF module.
      I am building switch powered with CR2032 battery and i want to extend battery live as much as possible, for a switch is not needed to keep radio alive, i need it ON only when transmit signal

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

      @tiana 900nA on a cr2032 is 27.9 years battery life. The self discharge of a cr2032 is around 250nA.
      But yes, use the power pin setting if you want to.

      Would be interesting to see how long sleep times are needed to make up for the extra time needed to wake up the radio from power off compared to sleep. The mcu and the radio will need to be awake for 100ms longer time when starting from power off than when starting from sleep.

      1 Reply Last reply
      1
      • T Offline
        T Offline
        Terence Faul
        wrote on last edited by
        #101

        Hi I notice that there is not sleep in this sketch. Is it not required for this build

        mfalkviddM 1 Reply Last reply
        0
        • T Terence Faul

          Hi I notice that there is not sleep in this sketch. Is it not required for this build

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

          @terence-faul the sketch will work as-is, as long as the node has a constant power supply. If you want a battery-powered node, you'll need sleep. See earlier discussions in this thread for ways to add sleep.

          1 Reply Last reply
          0
          • pepsonP Offline
            pepsonP Offline
            pepson
            wrote on last edited by
            #103

            Hi
            Can i connect two sensor contact to this arduino ? First to pin 3 second to pin 4 ? But how modified this sketch to support two sensor contact ?

            skywatchS 1 Reply Last reply
            0
            • pepsonP pepson

              Hi
              Can i connect two sensor contact to this arduino ? First to pin 3 second to pin 4 ? But how modified this sketch to support two sensor contact ?

              skywatchS Offline
              skywatchS Offline
              skywatch
              wrote on last edited by
              #104

              @pepson If you need the node to sleep or want to use interrupts then only digital pins 2 and 3 will do this for uno/promini.

              So otherwise 2 options really.

              If you just need to know that one of the sensors triggered (but not which one) then you can add sensors in series (for normally 'closed' sensors) or parallel (for normally 'open' sensors).

              To use interrupt and know which sensor triggered you'd have to connect both sensor to interrupt pin with blocking diodes to digital pins as well and then on interrupt you can check which digital pin activated the isr.

              1 Reply Last reply
              0
              • pepsonP Offline
                pepsonP Offline
                pepson
                wrote on last edited by
                #105

                I need connect two contact sensor. And i want to know from two sensor his status...
                I need use one to door but second to door garage.

                skywatchS 1 Reply Last reply
                0
                • pepsonP pepson

                  I need connect two contact sensor. And i want to know from two sensor his status...
                  I need use one to door but second to door garage.

                  skywatchS Offline
                  skywatchS Offline
                  skywatch
                  wrote on last edited by skywatch
                  #106

                  @pepson Then just add another sensor from ground to digital pin 2 and change the code you see in the example to accommodate the extra input.

                  You'll need to add another child id, another button, another bounce function, another presentation, another send and another bounce call.

                  pepsonP 1 Reply Last reply
                  0
                  • skywatchS skywatch

                    @pepson Then just add another sensor from ground to digital pin 2 and change the code you see in the example to accommodate the extra input.

                    You'll need to add another child id, another button, another bounce function, another presentation, another send and another bounce call.

                    pepsonP Offline
                    pepsonP Offline
                    pepson
                    wrote on last edited by
                    #107

                    @skywatch
                    Yes but i dont know how do it.... :-(
                    I dont know programing.

                    Nca78N gohanG 2 Replies Last reply
                    0
                    • pepsonP pepson

                      @skywatch
                      Yes but i dont know how do it.... :-(
                      I dont know programing.

                      Nca78N Offline
                      Nca78N Offline
                      Nca78
                      Hardware Contributor
                      wrote on last edited by
                      #108

                      @pepson said in 💬 Door, Window and Push-button Sensor:

                      @skywatch
                      Yes but i dont know how do it.... :-(
                      I dont know programing.

                      Not an excuse, it's time for you to learn :)

                      1 Reply Last reply
                      2
                      • pepsonP pepson

                        @skywatch
                        Yes but i dont know how do it.... :-(
                        I dont know programing.

                        gohanG Offline
                        gohanG Offline
                        gohan
                        Mod
                        wrote on last edited by
                        #109

                        @pepson then it is going to be quite difficult for you to work on DIY electronics projects if you don't how to program.

                        1 Reply Last reply
                        1
                        • I Offline
                          I Offline
                          iahim67
                          wrote on last edited by
                          #110

                          Perhaps it would be good to update the example code. I mean the pull-up sequence:
                          "It is recommended to set the pinMode() to INPUT_PULLUP to enable the internal pull-up resistor." - https://www.arduino.cc/reference/en/language/functions/digital-io/digitalwrite/
                          The following seems to be obsolete:
                          // Setup the button
                          pinMode(BUTTON_PIN,INPUT);
                          // Activate internal pull-up
                          digitalWrite(BUTTON_PIN,HIGH);

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


                          18

                          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