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. Low Power shutdown mode?

Low Power shutdown mode?

Scheduled Pinned Locked Moved Development
13 Posts 3 Posters 4.5k 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.
  • NeverDieN Offline
    NeverDieN Offline
    NeverDie
    Hero Member
    wrote on last edited by NeverDie
    #4

    Maybe I'm getting confused with the LPC810 MCU, but doesn't Arduino also support both falling and rising edge triggered interrupts? If so, couldn't you set one of those and then go back to sleep?
    c.f. http://jeelabs.org/book/1517e/

    1 Reply Last reply
    0
    • B Offline
      B Offline
      brolly759
      wrote on last edited by
      #5

      Here is information pertaining to interrupts and Arduino:
      http://playground.arduino.cc/Code/Interrupts

      Here is the code from the library:

      #include <MySensor.h>
      #include <SPI.h>
      
      #define SKETCH_NAME "Binary Sensor"
      #define SKETCH_MAJOR_VER "1"
      #define SKETCH_MINOR_VER "0"
      
      #define PRIMARY_CHILD_ID 3
      #define SECONDARY_CHILD_ID 4
      
      #define PRIMARY_BUTTON_PIN 2   // Arduino Digital I/O pin for button/reed switch
      #define SECONDARY_BUTTON_PIN 3 // Arduino Digital I/O pin for button/reed switch
      
      #if (PRIMARY_BUTTON_PIN < 2 || PRIMARY_BUTTON_PIN > 3)
      #error PRIMARY_BUTTON_PIN must be either 2 or 3 for interrupts to work
      #endif
      #if (SECONDARY_BUTTON_PIN < 2 || SECONDARY_BUTTON_PIN > 3)
      #error SECONDARY_BUTTON_PIN must be either 2 or 3 for interrupts to work
      #endif
      #if (PRIMARY_BUTTON_PIN == SECONDARY_BUTTON_PIN)
      #error PRIMARY_BUTTON_PIN and BUTTON_PIN2 cannot be the same
      #endif
      #if (PRIMARY_CHILD_ID == SECONDARY_CHILD_ID)
      #error PRIMARY_CHILD_ID and SECONDARY_CHILD_ID cannot be the same
      #endif
       
      MySensor sensor_node;
      
      // Change to V_LIGHT if you use S_LIGHT in presentation below
      MyMessage msg(PRIMARY_CHILD_ID, V_TRIPPED);
      MyMessage msg2(SECONDARY_CHILD_ID, V_TRIPPED);
      
      void setup()  
      {  
        sensor_node.begin();
      
        // Setup the buttons
        pinMode(PRIMARY_BUTTON_PIN, INPUT);
        pinMode(SECONDARY_BUTTON_PIN, INPUT);
      
        // Activate internal pull-ups
        digitalWrite(PRIMARY_BUTTON_PIN, HIGH);
        digitalWrite(SECONDARY_BUTTON_PIN, HIGH);
        
        // Send the sketch version information to the gateway and Controller
        sensor_node.sendSketchInfo(SKETCH_NAME, SKETCH_MAJOR_VER"."SKETCH_MINOR_VER);
      
        // Register binary input sensor to sensor_node (they will be created as child devices)
        // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. 
        // If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
        sensor_node.present(PRIMARY_CHILD_ID, S_DOOR);  
        sensor_node.present(SECONDARY_CHILD_ID, S_DOOR);  
      }
      
      // Loop will iterate on changes on the BUTTON_PINs
      void loop() 
      {
        uint8_t value;
        static uint8_t sentValue=2;
        static uint8_t sentValue2=2;
      
        // Short delay to allow buttons to properly settle
        sensor_node.sleep(5);
        
        value = digitalRead(PRIMARY_BUTTON_PIN);
        
        if (value != sentValue) {
           // Value has changed from last transmission, send the updated value
           sensor_node.send(msg.set(value==HIGH ? 1 : 0));
           sentValue = value;
        }
      
        value = digitalRead(SECONDARY_BUTTON_PIN);
        
        if (value != sentValue2) {
           // Value has changed from last transmission, send the updated value
           sensor_node.send(msg2.set(value==HIGH ? 1 : 0));
           sentValue2 = value;
        }
      
        // Sleep until something happens with the sensor
        sensor_node.sleep(PRIMARY_BUTTON_PIN-2, CHANGE, SECONDARY_BUTTON_PIN-2, CHANGE, 0);
      } ```
      1 Reply Last reply
      0
      • NeverDieN Offline
        NeverDieN Offline
        NeverDie
        Hero Member
        wrote on last edited by
        #6

        Yup, "They are triggered equally on RISING or FALLING signal edges..." So, it should work. :smile:

        1 Reply Last reply
        0
        • B Offline
          B Offline
          brolly759
          wrote on last edited by
          #7

          Hate to act like the idiot here but can you explain what I should do? lol

          1 Reply Last reply
          0
          • AWIA Offline
            AWIA Offline
            AWI
            Hero Member
            wrote on last edited by AWI
            #8

            The higher power with the engaged switch probably comes from the pull-up. There is a current through the switch when closed. You can increase the value to reduce consumption. If you use internally pull-up the value is between 20k and 50k which gives you around (ohms law I=U/R) I=3.3/20.000=165uA

            1 Reply Last reply
            0
            • B Offline
              B Offline
              brolly759
              wrote on last edited by
              #9

              I did increase the value of the resistance by 60K and 100K externally, both those values dropped the current consumption but my problem was that there was not enough to power to have the Arduino read that the switch was working. So I was getting nothing basically. I put the resistor in line between the switch. Even when I had that amount of Resistance used I was still drawing 34uA or greater, still above what I am trying to get.

              AWIA 1 Reply Last reply
              0
              • B brolly759

                I did increase the value of the resistance by 60K and 100K externally, both those values dropped the current consumption but my problem was that there was not enough to power to have the Arduino read that the switch was working. So I was getting nothing basically. I put the resistor in line between the switch. Even when I had that amount of Resistance used I was still drawing 34uA or greater, still above what I am trying to get.

                AWIA Offline
                AWIA Offline
                AWI
                Hero Member
                wrote on last edited by AWI
                #10

                @brolly759 you should remove /switch of the internal pull-up (digitalWrite). And conmect the external resistor from the Arduino pin to Vcc. 1 Mohm should be sufficient to drop current to the uA range.

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  brolly759
                  wrote on last edited by
                  #11

                  @AWI

                  So Pin 2 -> 1Mohm Resistor -> VCC
                  and GND is the switch to Pin 2 ?

                  Is that a minimum current the Arduino needs to read a state change?

                  1 Reply Last reply
                  0
                  • AWIA Offline
                    AWIA Offline
                    AWI
                    Hero Member
                    wrote on last edited by
                    #12

                    Yes it is. The same configuration like with the internal pull-up. digital pins

                    1 Reply Last reply
                    1
                    • B Offline
                      B Offline
                      brolly759
                      wrote on last edited by
                      #13

                      SO an update, I connected a 10Mohm Resistor and my current draw is only 3.1-3.2uA when the switch is engaged and 2.7-2.8uA when the switch is removed. I think that is really livable numbers. So far not getting any false positives which is great. :)

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


                      23

                      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