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. 💬 Motion Sensor

💬 Motion Sensor

Scheduled Pinned Locked Moved Announcements
63 Posts 30 Posters 29.3k Views 31 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 Offline
    gohanG Offline
    gohan
    Mod
    wrote on last edited by
    #54

    Since it is a powered node, you don't need to put it to sleep. As for the pir you can do as you like: check pin status during loop, use an attach interrupt function on pin change, etc

    M 1 Reply Last reply
    0
    • gohanG gohan

      Since it is a powered node, you don't need to put it to sleep. As for the pir you can do as you like: check pin status during loop, use an attach interrupt function on pin change, etc

      M Offline
      M Offline
      MCF
      wrote on last edited by
      #55

      @gohan ok thank you for answering. if i do this:

      void loop() 
      {
        // Read digital motion value
          bool tripped = digitalRead(DIGITAL_INPUT_SENSOR)== HIGH;
          
          Serial.println("coucou");
          Serial.println(tripped);
          send(msg.set(tripped?"1":"0"));  // Send tripped value to gw
          }
          // Sleep until interrupt comes in on motion sensor. Send update every two minute.
          //sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
      }
      

      the node never stop to send message to the gateway. i would like to send something only if D1 goes to high, is that possible ? (i'm starting combinating exemple and i want to understand what i do now!!)

      1 Reply Last reply
      0
      • wesW Offline
        wesW Offline
        wes
        wrote on last edited by
        #56

        @siod The HC-SR501 actually runs on 3.3VDC but has a 5VDC-3.3VDC regulator on board.

        There are several ways to bypass this regulator, but the easiest is to connect your 3.3VDC supply to pin 3 of JP3 (the one marked "H").

        You must make sure that your 3.3VDC supply is very stable, otherwise you will get false activations.

        See:
        https://randomnerdtutorials.com/modifying-cheap-pir-motion-sensor-to-work-at-3-3v/
        https://www.youtube.com/watch?v=5jhTQAV-hg0
        https://www.mpja.com/download/31227sc.pdf

        Blog: https://www.wes.id.au/
        Nodes: Arduino Pro Mini ATMega328P 3.3V 8MHz, RFM69 433MHz, Canton Power CE024 0.8-3.3V regulator & single AA battery
        Gateway & Controller: Raspberry Pi 3 + Home Assistant

        1 Reply Last reply
        1
        • joaoabsJ Offline
          joaoabsJ Offline
          joaoabs
          wrote on last edited by
          #57

          Hi,

          The code

          sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME); 
          

          doesn't need a ISR (Interrupt Service Routine) function? Should we assume that if no ISR is defined, the node will wake in the loop function?

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

            Yes, it will wake and run the loop once

            1 Reply Last reply
            0
            • P Offline
              P Offline
              patrikr76
              wrote on last edited by
              #59

              So i was testing out the motionsensor sketch and it kept giving me "!TSF:MSG:SEND" after the initial 0 had been sent.

              Finding no answers on here i tested loads of things until i tried a delay after the sleep command.
              Running fine now with a 5msec delay.

              Just thought i would share.

              B 1 Reply Last reply
              0
              • M Offline
                M Offline
                mitsured
                wrote on last edited by
                #60

                I connected a 12v DC input and no matter what I do the output always shows 12V. It never goes to a "low" 0V output. From what I read these can use between a 5v and 20v input so I'm assuming a 12v input should not be an issue and still produce a High when triggered and Low 0V when not triggered output. What am I doing wrong?

                1 Reply Last reply
                0
                • P patrikr76

                  So i was testing out the motionsensor sketch and it kept giving me "!TSF:MSG:SEND" after the initial 0 had been sent.

                  Finding no answers on here i tested loads of things until i tried a delay after the sleep command.
                  Running fine now with a 5msec delay.

                  Just thought i would share.

                  B Offline
                  B Offline
                  bereska
                  wrote on last edited by
                  #61

                  @patrikr76 thank you so much. I had the same issue with my motion sensor and spent 2 days pulling my hair out)

                  1 Reply Last reply
                  1
                  • E Offline
                    E Offline
                    etlizzie
                    wrote on last edited by
                    #62

                    Was anyone able to reduce the delay time? 5 seconds is too long for me.

                    1 Reply Last reply
                    0
                    • E Offline
                      E Offline
                      EileenWen
                      Banned
                      wrote on last edited by
                      #63
                      This post is deleted!
                      1 Reply Last reply
                      0

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      14

                      Online

                      12.0k

                      Users

                      11.2k

                      Topics

                      113.4k

                      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