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. Development
  3. How do I use the interrupt

How do I use the interrupt

Scheduled Pinned Locked Moved Development
21 Posts 6 Posters 14.7k 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.
  • bjornhallbergB bjornhallberg

    While you guys are at it, can you also confirm that the PIR module does indeed work as intended on 3.3V input like this guy claims:
    http://techgurka.blogspot.se/2013/05/cheap-pyroelectric-infrared-pir-motion.html
    There are a couple of different revisions of the HC-SR501 through so not all of them have actual pins for for H/L selection. Some just have small solder pads.

    Bypassing the regulator, and eventually removing it would solve a lot of problems for battery sensors. But as noted, it should probably output 3.3V when HIGH regardless so no need to worry.

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

    @bjornhallberg thanks for the hint! The 5v supply kept me from battery powering it.
    I seem to have the same sensor as in the article.
    I'll setup some test and also measure the current the sensor consumes to get an estimation of battery life.
    To be continued....

    http://yveaux.blogspot.nl

    1 Reply Last reply
    0
    • marceltrapmanM Offline
      marceltrapmanM Offline
      marceltrapman
      Mod
      wrote on last edited by
      #13

      Here it is.

      The HC-sr501 seems to work with 3.3v (have not tested it with 3v though).

      With 5v the output pin generates about 500mv low and 3.5v high.
      With 3.3v the output pint generates about 390mv low and a little under 3v high.

      Nice I think...

      Fulltime Servoy Developer
      Parttime Moderator MySensors board

      I use Domoticz as controller for Z-Wave and MySensors (previously Indigo and OpenHAB).
      I have a FABtotum to print cases.

      1 Reply Last reply
      0
      • YveauxY Offline
        YveauxY Offline
        Yveaux
        Mod
        wrote on last edited by Yveaux
        #14

        Tested HC-SR501 with 2xAA Alkaline (2.86V) still works OK.

        Measured power usage with uCurrent & Scope (2.86V, 7133-1 voltage converter bypassed):

        upload-75f69108-ac9f-4819-af43-1cdb9bbdd0c9

        Blue = current in micro-Amps., Red = detection output
        So sleeping current is roughly 60uA (171uW), peak current is 212uA.
        Probably this will improve by disconnecting the 7133-1 voltage converter.
        Update: Repeated measurement with 7133-1 completely removed from PCB -- Makes no difference, so there's no need to remove it.

        Given the example battery-life calculation from MySensors (http://www.mysensors.org/build/battery) you could run this sensor (alone!) from a battery for roughly 16months!

        Same chart for 4.73V supply (7133-1 voltage converter used):
        upload-c3fa3a5b-3986-443b-a33f-8fc4fb034e6b

        Blue = current in micro-Amps., Red = detection output
        So sleeping current is roughly 66uA (312uW), peak current is 272uA.

        http://yveaux.blogspot.nl

        marceltrapmanM YveauxY 2 Replies Last reply
        1
        • YveauxY Yveaux

          Tested HC-SR501 with 2xAA Alkaline (2.86V) still works OK.

          Measured power usage with uCurrent & Scope (2.86V, 7133-1 voltage converter bypassed):

          upload-75f69108-ac9f-4819-af43-1cdb9bbdd0c9

          Blue = current in micro-Amps., Red = detection output
          So sleeping current is roughly 60uA (171uW), peak current is 212uA.
          Probably this will improve by disconnecting the 7133-1 voltage converter.
          Update: Repeated measurement with 7133-1 completely removed from PCB -- Makes no difference, so there's no need to remove it.

          Given the example battery-life calculation from MySensors (http://www.mysensors.org/build/battery) you could run this sensor (alone!) from a battery for roughly 16months!

          Same chart for 4.73V supply (7133-1 voltage converter used):
          upload-c3fa3a5b-3986-443b-a33f-8fc4fb034e6b

          Blue = current in micro-Amps., Red = detection output
          So sleeping current is roughly 66uA (312uW), peak current is 272uA.

          marceltrapmanM Offline
          marceltrapmanM Offline
          marceltrapman
          Mod
          wrote on last edited by
          #15

          @Yveaux Nice, have not yet tested the other sensor though.

          Fulltime Servoy Developer
          Parttime Moderator MySensors board

          I use Domoticz as controller for Z-Wave and MySensors (previously Indigo and OpenHAB).
          I have a FABtotum to print cases.

          marceltrapmanM 1 Reply Last reply
          0
          • marceltrapmanM marceltrapman

            @Yveaux Nice, have not yet tested the other sensor though.

            marceltrapmanM Offline
            marceltrapmanM Offline
            marceltrapman
            Mod
            wrote on last edited by
            #16

            Got it working, changed the sketch a little though.

            I wanted 2 things:

            1. No reporting of status when there is no change
            2. 4 minutes real sleep before the next update when motion was detected

            Work like a charm :)

            Thank you guys!!!

            void loop() {     
              // Read digital motion value
              boolean motion = digitalRead( DIGITAL_INPUT_SENSOR ) == LOW; 
            
              // Send debug output to serial monitor
              mprintln(PSTR("Motion sensor %s"), motion ? "ON" : "OFF" );
            
              if (lastMotion != motion) {
                lastMotion = motion;
            
                // Send motion value to sensor
                gw.send( msg.set( motion ? "1" : "0" ) );
              
                if (motion) {
                  gw.sleep( SLEEP_TIME );
                }
              }
              
              gw.sleep( INTERRUPT, CHANGE, SLEEP_TIME );
            }
            

            Fulltime Servoy Developer
            Parttime Moderator MySensors board

            I use Domoticz as controller for Z-Wave and MySensors (previously Indigo and OpenHAB).
            I have a FABtotum to print cases.

            YveauxY 1 Reply Last reply
            0
            • marceltrapmanM marceltrapman

              Got it working, changed the sketch a little though.

              I wanted 2 things:

              1. No reporting of status when there is no change
              2. 4 minutes real sleep before the next update when motion was detected

              Work like a charm :)

              Thank you guys!!!

              void loop() {     
                // Read digital motion value
                boolean motion = digitalRead( DIGITAL_INPUT_SENSOR ) == LOW; 
              
                // Send debug output to serial monitor
                mprintln(PSTR("Motion sensor %s"), motion ? "ON" : "OFF" );
              
                if (lastMotion != motion) {
                  lastMotion = motion;
              
                  // Send motion value to sensor
                  gw.send( msg.set( motion ? "1" : "0" ) );
                
                  if (motion) {
                    gw.sleep( SLEEP_TIME );
                  }
                }
                
                gw.sleep( INTERRUPT, CHANGE, SLEEP_TIME );
              }
              
              YveauxY Offline
              YveauxY Offline
              Yveaux
              Mod
              wrote on last edited by
              #17

              @marceltrapman Great you managed to get it working!
              Just wondering about one thing:

              boolean motion = digitalRead( DIGITAL_INPUT_SENSOR ) == LOW; 
              

              This suggests motion is detected when input pin is LOW, while I clearly see it rise when motion is detected...
              Where's the catch?

              http://yveaux.blogspot.nl

              1 Reply Last reply
              0
              • marceltrapmanM Offline
                marceltrapmanM Offline
                marceltrapman
                Mod
                wrote on last edited by
                #18

                @Yveaux said:

                Where's the catch?

                Because I was testing 2 different types of motion sensors I decided (for now) against the HC-SR501.
                I was just being lazy and did not want to bother with checking/setting the timeout and sensibility on the sensor itself.
                The other one behaves correct with this test and not when I set it to HIGH.
                And behaviour is consistent...

                Fulltime Servoy Developer
                Parttime Moderator MySensors board

                I use Domoticz as controller for Z-Wave and MySensors (previously Indigo and OpenHAB).
                I have a FABtotum to print cases.

                1 Reply Last reply
                0
                • YveauxY Yveaux

                  Tested HC-SR501 with 2xAA Alkaline (2.86V) still works OK.

                  Measured power usage with uCurrent & Scope (2.86V, 7133-1 voltage converter bypassed):

                  upload-75f69108-ac9f-4819-af43-1cdb9bbdd0c9

                  Blue = current in micro-Amps., Red = detection output
                  So sleeping current is roughly 60uA (171uW), peak current is 212uA.
                  Probably this will improve by disconnecting the 7133-1 voltage converter.
                  Update: Repeated measurement with 7133-1 completely removed from PCB -- Makes no difference, so there's no need to remove it.

                  Given the example battery-life calculation from MySensors (http://www.mysensors.org/build/battery) you could run this sensor (alone!) from a battery for roughly 16months!

                  Same chart for 4.73V supply (7133-1 voltage converter used):
                  upload-c3fa3a5b-3986-443b-a33f-8fc4fb034e6b

                  Blue = current in micro-Amps., Red = detection output
                  So sleeping current is roughly 66uA (312uW), peak current is 272uA.

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

                  @Yveaux Update: Repeated measurement with 7133-1 completely removed from PCB @ 3v3 -- Makes no difference, so there's no need to remove it.

                  http://yveaux.blogspot.nl

                  Z 1 Reply Last reply
                  0
                  • YveauxY Yveaux

                    @Yveaux Update: Repeated measurement with 7133-1 completely removed from PCB @ 3v3 -- Makes no difference, so there's no need to remove it.

                    Z Offline
                    Z Offline
                    Zeph
                    Hero Member
                    wrote on last edited by Zeph
                    #20

                    @Yveaux said:

                    @Yveaux Update: Repeated measurement with 7133-1 completely removed from PCB @ 3v3 -- Makes no difference, so there's no need to remove it.

                    Let me be sure I understand. You are comparing feeding battery power to the 3.3v circuit of the motion detector, with and without the 7133-1 connected, right? (When the 7133-1 is connected, you are feeding power to its output), right?

                    EDIT - It was a dumb question, followed the link to read that the regulator has a 1.7v dropout, so obviously you are not going thru it!

                    Some regulators don't like being fed power to their output and waste current, but apparently this one doesn't care, which is handy.

                    1 Reply Last reply
                    0
                    • bjornhallbergB bjornhallberg

                      While you guys are at it, can you also confirm that the PIR module does indeed work as intended on 3.3V input like this guy claims:
                      http://techgurka.blogspot.se/2013/05/cheap-pyroelectric-infrared-pir-motion.html
                      There are a couple of different revisions of the HC-SR501 through so not all of them have actual pins for for H/L selection. Some just have small solder pads.

                      Bypassing the regulator, and eventually removing it would solve a lot of problems for battery sensors. But as noted, it should probably output 3.3V when HIGH regardless so no need to worry.

                      SparkmanS Offline
                      SparkmanS Offline
                      Sparkman
                      Hero Member
                      wrote on last edited by
                      #21

                      While you guys are at it, can you also confirm that the PIR module does indeed work as intended on 3.3V input like this guy claims:
                      http://techgurka.blogspot.se/2013/05/cheap-pyroelectric-infrared-pir-motion.html
                      There are a couple of different revisions of the HC-SR501 through so not all of them have actual pins for for H/L selection. Some just have small solder pads.

                      Hi all, does anyone know of an eBay listing that actually ships the HC-SR501 with the pins for H/L selection? I bought some of these: http://www.ebay.com/itm/310574919531, which shows the pins in the pictures and the description mentions being able to select H/L with a jumper, but the ones that arrived don't actually have the pins and have the solder pads instead.

                      Thanks
                      Al

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


                      11

                      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