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.
  • Meshx86M Offline
    Meshx86M Offline
    Meshx86
    wrote on last edited by
    #13

    i don't why, but debouncer.read(); always return 1, i was never able to send the status of the door, however, digitalRead(BUTTON_PIN) returns the actual value.

    since i am using this for reed switch, i believe i don't need the debouncing functionality do i ?

    Nca78N 1 Reply Last reply
    0
    • Meshx86M Meshx86

      i don't why, but debouncer.read(); always return 1, i was never able to send the status of the door, however, digitalRead(BUTTON_PIN) returns the actual value.

      since i am using this for reed switch, i believe i don't need the debouncing functionality do i ?

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

      @Meshx86 said:

      i don't why, but debouncer.read(); always return 1, i was never able to send the status of the door, however, digitalRead(BUTTON_PIN) returns the actual value.

      since i am using this for reed switch, i believe i don't need the debouncing functionality do i ?

      Hello,

      yes you can get rid of the debouncing stuff for your reed switch (or any physical switch) if you are sleeping and waking up on interrupt, just add a little wait before you read the value to let the switch settle.
      If you are running at 1MHz then the time to wake up from sleep is longer (45ms if I remember well) and you don't even need the sleep.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        thomas schneider
        wrote on last edited by
        #15

        What is the way to put the sketch on a sensebender with battery powered ?

        1 Reply Last reply
        0
        • T Offline
          T Offline
          thomas schneider
          wrote on last edited by
          #16

          Is the BinarySwitchSleepSensor a good answer ?

          1 Reply Last reply
          0
          • JicJ Offline
            JicJ Offline
            Jic
            wrote on last edited by
            #17

            @Meshx86

            I have the same problem, when I use the bounce library to read my reed switch I always read "1". If I use digitalRead I get an bounce error.
            I have an arduino compatible, configure it for 1Mhz, 1M resistor for the reed switch and 2 AA battery.
            Someone has a similar one working?

            Meshx86M 1 Reply Last reply
            0
            • JicJ Jic

              @Meshx86

              I have the same problem, when I use the bounce library to read my reed switch I always read "1". If I use digitalRead I get an bounce error.
              I have an arduino compatible, configure it for 1Mhz, 1M resistor for the reed switch and 2 AA battery.
              Someone has a similar one working?

              Meshx86M Offline
              Meshx86M Offline
              Meshx86
              wrote on last edited by
              #18

              @Jic i was wondering what's the purpose of the 1 M resistor on the reed switch ?
              i used 2 x AA battery, digitalRead, 8 MHz stock clock and no resistor, i know this might not be the most optimized power consumption setup

              1 Reply Last reply
              0
              • meanmrgreenM Offline
                meanmrgreenM Offline
                meanmrgreen
                wrote on last edited by
                #19

                Nuub here..
                Thinking about building this in my mailbox..
                AND if possible set a green light diode to start light when box is opened and stop when its opened again.

                That way i would see when i come home if someone has opened the mailbox or not.. Sure push notifications work aswell but it would be a nice touch for the wifey

                Nca78N 1 Reply Last reply
                2
                • meanmrgreenM meanmrgreen

                  Nuub here..
                  Thinking about building this in my mailbox..
                  AND if possible set a green light diode to start light when box is opened and stop when its opened again.

                  That way i would see when i come home if someone has opened the mailbox or not.. Sure push notifications work aswell but it would be a nice touch for the wifey

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

                  @meanmrgreen if you use a led it will draw a few mA when on and battery life will be poor.
                  At best you could wake up every few seconds and flash it briefly (like 100ms or less). In that case use a low value current limiting resistor to have an intense flash, and probably a red LED is better.
                  To stop the blinking why not use a button (or touch button, check TTP223 in AliExpress) inside the mailbox ?

                  1 Reply Last reply
                  0
                  • mfalkviddM Offline
                    mfalkviddM Offline
                    mfalkvidd
                    Mod
                    wrote on last edited by mfalkvidd
                    #21

                    Not sure if it more battery friendly, but maybe sending a bluetooth low energy beacon is better than a led? Higher nerd factor for sure, but maybe less spouse friendly (depending on how good the ble app on the phone is).

                    Seems like it would be possible by using an extra nrf24: https://github.com/floe/BTLE/blob/master/examples/send/send.ino

                    On the other hand, if a smartphone is required you might as well open the app for your controller and check the status there :)

                    Maybe use a battery-friendly PIR and only light/blink the led when motion is detected?

                    1 Reply Last reply
                    0
                    • meanmrgreenM Offline
                      meanmrgreenM Offline
                      meanmrgreen
                      wrote on last edited by
                      #22

                      You lost me at bluetooth beacon? :)

                      Me personally is using the app but wifey and kids ain't really as interested as i am ;)

                      So therefore I would need a indicator of some sorts around the mailbox that is about 30 meters from the house in the road up to the house.

                      Maybe a solar led light or similar to light up? Or a flag on a servo?

                      Will start with building the switch and figure out the indicator later.

                      1 Reply Last reply
                      1
                      • AteszA Offline
                        AteszA Offline
                        Atesz
                        wrote on last edited by
                        #23

                        Hi Everyone
                        Be carefull a newby here... :-)

                        I have ordered all the parts for my sensor network. My plan is to have battery powered sensor sensing the following: Door/window status AND temp/humidity. Doing all this in a low power fashion.

                        My question is: Would these code in the build section be easily combined (dooe switch and temp/hum) in a way that it measures the temp/hum regurarly (every 15-30 min) and if during the sleep a door event happens it sends the door event to the gateway (and probably since we are awake do a temp/hum measurement as well)?

                        Every piece of direction, advice is appreciated.

                        Atesz

                        1 Reply Last reply
                        0
                        • AteszA Offline
                          AteszA Offline
                          Atesz
                          wrote on last edited by
                          #24

                          Like I said..newby here. Hold back your horses for a moment, I did a deep search and found some interesting forum topics here :-)

                          mfalkviddM 1 Reply Last reply
                          0
                          • AteszA Atesz

                            Like I said..newby here. Hold back your horses for a moment, I did a deep search and found some interesting forum topics here :-)

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

                            @Atesz very welcome to the MySensors community!
                            "easily" is in the eye of the beholder, but I'd say yes. https://forum.mysensors.org/topic/2597/combining-mysensors-examples is a great starting poing for combining sketches.

                            AteszA 1 Reply Last reply
                            0
                            • mfalkviddM mfalkvidd

                              @Atesz very welcome to the MySensors community!
                              "easily" is in the eye of the beholder, but I'd say yes. https://forum.mysensors.org/topic/2597/combining-mysensors-examples is a great starting poing for combining sketches.

                              AteszA Offline
                              AteszA Offline
                              Atesz
                              wrote on last edited by
                              #26

                              @mfalkvidd Thank you very much, it is almost what I've been looking for !

                              1 Reply Last reply
                              1
                              • TON RIJNAARDT Offline
                                TON RIJNAARDT Offline
                                TON RIJNAARD
                                wrote on last edited by
                                #27

                                Goodevening,
                                I am new to mysensors (newby) i wil make 3 sensors on my mini pro can some one help me with the sketch.
                                I am working a hole day but i can't get it writh help is very use vol.
                                One switch (reed contact) is working.

                                1 Reply Last reply
                                0
                                • hekH Offline
                                  hekH Offline
                                  hek
                                  Admin
                                  wrote on last edited by
                                  #28

                                  Hi Ton,

                                  You have to give us a little bit more information here (and please start a new thread for your project).

                                  Normally good to give information about:

                                  1. What are you trying to accomplish?
                                  2. What is working?
                                  3. What is not working?
                                  4. What did you try yourself before posting?
                                  5. What is the expected result?
                                  6. Logs from the sensor/gateway/controller.
                                  1 Reply Last reply
                                  0
                                  • Svante TegelandS Offline
                                    Svante TegelandS Offline
                                    Svante Tegeland
                                    wrote on last edited by
                                    #29

                                    I had big problems getting this one to work in Domoticz... But then I downgraded the Arduino IDE to IDE 1.6.7 (https://forum.mysensors.org/topic/5164/ethernet-gw-w5100-can-not-connect-to-domoticz/2) and then it worked!

                                    1 Reply Last reply
                                    0
                                    • TON RIJNAARDT Offline
                                      TON RIJNAARDT Offline
                                      TON RIJNAARD
                                      wrote on last edited by
                                      #30

                                      @hek,

                                      Thanks for the reply.

                                      What are you trying to accomplish?
                                      I want to try 3 reed/door contacts on one mini-pro on pin 3,4 and 5

                                      What is working?
                                      One reed/door contact is working

                                      What is not working?
                                      I don't no how i must make a second reed/door contact in the sketch (door/window push button)
                                      I am new to programming arduino and don't undertsand how to do that, ik look for a hint how i can implement a second reed/door switch in the sketch

                                      What did you try yourself before posting?
                                      I look many sketches on internet and try to copy a copple of line in the working sketch but i don't get a second reed/switch in domoticz. I am trying this a hole day (i am with pension).

                                      What is the expected result? a second, thirth reed/sensor in domoticz i see here only the first sensor.

                                      Logs from the sensor/gateway/controller.
                                      The log for the first reed/door switch i see and it is working in domoticz, that is not the problem.

                                      Sorry for the bad English.

                                      1 Reply Last reply
                                      0
                                      • TON RIJNAARDT Offline
                                        TON RIJNAARDT Offline
                                        TON RIJNAARD
                                        wrote on last edited by
                                        #31

                                        @ Svante

                                        Thanks for the reply but is is working well with one reed switch. So that is not the problem I want on the mini/pro a second and thirt switch.

                                        1 Reply Last reply
                                        0
                                        • N Offline
                                          N Offline
                                          nickgosling
                                          wrote on last edited by
                                          #32

                                          Hi, New here but stumbled across this.
                                          I am planning on re-using an old wired alarm system that has door and window sensors all over my house terminating under my stairs. Can I combine one sketch into multiple door reed switches on one arduino. That seems to have been asked before but there doesn't seem to be an answer. It would be quite annoying to have 8 arduinos next to each other in order to do so.
                                          Nick

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


                                          12

                                          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