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. Mailbox Sensor

Mailbox Sensor

Scheduled Pinned Locked Moved My Project
21 Posts 7 Posters 24.2k Views 3 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.
  • hekH hek

    @bjornhallberg said:

    I was wondering about the BinarySwitchSensor sketch? It does seem like the obvious choice for this application and overall it's a very versatile sketch, but it doesn't sleep or react to interrupts from button presses? Or am I misunderstanding the Arduino's capabilities here? Sorry for the noobish question.

    No it does not sleep in it's current form. It was actually more an example of using the debounce library. You probably could live without this and just go for the 1.4 build in:

     gw.sleep(INTERRUPT, CHANGE);
    
    epierreE Offline
    epierreE Offline
    epierre
    Hero Member
    wrote on last edited by
    #10

    @hek there is no interrupt related debouncing as far as I know, this is why I used the time debounce for my reed switch sketch of the water meter

    z-wave - Vera -> Domoticz
    rfx - Domoticz <- MyDomoAtHome <- Imperihome
    mysensors -> mysensors-gw -> Domoticz

    BulldogLowellB 1 Reply Last reply
    0
    • epierreE epierre

      @hek there is no interrupt related debouncing as far as I know, this is why I used the time debounce for my reed switch sketch of the water meter

      BulldogLowellB Offline
      BulldogLowellB Offline
      BulldogLowell
      Contest Winner
      wrote on last edited by
      #11

      @epierre

      you can debounce an interrupt:

      void PushButton() //interrupt.
      { 
        static unsigned long last_interrupt_time = 0;
        unsigned long interrupt_time = millis();
        if (interrupt_time - last_interrupt_time > 200) // If interrupts come faster than 200ms, assume it's a bounce and ignore
        {
          counter++;// your interrupt flag here
        }
        last_interrupt_time = interrupt_time;
      }
      
      epierreE 1 Reply Last reply
      0
      • BulldogLowellB BulldogLowell

        @epierre

        you can debounce an interrupt:

        void PushButton() //interrupt.
        { 
          static unsigned long last_interrupt_time = 0;
          unsigned long interrupt_time = millis();
          if (interrupt_time - last_interrupt_time > 200) // If interrupts come faster than 200ms, assume it's a bounce and ignore
          {
            counter++;// your interrupt flag here
          }
          last_interrupt_time = interrupt_time;
        }
        
        epierreE Offline
        epierreE Offline
        epierre
        Hero Member
        wrote on last edited by
        #12

        @BulldogLowell yes tjis is time debouncing as opposed to the debouncing library from tje switch sketch

        z-wave - Vera -> Domoticz
        rfx - Domoticz <- MyDomoAtHome <- Imperihome
        mysensors -> mysensors-gw -> Domoticz

        BulldogLowellB 1 Reply Last reply
        0
        • epierreE epierre

          @BulldogLowell yes tjis is time debouncing as opposed to the debouncing library from tje switch sketch

          BulldogLowellB Offline
          BulldogLowellB Offline
          BulldogLowell
          Contest Winner
          wrote on last edited by
          #13

          @epierre

          right, yes.

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

            A silly question - wouldn't PIR be the best option here? very responsive and interrupt driven so low power consumption? or am I missing something?

            BulldogLowellB 1 Reply Last reply
            0
            • Moshe LivneM Moshe Livne

              A silly question - wouldn't PIR be the best option here? very responsive and interrupt driven so low power consumption? or am I missing something?

              BulldogLowellB Offline
              BulldogLowellB Offline
              BulldogLowell
              Contest Winner
              wrote on last edited by
              #15

              @Moshe-Livne

              The PIR is a light sensor, so they are quite similar. The light sensor works for me, and I did try it with a motion sensor too. I'm not hung up on either but I can't say what is best.

              Try it with the motion and let us know how it goes for you!

              Moshe LivneM 1 Reply Last reply
              0
              • BulldogLowellB BulldogLowell

                @Moshe-Livne

                The PIR is a light sensor, so they are quite similar. The light sensor works for me, and I did try it with a motion sensor too. I'm not hung up on either but I can't say what is best.

                Try it with the motion and let us know how it goes for you!

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

                @BulldogLowell will do! that is one of my next projects. wouldn't PIR be easier to mount, as you can mount it at the back or at the top of the compartment? not trying to criticize, I am pretty much a newbie and trying to see if I miss anything.

                BulldogLowellB 1 Reply Last reply
                0
                • Moshe LivneM Moshe Livne

                  @BulldogLowell will do! that is one of my next projects. wouldn't PIR be easier to mount, as you can mount it at the back or at the top of the compartment? not trying to criticize, I am pretty much a newbie and trying to see if I miss anything.

                  BulldogLowellB Offline
                  BulldogLowellB Offline
                  BulldogLowell
                  Contest Winner
                  wrote on last edited by
                  #17

                  @Moshe-Livne

                  I'm sure you PIR will work well... if you look at the box I built, I didn't have a mounting problem.

                  Likewise I tried a mechanical switch, but didn't like what happened if the door wasn't closed all the way and I wanted to be able to get the 'module' in and out as I tested it.

                  The PIR was similarly an issue for me, if the box wasn't closed it would constantly send messages (changes in light from sun's position, car/person walking by, etc) during the day. so if you trust your letter carrier... :wink:

                  it is easy to try your idea; for me that is part of the fun of the world of electronics. And open-source is what makes reasonably well-crafted ideas into even better ideas!

                  Moshe LivneM 1 Reply Last reply
                  0
                  • BulldogLowellB BulldogLowell

                    @Moshe-Livne

                    I'm sure you PIR will work well... if you look at the box I built, I didn't have a mounting problem.

                    Likewise I tried a mechanical switch, but didn't like what happened if the door wasn't closed all the way and I wanted to be able to get the 'module' in and out as I tested it.

                    The PIR was similarly an issue for me, if the box wasn't closed it would constantly send messages (changes in light from sun's position, car/person walking by, etc) during the day. so if you trust your letter carrier... :wink:

                    it is easy to try your idea; for me that is part of the fun of the world of electronics. And open-source is what makes reasonably well-crafted ideas into even better ideas!

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

                    @BulldogLowell our mailboxes have slots, not door so there is no problem or door being left open. will try it the minute i'll get my hands on some more dupont cables!!!!

                    BulldogLowellB 1 Reply Last reply
                    0
                    • Moshe LivneM Moshe Livne

                      @BulldogLowell our mailboxes have slots, not door so there is no problem or door being left open. will try it the minute i'll get my hands on some more dupont cables!!!!

                      BulldogLowellB Offline
                      BulldogLowellB Offline
                      BulldogLowell
                      Contest Winner
                      wrote on last edited by
                      #19

                      @Moshe-Livne said:

                      will try it the minute i'll get my hands on some more dupont cables!!!!

                      :thumbsup:

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        Cai_Niao
                        wrote on last edited by
                        #20

                        Hi,I think you have done a good job.I am very interested in your IOS app, it's written by yourself or other open-source project? Thanks.

                        BulldogLowellB 1 Reply Last reply
                        0
                        • C Cai_Niao

                          Hi,I think you have done a good job.I am very interested in your IOS app, it's written by yourself or other open-source project? Thanks.

                          BulldogLowellB Offline
                          BulldogLowellB Offline
                          BulldogLowell
                          Contest Winner
                          wrote on last edited by
                          #21

                          @Cai_Niao

                          I am using HomeWave, an iOS app developed for Vera which is my controller.

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


                          14

                          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