Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. iask
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    iask

    @iask

    1
    Reputation
    8
    Posts
    870
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    iask Follow

    Best posts made by iask

    • RE: How low can arduino can go?

      @funky81 Well I am not sure what else to try to get lower than 11.5uA. If you are getting 4uA then it's possible. I will have to try your sleep method

      void sleep(){
         // disable ADC
        ADCSRA = 0;  
      
        // clear various "reset" flags
        MCUSR = 0;     
        // allow changes, disable reset
        WDTCSR = bit (WDCE) | bit (WDE);
        // set interrupt mode and an interval 
        WDTCSR = bit (WDIE) | bit (WDP3) | bit (WDP0);    // set WDIE, and 1 second delay
        wdt_reset();  // pat the dog
        
        set_sleep_mode (SLEEP_MODE_PWR_DOWN);  
        noInterrupts ();           // timed sequence follows
        sleep_enable();
       
        // turn off brown-out enable in software
        MCUCR = bit (BODS) | bit (BODSE);
        MCUCR = bit (BODS); 
        interrupts ();             // guarantees next instruction executed
        sleep_cpu ();  
        
        // cancel sleep as a precaution
        sleep_disable();
      }
      

      currently I am using

      gw.sleep(INTERRUPT,CHANGE, 0);
      
      posted in Troubleshooting
      iask
      iask

    Latest posts made by iask

    • RE: How low can arduino can go?

      @funky81 Well I am not sure what else to try to get lower than 11.5uA. If you are getting 4uA then it's possible. I will have to try your sleep method

      void sleep(){
         // disable ADC
        ADCSRA = 0;  
      
        // clear various "reset" flags
        MCUSR = 0;     
        // allow changes, disable reset
        WDTCSR = bit (WDCE) | bit (WDE);
        // set interrupt mode and an interval 
        WDTCSR = bit (WDIE) | bit (WDP3) | bit (WDP0);    // set WDIE, and 1 second delay
        wdt_reset();  // pat the dog
        
        set_sleep_mode (SLEEP_MODE_PWR_DOWN);  
        noInterrupts ();           // timed sequence follows
        sleep_enable();
       
        // turn off brown-out enable in software
        MCUCR = bit (BODS) | bit (BODSE);
        MCUCR = bit (BODS); 
        interrupts ();             // guarantees next instruction executed
        sleep_cpu ();  
        
        // cancel sleep as a precaution
        sleep_disable();
      }
      

      currently I am using

      gw.sleep(INTERRUPT,CHANGE, 0);
      
      posted in Troubleshooting
      iask
      iask
    • RE: Door Window sensor consuming more power when closed

      @AWI So here is what I got. When the sensor (Reed Switch) is open, the sensor consumes 8.5uA and when closed it consumes 11.5uA.

      • I still have the regulator on board

      • I removed both LEDS

      • I am using hardware debouncing

      • Set Analog pins LOW

      Were you able to get lower than 11.5uA, with your NRFXXXXX connected, when in sleep mode? I am trying to find a proper benchmark to work with. My sensor is powered with a 3V CR123A battery.

      I find that the CR123A is used in sensors by some alarm companies here in the US. See page 10 here (I've seen these things last a long time...3 years in some cases) so I am using this as my battery benchmark for all my sensors. Definitely not the cheepies from China.

      posted in Troubleshooting
      iask
      iask
    • RE: How low can arduino can go?

      @funky81 What power consumption did you end up with when in sleep mode with your NRFXXXXX connected? I am using the door/window sensor sample, when close it consumes 11.5 uA and when open it consumes 8.5uA (I wish that could be the other way around since the window will be closed most of the time).

      posted in Troubleshooting
      iask
      iask
    • RE: Door Window sensor consuming more power when closed

      @AWI right on! I had some time to go at this again. I realized that I had soldered the pullup on the wrong pin. Right after that my fine 898+ station stopped working. It just wont get hot. Going old school for the next few days.

      posted in Troubleshooting
      iask
      iask
    • RE: Door Window sensor consuming more power when closed

      I tried that with the code below but it doesn't work at all. It registers the first 0 status with the Gateway and then goes silent.

      // Simple binary switch example 
      // Connect button or door/window reed switch between 
      // digitial I/O pin 3 (BUTTON_PIN below) and GND.
      
      #include <MySensor.h>
      #include <SPI.h>
      //#include <Bounce2.h>
      
      
      #define CHILD_ID 3
      #define BUTTON_PIN 3  // Arduino Digital I/O pin for button/reed switch
      #define INTERRUPT BUTTON_PIN-2
      
      //const byte switchPin = 3;
      byte oldSwitchState = HIGH;  // assume switch open because of pull-up resistor
      
      
      MySensor gw;
      
      // Change to V_LIGHT if you use S_LIGHT in presentation below
      MyMessage msg(CHILD_ID,V_TRIPPED);
      
      void setup()  
      {  
          for (byte i = 0; i <= A5; i++)
          {
          pinMode (i, INPUT);
          digitalWrite (i, LOW);
          }
        
        gw.begin();
      
       // Setup the button
        pinMode(BUTTON_PIN,INPUT);
        // Activate internal pull-up
        //digitalWrite(BUTTON_PIN,LOW);
        
        // Register binary input sensor to gw (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.
        gw.present(CHILD_ID, S_DOOR);  
      }
      
      
      //  Check if digital input has changed and send in new value
      void loop() 
      {
        
        
         // see if switch is open or closed
        byte switchState = digitalRead (BUTTON_PIN);
        
         // has it changed since last time?
        if (switchState != oldSwitchState)
          {
           
             oldSwitchState =  switchState;  // remember for next time 
             
             if (switchState == LOW)
                {
                 gw.send(msg.set(0));
                } 
             else
                {
                gw.send(msg.set(1));
                }
               
               gw.sleep(INTERRUPT,CHANGE, 0); 
                 
             }  
          }
      
      posted in Troubleshooting
      iask
      iask
    • RE: Door Window sensor consuming more power when closed

      @AWI You are right about that internal pull-up. It got even worse when I added an external pull-up. I placed a 10k between pin 3 and GND (for the Door, Window example) and disabled the internal pull-up. When the reed contact is open the sensor pulls only 008.5 uA which is great! When the reed is closed it pulls a whopping 00.32 mA.

      I don't know what else to try to bring down that 00.32mA whenever the reed is closed (which will be most of the time because the window will be closed).

      I will look into hardware debouncing to see if that will be a solution for the reed switch.

      // Simple binary switch example 
      // Connect button or door/window reed switch between 
      // digitial I/O pin 3 (BUTTON_PIN below) and GND.
      
      #include <MySensor.h>
      #include <SPI.h>
      #include <Bounce2.h>
      
      
      #define CHILD_ID 3
      #define BUTTON_PIN 3  // Arduino Digital I/O pin for button/reed switch
      #define INTERRUPT BUTTON_PIN-2
      
      MySensor gw;
      Bounce debouncer = Bounce(); 
      int oldValue=-1;
      
      // Change to V_LIGHT if you use S_LIGHT in presentation below
      MyMessage msg(CHILD_ID,V_TRIPPED);
      
      void setup()  
      {  
        gw.begin();
      
       // Setup the button
        pinMode(BUTTON_PIN,INPUT);
        // deActivate internal pull-up
        digitalWrite(BUTTON_PIN,LOW);
        
        // After setting up the button, setup debouncer
        debouncer.attach(BUTTON_PIN);
        debouncer.interval(5);
        
        // Register binary input sensor to gw (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.
        gw.present(CHILD_ID, S_DOOR);  
      }
      
      
      //  Check if digital input has changed and send in new value
      void loop() 
      {
        debouncer.update();
        // Get the update value
        int value = debouncer.read();
       
        if (value != oldValue) {
           // Send in the new value
           gw.send(msg.set(value==HIGH ? 1 : 0));
           oldValue = value;
             
           //Sleep until interrupt comes in on motion sensor. Send update every two minute. 
           //gw.sleep(INTERRUPT,CHANGE, SLEEP_TIME);
            gw.sleep(INTERRUPT,CHANGE, 0);
        }
       
      } 
      
      
      posted in Troubleshooting
      iask
      iask
    • RE: Door Window sensor consuming more power when closed

      @AWI thanks for responding. I will look into the internal pull-up. I did had some doubts with the debouncer. For example, putting the line gw.sleep(INTERRUPT,CHANGE, 0); outside of the IF statement caused the sensor to randomly drop messages to the GATEWAY. I did come across a post whereby someone used a delay instead of debouncing

      // Short delay to allow buttons to properly settle
       sensor_node.sleep(5);
      posted in Troubleshooting
      iask
      iask
    • Door Window sensor consuming more power when closed

      I have a Door/Window/Switch sensor setup with a reed switch and magnet assembly. When open (magnet moved away) the device consumes 0.20mA, however, when closed the device consumes 0.97mA (uA). Is this normal?

      I modified the example to include an INTERRUPT.

      // Simple binary switch example 
      // Connect button or door/window reed switch between 
      // digitial I/O pin 3 (BUTTON_PIN below) and GND.
      
      #include <MySensor.h>
      #include <SPI.h>
      #include <Bounce2.h>
      
      #define CHILD_ID 3
      #define BUTTON_PIN 3  // Arduino Digital I/O pin for button/reed switch
      #define INTERRUPT BUTTON_PIN-2
      
      MySensor gw;
      Bounce debouncer = Bounce(); 
      int oldValue=-1;
      
      // Change to V_LIGHT if you use S_LIGHT in presentation below
      MyMessage msg(CHILD_ID,V_TRIPPED);
      
      void setup()  
      {  
        
        gw.begin();
      
       // Setup the button
        pinMode(BUTTON_PIN,INPUT);
        // Activate internal pull-up
        digitalWrite(BUTTON_PIN,HIGH);
        
        // After setting up the button, setup debouncer
        debouncer.attach(BUTTON_PIN);
        debouncer.interval(5);
        
        // Register binary input sensor to gw (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.
        gw.present(CHILD_ID, S_DOOR);  
      }
      
      
      //  Check if digital input has changed and send in new value
      void loop() 
      {
        debouncer.update();
        // Get the update value
        int value = debouncer.read();
       
        if (value != oldValue) {
           // Send in the new value
           gw.send(msg.set(value==HIGH ? 1 : 0));
           oldValue = value;
           
            gw.sleep(INTERRUPT,CHANGE, 0);
        }
       
      } ```
      posted in Troubleshooting
      iask
      iask