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. Hardware
  3. Motion Sensor, flaky behavior

Motion Sensor, flaky behavior

Scheduled Pinned Locked Moved Hardware
22 Posts 7 Posters 7.7k Views 1 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.
  • N Offline
    N Offline
    naveen
    wrote on last edited by
    #1

    I recently build a motion sensor and it doesn't have robust behavior. It seems to work most of the time but not all of the time. Does the motion sensor only send a command once when its state change? e.g. once when it detects motion and then once when the motion stops? If so, I think if the first motion command is not sent, it will not detect motion again until the motion sensor turns off and then back on again. Does this make sense?

    How reliable should the sent commands be? I wired the capacitor across the motion sensor ground/3.3V but I didn't do it for my hub - should I put a cap there too??

    1 Reply Last reply
    0
    • daulagariD Offline
      daulagariD Offline
      daulagari
      Hero Member
      wrote on last edited by
      #2

      Why don't you add a LED or serial console to the motion sensor and add some code that activates them if motion is detected or when data is published. Then check things against the log of the gateway.

      1 Reply Last reply
      0
      • BulldogLowellB Offline
        BulldogLowellB Offline
        BulldogLowell
        Contest Winner
        wrote on last edited by
        #3

        From my experience, the motion sensor sketch works.

        Are you sure you have good radio connectivity?

        N 1 Reply Last reply
        0
        • BulldogLowellB BulldogLowell

          From my experience, the motion sensor sketch works.

          Are you sure you have good radio connectivity?

          N Offline
          N Offline
          naveen
          wrote on last edited by naveen
          #4

          @BulldogLowell said:

          From my experience, the motion sensor sketch works.

          Are you sure you have good radio connectivity?

          That was the first thing I suspected, They are pretty close to each other and have almost direct line of sight...Maybe 7m (21ft) between the gateway and the node. Maybe I need to add a cap to the radio for the gateway?

          BulldogLowellB 1 Reply Last reply
          0
          • N naveen

            @BulldogLowell said:

            From my experience, the motion sensor sketch works.

            Are you sure you have good radio connectivity?

            That was the first thing I suspected, They are pretty close to each other and have almost direct line of sight...Maybe 7m (21ft) between the gateway and the node. Maybe I need to add a cap to the radio for the gateway?

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

            @naveen

            definitely try that next.

            1 Reply Last reply
            0
            • N Offline
              N Offline
              naveen
              wrote on last edited by
              #6

              I gave it a go and it doesn't seem to help much. I'm powering the APM with the power supply included in http://www.ebay.ca/itm/131143728672?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649. I have a 12V 2A wall adapter plugged into the power supply that came with the breadboard and I'm using the 5V output into the RAW Arduino pin

              YveauxY 1 Reply Last reply
              0
              • N naveen

                I gave it a go and it doesn't seem to help much. I'm powering the APM with the power supply included in http://www.ebay.ca/itm/131143728672?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649. I have a 12V 2A wall adapter plugged into the power supply that came with the breadboard and I'm using the 5V output into the RAW Arduino pin

                YveauxY Offline
                YveauxY Offline
                Yveaux
                Mod
                wrote on last edited by
                #7

                @naveen Did you check the 5v with a multimeter?
                I have an identical breadboard supply and fried mine with a "12v" adapter. After measuring the output of the adapter it appeared to be around 16v and the onboard voltage converter (ams1117 if I recall right) had it's maximum input set to 15v or so...

                http://yveaux.blogspot.nl

                N BulldogLowellB 2 Replies Last reply
                0
                • YveauxY Yveaux

                  @naveen Did you check the 5v with a multimeter?
                  I have an identical breadboard supply and fried mine with a "12v" adapter. After measuring the output of the adapter it appeared to be around 16v and the onboard voltage converter (ams1117 if I recall right) had it's maximum input set to 15v or so...

                  N Offline
                  N Offline
                  naveen
                  wrote on last edited by
                  #8

                  @Yveaux

                  Hmm, that's good to know. Apparently my lab has a multimeter lying around so I'll measure the outputs tonight. @hek do you think you could add a reliable power supply vendor to the MySensors store? It is the one thing that I've had trouble choosing - they all look pretty similar its hard to tell the good from the bad.

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

                    @naveen said:

                    @hek do you think you could add a reliable power supply vendor to the MySensors store? It is the one thing that I've had trouble choosing - they all look pretty similar its hard to tell the good from the bad.

                    Yep, it is hard to tell good from bad. You have to take them apart to be sure. We cannot recommend any special ebay power supply at the moment. But a general tip is to add a few dollars when dealing with AC power. There might be a reason why some stuff is so cheap.

                    If anyone has a good supply dealer on ebay or elsewhere, please leave a tip here.

                    When we create our own AC MySensors board we will have the possibility to select good stable components.

                    1 Reply Last reply
                    0
                    • epierreE Offline
                      epierreE Offline
                      epierre
                      Hero Member
                      wrote on last edited by epierre
                      #10

                      I am to say I have the same issue...

                      I have a big difference between what the serial displays and what the gw receives... even when adding such to prevent too much radio...

                      if (lastValue != tripped) {
                      gw.sendVariable(CHILD_ID, V_TRIPPED, tripped?"1":"0");  // Send tripped value to gw     
                      }
                      lastValue=tripped;
                      

                      here it is pointing to the ground:

                      2014-07-26 20:47:03 4 1 1 0 26.1
                      2014-07-26 20:47:04 7 0 1 16 0
                      2014-07-26 20:47:04 7 0 1 16 1
                      2014-07-26 20:47:05 7 0 1 16 0
                      2014-07-26 20:47:08 7 0 1 16 1
                      2014-07-26 20:47:11 7 0 1 16 0
                      2014-07-26 20:47:14 7 0 1 16 1
                      2014-07-26 20:47:16 7 0 1 16 0
                      2014-07-26 20:47:20 7 0 1 16 1
                      2014-07-26 20:47:24 7 0 1 16 0
                      

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

                      epierreE 1 Reply Last reply
                      0
                      • epierreE epierre

                        I am to say I have the same issue...

                        I have a big difference between what the serial displays and what the gw receives... even when adding such to prevent too much radio...

                        if (lastValue != tripped) {
                        gw.sendVariable(CHILD_ID, V_TRIPPED, tripped?"1":"0");  // Send tripped value to gw     
                        }
                        lastValue=tripped;
                        

                        here it is pointing to the ground:

                        2014-07-26 20:47:03 4 1 1 0 26.1
                        2014-07-26 20:47:04 7 0 1 16 0
                        2014-07-26 20:47:04 7 0 1 16 1
                        2014-07-26 20:47:05 7 0 1 16 0
                        2014-07-26 20:47:08 7 0 1 16 1
                        2014-07-26 20:47:11 7 0 1 16 0
                        2014-07-26 20:47:14 7 0 1 16 1
                        2014-07-26 20:47:16 7 0 1 16 0
                        2014-07-26 20:47:20 7 0 1 16 1
                        2014-07-26 20:47:24 7 0 1 16 0
                        
                        epierreE Offline
                        epierreE Offline
                        epierre
                        Hero Member
                        wrote on last edited by epierre
                        #11

                        oooppppssss... wiring error.... @hek always told me to double check...

                        Here some hysteresis could be added, as commercial grade motion sensor, a value the gateway could send to modify how long the presence sensor will not send the "alarm is over", avoiding thus lots of notifications on server side and lot of redundant messages, here one every 2s ...

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

                        epierreE 1 Reply Last reply
                        0
                        • N Offline
                          N Offline
                          naveen
                          wrote on last edited by naveen
                          #12

                          I'm wondering if there is some way to do this:

                          -send tripped command to gw/vera
                          -poll gw/vera for the state of the tripped command (this is the step I have no idea how to do)
                          -if value of tripped which was sent does not match the value in vera, resend command
                          -repeat

                          That way you ensure the message is continually sent until it is received (up to some finite number of times to prevent infinite loops)

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

                            If you would consider moving your sensor network to 1.4 you can ask for an ack from gateway when you send in your tripped status.

                            This mean the gateway will reply back to you sensor and you can pick up this answer (or choose to resend status again after some timeout if ack never reaches your node).

                            N 1 Reply Last reply
                            0
                            • epierreE epierre

                              oooppppssss... wiring error.... @hek always told me to double check...

                              Here some hysteresis could be added, as commercial grade motion sensor, a value the gateway could send to modify how long the presence sensor will not send the "alarm is over", avoiding thus lots of notifications on server side and lot of redundant messages, here one every 2s ...

                              epierreE Offline
                              epierreE Offline
                              epierre
                              Hero Member
                              wrote on last edited by
                              #14

                              @hek is there a way to make an interrupt with time ?

                              I mean:

                              • if it is tripped and previous status was untripped, send the alarm
                              • if it is untripped but below a certain time don't send anything
                              • after a while, the timer sends an untrip after the amount of time

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

                              hekH 1 Reply Last reply
                              0
                              • epierreE epierre

                                @hek is there a way to make an interrupt with time ?

                                I mean:

                                • if it is tripped and previous status was untripped, send the alarm
                                • if it is untripped but below a certain time don't send anything
                                • after a while, the timer sends an untrip after the amount of time
                                hekH Offline
                                hekH Offline
                                hek
                                Admin
                                wrote on last edited by
                                #15

                                @epierre

                                Yes, all this should be possible.
                                Untripped should probably still be handled by the motion sensor (you will get an interrupt when state changes and can use the trimpot to change delay).

                                epierreE 1 Reply Last reply
                                0
                                • hekH hek

                                  @epierre

                                  Yes, all this should be possible.
                                  Untripped should probably still be handled by the motion sensor (you will get an interrupt when state changes and can use the trimpot to change delay).

                                  epierreE Offline
                                  epierreE Offline
                                  epierre
                                  Hero Member
                                  wrote on last edited by
                                  #16

                                  @hek you mean only the hardware way ?

                                  Here if under 20s (in arduino time) I get my untrip, I don't send it. If a timer don't occurs, the untrip will never be sent.

                                  any idea ?

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

                                  hekH 1 Reply Last reply
                                  0
                                  • epierreE epierre

                                    @hek you mean only the hardware way ?

                                    Here if under 20s (in arduino time) I get my untrip, I don't send it. If a timer don't occurs, the untrip will never be sent.

                                    any idea ?

                                    hekH Offline
                                    hekH Offline
                                    hek
                                    Admin
                                    wrote on last edited by
                                    #17

                                    @epierre

                                    How do you keep track of time while sleeping your Arduino?

                                    epierreE 1 Reply Last reply
                                    0
                                    • hekH hek

                                      @epierre

                                      How do you keep track of time while sleeping your Arduino?

                                      epierreE Offline
                                      epierreE Offline
                                      epierre
                                      Hero Member
                                      wrote on last edited by
                                      #18

                                      @hek do the millis does it ? else I can add a rtc

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

                                      1 Reply Last reply
                                      0
                                      • hekH hek

                                        If you would consider moving your sensor network to 1.4 you can ask for an ack from gateway when you send in your tripped status.

                                        This mean the gateway will reply back to you sensor and you can pick up this answer (or choose to resend status again after some timeout if ack never reaches your node).

                                        N Offline
                                        N Offline
                                        naveen
                                        wrote on last edited by
                                        #19

                                        @hek

                                        Is there any reason I should avoid 1.4? I wouldn't mind upgrading if it'll make my sensors a bit more robust. I'm waiting for 5V power supplies in case the 12V power supply I have is what is causing my issues

                                        hekH 1 Reply Last reply
                                        0
                                        • N naveen

                                          @hek

                                          Is there any reason I should avoid 1.4? I wouldn't mind upgrading if it'll make my sensors a bit more robust. I'm waiting for 5V power supplies in case the 12V power supply I have is what is causing my issues

                                          hekH Offline
                                          hekH Offline
                                          hek
                                          Admin
                                          wrote on last edited by
                                          #20

                                          @naveen

                                          No, not really. Go for it. But things might still change (protocol/api) in 1.4. But that does not mean you have to update every day :smiley:

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


                                          24

                                          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