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.
  • gohanG gohan

    Have you tried with a debouce? Just in case...

    P Offline
    P Offline
    Pavel Polititsky
    wrote on last edited by
    #84
    This post is deleted!
    1 Reply Last reply
    0
    • gohanG gohan

      Have you tried with a debouce? Just in case...

      P Offline
      P Offline
      Pavel Polititsky
      wrote on last edited by
      #85

      @gohan the default sketch with debounce library works better, but now i see my primary problem.
      Occasionally I have an ACK errors

      4231 TSF:MSG:SEND,21-21-0-0,s=3,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:0
      4239 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
      4245 TSF:TDI:TSL
      4247 MCO:SLP:WUP=0
      4249 TSF:TRI:TSB
      4290 !TSF:MSG:SEND,21-21-0-0,s=3,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=NACK:1
      4298 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
      4302 TSF:TDI:TSL
      4304 MCO:SLP:WUP=0
      4306 TSF:TRI:TSB
      4313 TSF:MSG:SEND,21-21-0-0,s=3,c=1,t=16,pt=2,l=2,sg=0,ft=1,st=OK:0
      4321 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
      

      I tried to icrease the time ack on my controller - it does not help
      Ithink that I need to ckeck ack state on the node and send the message again, but have no idea how to do

      1 Reply Last reply
      0
      • gohanG Offline
        gohanG Offline
        gohan
        Mod
        wrote on last edited by gohan
        #86

        you are at the limit of the radio range I'd say so randomly it looses a message, so you need to either increase power or get a better antenna (I hope you aren't using any buck/boost converter as power supply)

        P 1 Reply Last reply
        0
        • gohanG gohan

          you are at the limit of the radio range I'd say so randomly it looses a message, so you need to either increase power or get a better antenna (I hope you aren't using any buck/boost converter as power supply)

          P Offline
          P Offline
          Pavel Polititsky
          wrote on last edited by
          #87

          @gohan how you know?
          Id 21 from range 0..255. Are you sure that is limit?

          Same with any different IDs, I tried sending message 3 times, this guarantees delivery of payload, but it using too much power

          Now I use power supply with 1117

          But my other nodes powered by CR2032 with boost 0.8-3.3V dc/dc with inductor coil on the NRF24 supply pin without any troubles

          Nca78N 1 Reply Last reply
          0
          • P Pavel Polititsky

            @gohan how you know?
            Id 21 from range 0..255. Are you sure that is limit?

            Same with any different IDs, I tried sending message 3 times, this guarantees delivery of payload, but it using too much power

            Now I use power supply with 1117

            But my other nodes powered by CR2032 with boost 0.8-3.3V dc/dc with inductor coil on the NRF24 supply pin without any troubles

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

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

            @gohan how you know?
            Id 21 from range 0..255. Are you sure that is limit?

            He means radio range (distance) not ID of node ;)

            P 1 Reply Last reply
            0
            • Nca78N Nca78

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

              @gohan how you know?
              Id 21 from range 0..255. Are you sure that is limit?

              He means radio range (distance) not ID of node ;)

              P Offline
              P Offline
              Pavel Polititsky
              wrote on last edited by
              #89

              @nca78 oke, undestood
              Problem stiil not resolved. I want to send message again to the gateway if NACK but dont know how to do it.

              send(msg.set(value == HIGH), true); 
              

              in this case i have additional ack log in the serial debug, nothing more

              1 Reply Last reply
              0
              • gohanG Offline
                gohanG Offline
                gohan
                Mod
                wrote on last edited by
                #90

                The send function returns a value, so you can check if it was successfully sent or not and in case retry

                1 Reply Last reply
                0
                • alowhumA Offline
                  alowhumA Offline
                  alowhum
                  Plugin Developer
                  wrote on last edited by alowhum
                  #91

                  A quick ACK example:

                          static boolean tryAgainLater = false; // should we resend?
                  
                          if(send(msgDust.setSensor(CHILD_ID_DUST_PM25).set(sensorValue),1)){
                            Serial.println(F("Received ACK"));
                            tryAgainLater = false;
                          }else {
                            Serial.println(F("Connection problem, try again"));
                            tryAgainLater = true;
                          }
                  
                  1 Reply Last reply
                  0
                  • mfalkviddM Offline
                    mfalkviddM Offline
                    mfalkvidd
                    Mod
                    wrote on last edited by mfalkvidd
                    #92

                    There is no need to set the second parameter to send() to true. That parameter is unrelated to the return value (except very unfortunate similar naming). More info: https://github.com/mysensors/MySensors/issues/1103

                    1 Reply Last reply
                    1
                    • alowhumA Offline
                      alowhumA Offline
                      alowhum
                      Plugin Developer
                      wrote on last edited by alowhum
                      #93

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

                      https://github.com/mysensors/MySensors/issues/1103

                      Ah, thanks. So ACK basically always happens?

                      in that case, do you have any better example code on how to check if the ACK is received?

                      mfalkviddM 1 Reply Last reply
                      0
                      • alowhumA alowhum

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

                        https://github.com/mysensors/MySensors/issues/1103

                        Ah, thanks. So ACK basically always happens?

                        in that case, do you have any better example code on how to check if the ACK is received?

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

                        @alowhum on nrf24, "hardware" ack is always on. "Software" ack is controlled by the second parameter in the send() function. Read https://forum.mysensors.org/post/34267 for an attempt to sort out the details. It is still quite confusing for me.

                        1 Reply Last reply
                        0
                        • tianaT Offline
                          tianaT Offline
                          tiana
                          wrote on last edited by
                          #95

                          What will happen if i cut the power OFF of the radio after each transmission? is it needed to be initialize again before next transmission?

                          mfalkviddM 1 Reply Last reply
                          0
                          • tianaT tiana

                            What will happen if i cut the power OFF of the radio after each transmission? is it needed to be initialize again before next transmission?

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

                            @tiana yes.

                            But don't cut the power. Use transportDisable and transportReInitialize instead.

                            1 Reply Last reply
                            0
                            • tianaT Offline
                              tianaT Offline
                              tiana
                              wrote on last edited by
                              #97

                              Do you know how much will be power usage in transportDisable mode?

                              mfalkviddM 1 Reply Last reply
                              0
                              • tianaT tiana

                                Do you know how much will be power usage in transportDisable mode?

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

                                @tiana depends on which transport you are using, and if using genuine or clone chips. The nrf24 is rated for 900nA.

                                1 Reply Last reply
                                0
                                • 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
                                          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