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. Low Power: How much current? [Solved]

Low Power: How much current? [Solved]

Scheduled Pinned Locked Moved Hardware
109 Posts 10 Posters 68.6k Views 11 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.
  • B Offline
    B Offline
    brolly759
    wrote on last edited by brolly759
    #69

    Running Arduino+NRF24l01 w/ interrupt consuming 1.5uA in sleep

    I am using this Arduino Nano Pro 8mhz 3.3v :link text
    I am using this NRF chip: link text

    Here is my test environment:

    • Arduino Nano with desoldered jumper for bypassing voltage regulation (If you dont have bypass jumper on the knock off Nano, look at this post: link text )
    • NRF connected via pinout on MySensors guide
    • 3V direct supply from 2 AA Batteries
    • uCurrent Gold testing voltage current
    • Fluke 179 reading in mV
    • Using the BinarySwitchSensor sketch in the MySensors library

    If I upload the sketch as is with the recommended setup guide, Pin 2 or 3 is an interrupt pin and that goes to GND and acts as a switch. Pin 2/3 is HIGH and uses the internal pull up resistor. We will refer to the 2 different states of the switch as follows:

    "oState" (Open, when Pin 2/3 does NOT touch GND)
    "cState" (Closed, when Pin 2/3 touches GND)

    When running everything I get these sleep numbers:
    oState: 23-24uA
    cState: 117uA

    I downgraded my Arduino IDE from 1.6.5 to 1.0.6 and here are my new numbers:
    oState: 2.5-2.7uA
    cState: 98-100uA

    Everything is looking good but my cState is still too high for any battery applications that I am trying to get.

    Removed digitalWrite on pin 2/3. Connected 10M resistor from pin 2 to VCC. GND is switch to pin 2.
    oState: 2.5-2.7uA
    cState: 3.1-3.2uA

    Reference measurements:

    At this point I ran the "DallasTemperatureSensor" to test current using the WDT, I did NOT connect Temp sensor
    Sleep current with WDT enabled @ 30 seconds: 7.6-7.8uA

    Using "BinarySwitchSensor", remove NRF completely and only have Arduino:
    Sleep current: 110-120nA OR .4-.5uA (had issues reading this but I believe it is the nA)

    Connecting VCC/GND only to NRF to read standalone current:
    NRF only: 800-900nA Shutdown current

    Useless numbers while running the BinarySwitchSleepSensor sketch:
    Sleep current: 2.7-2.9uA with NRF/Arduino fully connected
    Sleep current with nRF GND disconnected: 1.7uA
    Sleep current with nRF VCC and GND disconnected: 294nA
    Sleep current with nRF VCC/GND/Pin9 disconnected: 281nA
    Sleep current with nRF VCC/GND/P9/P10 disconnected: 196nA
    Sleep current with nRF VCC/GND/P9/P10/P11/P12/P13 disconnected: 110-112nA
    Sleep mode with ONLY Arduino: 110-112nA
    NRF plugged into VCC/GND only: 800-900nA

    At this point we are getting 2.7-2.9uA with Arduino/NRF. Stock MySensors library and Arduino 1.0.6 IDE. ( I am using the BinarySwitchSleep Sketch from MySensors lib)

    To get even lower power....

    Open up mysensors.cpp with NotePad++ application
    Look for this code:

    bool MySensor::sleep(uint8_t interrupt, uint8_t mode, unsigned long ms) {
        // Let serial prints finish (debug, log etc)
        bool pinTriggeredWakeup = true;
        Serial.flush();
        RF24::powerDown();
        attachInterrupt(interrupt, wakeUp, mode);
        if (ms>0) {
            pinIntTrigger = 0;
            sleep(ms);
            if (0 == pinIntTrigger) {
                pinTriggeredWakeup = false;
            }
        } else {
            Serial.flush();     
            LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
        }
        detachInterrupt(interrupt);
        return pinTriggeredWakeup;
    }
    

    We are going to add this code:

    SPI.end();  
        for (byte i = 9; i <= 13; i++)
        {
        pinMode (i, OUTPUT);    
        digitalWrite (i, LOW); 
        }  // end of for loop
    

    The final code should look like this:

    bool MySensor::sleep(uint8_t interrupt, uint8_t mode, unsigned long ms) {
        // Let serial prints finish (debug, log etc)
        bool pinTriggeredWakeup = true;
        Serial.flush();
        RF24::powerDown();
        attachInterrupt(interrupt, wakeUp, mode);
        
        SPI.end();
        
        for (byte i = 9; i <= 13; i++)
        {
        pinMode (i, OUTPUT);    
        digitalWrite (i, LOW); 
        }  // end of for loop
    
        if (ms>0) {
            pinIntTrigger = 0;
            sleep(ms);
            if (0 == pinIntTrigger) {
                pinTriggeredWakeup = false;
            }
        } else {
            Serial.flush();     
            LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
        }
        detachInterrupt(interrupt);
        return pinTriggeredWakeup;
    }
    

    IMPORTANT: Because you are ending SPI, you will need to call the sensor at the beginning of your loop to reinitialize the NRF

    void loop() 
    {  
      sensor_node.begin();
    

    Adding both SPI.end(); and for(); loop:
    Sleep current: 1.5uA

    If you add just the SPI.end();
    Sleep current: 2uA

    If you just add the for(); loop:
    Sleep current: 1.9uA - 2.2uA

    • If you are using ONLY the "for(); loop", you do NOT need to reinitialize the radio when you come out of sleep. I have noticed a much longer up time when having to reinitialize.

    OTHER MEASUREMENTS using the DallasTemperatureSensor with WDT at 30 seconds, no sensor connected:

    Edited Sleep with for(); loop:
    Sleep current: 6.4-6.5uA

    Edited Sleep with for(); loop AND SPI.end();:
    Sleep current: (Could not get SPI.end(); to work on sleep(w/WDT))

    Quick comment: There are a few sleep options in the MySensors.cpp Depending on which one you are calling will depend on which one you need to edit. Here are some examples of the sleep functions in the .cpp file:

    void MySensor::sleep(unsigned long ms)
    
    bool MySensor::sleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
    
    int8_t MySensor::sleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2, unsigned long ms)
    
    NeverDieN 1 Reply Last reply
    0
    • B brolly759

      Running Arduino+NRF24l01 w/ interrupt consuming 1.5uA in sleep

      I am using this Arduino Nano Pro 8mhz 3.3v :link text
      I am using this NRF chip: link text

      Here is my test environment:

      • Arduino Nano with desoldered jumper for bypassing voltage regulation (If you dont have bypass jumper on the knock off Nano, look at this post: link text )
      • NRF connected via pinout on MySensors guide
      • 3V direct supply from 2 AA Batteries
      • uCurrent Gold testing voltage current
      • Fluke 179 reading in mV
      • Using the BinarySwitchSensor sketch in the MySensors library

      If I upload the sketch as is with the recommended setup guide, Pin 2 or 3 is an interrupt pin and that goes to GND and acts as a switch. Pin 2/3 is HIGH and uses the internal pull up resistor. We will refer to the 2 different states of the switch as follows:

      "oState" (Open, when Pin 2/3 does NOT touch GND)
      "cState" (Closed, when Pin 2/3 touches GND)

      When running everything I get these sleep numbers:
      oState: 23-24uA
      cState: 117uA

      I downgraded my Arduino IDE from 1.6.5 to 1.0.6 and here are my new numbers:
      oState: 2.5-2.7uA
      cState: 98-100uA

      Everything is looking good but my cState is still too high for any battery applications that I am trying to get.

      Removed digitalWrite on pin 2/3. Connected 10M resistor from pin 2 to VCC. GND is switch to pin 2.
      oState: 2.5-2.7uA
      cState: 3.1-3.2uA

      Reference measurements:

      At this point I ran the "DallasTemperatureSensor" to test current using the WDT, I did NOT connect Temp sensor
      Sleep current with WDT enabled @ 30 seconds: 7.6-7.8uA

      Using "BinarySwitchSensor", remove NRF completely and only have Arduino:
      Sleep current: 110-120nA OR .4-.5uA (had issues reading this but I believe it is the nA)

      Connecting VCC/GND only to NRF to read standalone current:
      NRF only: 800-900nA Shutdown current

      Useless numbers while running the BinarySwitchSleepSensor sketch:
      Sleep current: 2.7-2.9uA with NRF/Arduino fully connected
      Sleep current with nRF GND disconnected: 1.7uA
      Sleep current with nRF VCC and GND disconnected: 294nA
      Sleep current with nRF VCC/GND/Pin9 disconnected: 281nA
      Sleep current with nRF VCC/GND/P9/P10 disconnected: 196nA
      Sleep current with nRF VCC/GND/P9/P10/P11/P12/P13 disconnected: 110-112nA
      Sleep mode with ONLY Arduino: 110-112nA
      NRF plugged into VCC/GND only: 800-900nA

      At this point we are getting 2.7-2.9uA with Arduino/NRF. Stock MySensors library and Arduino 1.0.6 IDE. ( I am using the BinarySwitchSleep Sketch from MySensors lib)

      To get even lower power....

      Open up mysensors.cpp with NotePad++ application
      Look for this code:

      bool MySensor::sleep(uint8_t interrupt, uint8_t mode, unsigned long ms) {
          // Let serial prints finish (debug, log etc)
          bool pinTriggeredWakeup = true;
          Serial.flush();
          RF24::powerDown();
          attachInterrupt(interrupt, wakeUp, mode);
          if (ms>0) {
              pinIntTrigger = 0;
              sleep(ms);
              if (0 == pinIntTrigger) {
                  pinTriggeredWakeup = false;
              }
          } else {
              Serial.flush();     
              LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
          }
          detachInterrupt(interrupt);
          return pinTriggeredWakeup;
      }
      

      We are going to add this code:

      SPI.end();  
          for (byte i = 9; i <= 13; i++)
          {
          pinMode (i, OUTPUT);    
          digitalWrite (i, LOW); 
          }  // end of for loop
      

      The final code should look like this:

      bool MySensor::sleep(uint8_t interrupt, uint8_t mode, unsigned long ms) {
          // Let serial prints finish (debug, log etc)
          bool pinTriggeredWakeup = true;
          Serial.flush();
          RF24::powerDown();
          attachInterrupt(interrupt, wakeUp, mode);
          
          SPI.end();
          
          for (byte i = 9; i <= 13; i++)
          {
          pinMode (i, OUTPUT);    
          digitalWrite (i, LOW); 
          }  // end of for loop
      
          if (ms>0) {
              pinIntTrigger = 0;
              sleep(ms);
              if (0 == pinIntTrigger) {
                  pinTriggeredWakeup = false;
              }
          } else {
              Serial.flush();     
              LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
          }
          detachInterrupt(interrupt);
          return pinTriggeredWakeup;
      }
      

      IMPORTANT: Because you are ending SPI, you will need to call the sensor at the beginning of your loop to reinitialize the NRF

      void loop() 
      {  
        sensor_node.begin();
      

      Adding both SPI.end(); and for(); loop:
      Sleep current: 1.5uA

      If you add just the SPI.end();
      Sleep current: 2uA

      If you just add the for(); loop:
      Sleep current: 1.9uA - 2.2uA

      • If you are using ONLY the "for(); loop", you do NOT need to reinitialize the radio when you come out of sleep. I have noticed a much longer up time when having to reinitialize.

      OTHER MEASUREMENTS using the DallasTemperatureSensor with WDT at 30 seconds, no sensor connected:

      Edited Sleep with for(); loop:
      Sleep current: 6.4-6.5uA

      Edited Sleep with for(); loop AND SPI.end();:
      Sleep current: (Could not get SPI.end(); to work on sleep(w/WDT))

      Quick comment: There are a few sleep options in the MySensors.cpp Depending on which one you are calling will depend on which one you need to edit. Here are some examples of the sleep functions in the .cpp file:

      void MySensor::sleep(unsigned long ms)
      
      bool MySensor::sleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
      
      int8_t MySensor::sleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2, unsigned long ms)
      
      NeverDieN Offline
      NeverDieN Offline
      NeverDie
      Hero Member
      wrote on last edited by NeverDie
      #70

      @brolly759 said:

      When running everything I get these sleep numbers:
      oState: 23-24uA
      cState: 117uA

      I downgraded my Arduino IDE from 1.6.5 to 1.0.6 and here are my new numbers:
      oState: 2.5-2.7uA
      cState: 98-100uA

      Nice write-up!

      Is it known why there's a difference in the measurements depending on whether you're using IDE 1.6.5 or IDE 1.0.6? Which IDE version should I use?

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

        Someone else complained about the exact same issue here:
        http://forum.mysensors.org/topic/1345/sensebender-micro/250

        1 Reply Last reply
        0
        • SparkmanS Offline
          SparkmanS Offline
          Sparkman
          Hero Member
          wrote on last edited by Sparkman
          #72

          @brolly759 That's a different issue altogether. It's related to measuring battery voltage...

          Cheers
          Al

          B 1 Reply Last reply
          0
          • SparkmanS Sparkman

            @brolly759 That's a different issue altogether. It's related to measuring battery voltage...

            Cheers
            Al

            B Offline
            B Offline
            brolly759
            wrote on last edited by
            #73

            @Sparkman said:

            @brolly759 That's a different issue altogether. It's related to measuring battery voltage...

            Cheers
            Al

            tlund posted 2 months ago reply quote 0
            @tbowmo

            My NRF's are the same $1 nrf's listed in the mysensors store, so probably fake. But I have still measured them to draw ~900nA in powerDown.

            But I think I have found the culprint now. It seems the extra 20uA is caused by Arduino 1.6.5 (it may be that my installation is faulty).

            My test setup:

            pro mini
            nrf
            a simple sketch that does gw.sleep(60s)
            1st test: sketch compiled & uploaded via Arduino 1.0.5-r2: 6uA
            2nd test: sketch compiled & uploaded via Arduino 1.6.5: 24uA

            SparkmanS 1 Reply Last reply
            0
            • B brolly759

              @Sparkman said:

              @brolly759 That's a different issue altogether. It's related to measuring battery voltage...

              Cheers
              Al

              tlund posted 2 months ago reply quote 0
              @tbowmo

              My NRF's are the same $1 nrf's listed in the mysensors store, so probably fake. But I have still measured them to draw ~900nA in powerDown.

              But I think I have found the culprint now. It seems the extra 20uA is caused by Arduino 1.6.5 (it may be that my installation is faulty).

              My test setup:

              pro mini
              nrf
              a simple sketch that does gw.sleep(60s)
              1st test: sketch compiled & uploaded via Arduino 1.0.5-r2: 6uA
              2nd test: sketch compiled & uploaded via Arduino 1.6.5: 24uA

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

              @brolly759 Sorry, I was confused as your link is to post 250 in that thread, which is my post related to measuring battery voltage. What you are referencing is post 191: http://forum.mysensors.org/topic/1345/sensebender-micro/191

              Cheers
              Al

              1 Reply Last reply
              0
              • scalzS Offline
                scalzS Offline
                scalz
                Hardware Contributor
                wrote on last edited by scalz
                #75

                @Neverdie : at the beginning, as you were suspicious about the fact I get it. You can see here (look at the dates) that I had problems with low power and Charles helped me.
                It's in french sorry : https://community.hallard.me/topic/53/question-à-propos-du-bod/30
                At the same time I opened a thread on arduino forum : http://forum.arduino.cc/index.php?topic=336789.0
                Another older topic that I solved myself (which contains some part of codes I was testing) : http://forum.arduino.cc/index.php?topic=336329.0
                I hope you trust me now. and that I cannot I give a cake which is not finished cooking. I am not hurry. And I prefer the whole thing well packed in a lib, with derivative class, because the less the Mysensors libs are hacked inside, more beautiful it is I think. And then it is easier for users too.

                @brolly759 : thank you for writing you results as I have no time for this on my side. Very strange your problem with ide. When I got low power, I was using ide 1.6.0. Maybe I will try 1.6.5 this week end to see, for curiosity. And I know Charles is using 1.6.x too. Another question, is your sensor a binaryswitchsensor only?? In this case, your way makes sense. But if you want to add sensors, you won't be able to keep 1uA without mosfet I think. Maybe I am wrong and you will find a great idea...
                I follow your work, no doubt :smile:

                NeverDieN 1 Reply Last reply
                0
                • scalzS scalz

                  @Neverdie : at the beginning, as you were suspicious about the fact I get it. You can see here (look at the dates) that I had problems with low power and Charles helped me.
                  It's in french sorry : https://community.hallard.me/topic/53/question-à-propos-du-bod/30
                  At the same time I opened a thread on arduino forum : http://forum.arduino.cc/index.php?topic=336789.0
                  Another older topic that I solved myself (which contains some part of codes I was testing) : http://forum.arduino.cc/index.php?topic=336329.0
                  I hope you trust me now. and that I cannot I give a cake which is not finished cooking. I am not hurry. And I prefer the whole thing well packed in a lib, with derivative class, because the less the Mysensors libs are hacked inside, more beautiful it is I think. And then it is easier for users too.

                  @brolly759 : thank you for writing you results as I have no time for this on my side. Very strange your problem with ide. When I got low power, I was using ide 1.6.0. Maybe I will try 1.6.5 this week end to see, for curiosity. And I know Charles is using 1.6.x too. Another question, is your sensor a binaryswitchsensor only?? In this case, your way makes sense. But if you want to add sensors, you won't be able to keep 1uA without mosfet I think. Maybe I am wrong and you will find a great idea...
                  I follow your work, no doubt :smile:

                  NeverDieN Offline
                  NeverDieN Offline
                  NeverDie
                  Hero Member
                  wrote on last edited by NeverDie
                  #76

                  @scalz said:

                  @Neverdie : at the beginning, as you were suspicious about the fact I get it. You can see here (look at the dates) that I had problems with low power and Charles helped me.
                  It's in french sorry : https://community.hallard.me/topic/53/question-à-propos-du-bod/30
                  At the same time I opened a thread on arduino forum : http://forum.arduino.cc/index.php?topic=336789.0
                  Another older topic that I solved myself (which contains some part of codes I was testing) : http://forum.arduino.cc/index.php?topic=336329.0
                  I hope you trust me now. and that I cannot I give a cake which is not finished cooking. I am not hurry. And I prefer the whole thing well packed in a lib, with derivative class, because the less the Mysensors libs are hacked inside, more beautiful it is I think. And then it is easier for users too.

                  @brolly759 : thank you for writing you results as I have no time for this on my side. Very strange your problem with ide. When I got low power, I was using ide 1.6.0. Maybe I will try 1.6.5 this week end to see, for curiosity. And I know Charles is using 1.6.x too. Another question, is your sensor a binaryswitchsensor only?? In this case, your way makes sense. But if you want to add sensors, you won't be able to keep 1uA without mosfet I think. Maybe I am wrong and you will find a great idea...
                  I follow your work, no doubt :smile:

                  @Scalz Not sure what you're referring to. I've taken what you've said at face value and still do. For the moment, if you are willing and able, it would help Broly759 and me if you would replicate Brolly759's approach (as he detailed above) and see if you can figure out why the IDE version is affecting his measurements. Which measurements are "correct"? Is that something you can help us figure out?

                  It would be best if we could all use the latest version number when taking measurements, unless there is good reason not to. I'm currently running IDE Version 1.6.5., and to date I haven't had problems with it. I did have some compile-time problems with some of the earlier Version 1.6 releases prior to the 1.6.5 release, but I don't recall now exactly what those problems were.

                  1 Reply Last reply
                  0
                  • scalzS Offline
                    scalzS Offline
                    scalz
                    Hardware Contributor
                    wrote on last edited by scalz
                    #77

                    ok, I hope I will have enough time this week end because this week I have lot of work too, and Mysensors is jut fun for me. and I am running after time. It doesn't take time to reply for me, more for testings.. but I promise I will try the writeup. And I am trying to create my startup in greentech (automotive, cogeneration.. field) field. So most of my time is dedicated to my project. But I like playing too with arduino, so fun!

                    One thing I am sure, is when I got 140nA, it was BinarySwitch sketch too, from 2xaaa, ide 1.6.0. Then I added a BS250, to cut off nrf. And I got 140nA again in sleepmode. No problem, for sleep/wake up radio. And of course, I made the same tricks as Brolly in code. But maybe I had luck because I powered it through mosfet. Then I made same thing, BS250, for sensors, and uses BH1750 sketch. I had trouble with i2c. Charles helped me and then I got 140nA again. No problem with radio, sensors... All of this directly from 2xaaa. Then I played with boosters...
                    I will try brolly's case too, to see if I get same thing.
                    @brolly759 : you are using an arduin pin to power your nrf, am I right? to be in the same config as yours...

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

                      GOOD MORNING crazy tinkerer's. Okay here we go again, I am actually going to need someone to verify what I am looking at here, nA and uA are giving me different readings:

                      Running the "for(); loop" in sleep() function with NRF VCC UNPLUGGED
                      Sleep current: .8uA - .9uA OR 273nA

                      Running the "for(); loop" in sleep() function with NRF VCC UNPLUGGED
                      Sleep current: .6uA - .9uA OR 114nA

                      @scalz I was powering the NRF directly from VCC. I will play around with connecting it directly to a pinOut on Arduino

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

                        OKAY so... more numbers to play with... This is Arduino turning on/off NRF using an output pin.

                        • Connect Pin4 to VCC on NRF

                        • Add SPI.end(); and for();loop to include Pin 4 to turn LOW in sleep function

                        Add this code in define area:

                        #define WIRELESS_POWER 4
                        

                        Add this code in loop():

                        void loop() {
                          digitalWrite(WIRELESS_POWER, HIGH);
                          delay(5);  
                          sensor_node.begin();
                        

                        Sleep current oState: .5uA - .6uA
                        Sleep current cState: .8uA - .9uA

                        @scalz Yes all my testing is on "binaryswitchsensor" sketch. I use the "DallasTempSensor" sketch when I want to test sleep() with a timer. There are SO MANY things you can do with a simple reed switch sensor. Doors, locks, windows, mailbox, fridge, cabinets, drawers... pretty much anything that moves and goes back in a certain place can be used with the "binaryswitchsensor".

                        1 Reply Last reply
                        0
                        • NeverDieN Offline
                          NeverDieN Offline
                          NeverDie
                          Hero Member
                          wrote on last edited by
                          #80

                          @brolly759 When taking your measurements, were you using the current version of the MySensors library (v1.5) or a different one? Are all your other libraries the most up-to-date versions?

                          You used a Nano Pro, which I don't have. When the red Mini Pro's from Amazon arrive sometime later today, I'll try them.

                          Unless someone knows of a reason for the different results relating to different IDE versions, I think I will approach this by calling the underlying libraries directly, rather than through MySensors's abstraction layer. That way, if I don't encounter the differences, we'll know that it's a MySensors issue. For example, perhaps something you're setting is being undone by MySensors part way through the process of powering down, or something like that.

                          1 Reply Last reply
                          0
                          • scalzS Offline
                            scalzS Offline
                            scalz
                            Hardware Contributor
                            wrote on last edited by
                            #81

                            @brolly759 : I am happy for you. I was thinking that you were trying to make a sensor node (not only for binaryswitch). I agree with you for binaryswitch.. I think how you do is right for this purpose. cool. just one thing is with time, your coin cell will not provide full 3v for radio power transmission but it's another story.

                            See you soon.

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

                              @NeverDie Good catch, I just checked the version.h file. v1.4.1

                              #define LIBRARY_VERSION "1.4.1"
                              

                              In the utilities folder in MySensors library, all the files like RF24.h, LowPower.h are provided by the MySensors library. So I am assuming they were up to date when the MySensors library was created.

                              @scalz Even though its not full 3.3v it should be fine. The power range for NRF is 1.9v - 3.6v

                              My next project is to figure out battery monitoring as low as possible. ;) I know there are 2 ways, internal 1.1v reference or voltage divider. Can I do a voltage divider on an output pin and shut the output pin off when not using it?

                              1 Reply Last reply
                              0
                              • scalzS scalz

                                @brolly759 : I am happy for you. I was thinking that you were trying to make a sensor node (not only for binaryswitch). I agree with you for binaryswitch.. I think how you do is right for this purpose. cool. just one thing is with time, your coin cell will not provide full 3v for radio power transmission but it's another story.

                                See you soon.

                                NeverDieN Offline
                                NeverDieN Offline
                                NeverDie
                                Hero Member
                                wrote on last edited by
                                #83

                                @scalz said:

                                @brolly759 : I am happy for you. I was thinking that you were trying to make a sensor node (not only for binaryswitch). I agree with you for binaryswitch.. I think how you do is right for this purpose. cool. just one thing is with time, your coin cell will not provide full 3v for radio power transmission but it's another story.

                                See you soon.

                                Actually, your point regarding the coincell not providing full power could be relevant to the measurements (not saying it is in brolly759's case, but I definitely have seen it myself happen with a coincell powered arduino using the NRF24L01+): in cases where the coincell is low, doing a transmission can (because of internal resistance and the much higher current) can cause NRF voltage to drop below threshold, thereby shutting off the radio (not just sleeping it), which would obviously throw off the current measurement. Definitely something to be aware of.

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

                                  This is so frustrating, you know that?

                                  So I reseated my cables to make sure I am getting the best connection. Now my current is the last configuration is:

                                  sleep current oState: ~105nA
                                  sleep current cState: ~457nA

                                  @NeverDie my 2 AA battery setup right now are @ 3.452v

                                  NeverDieN 1 Reply Last reply
                                  0
                                  • NeverDieN Offline
                                    NeverDieN Offline
                                    NeverDie
                                    Hero Member
                                    wrote on last edited by NeverDie
                                    #85

                                    I recommend you don't use a coincell while testing. Use a big enough battery so that you won't be getting flakey results.

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

                                      @NeverDie my 2 AA battery setup right now are @ 3.452v

                                      1 Reply Last reply
                                      0
                                      • B brolly759

                                        This is so frustrating, you know that?

                                        So I reseated my cables to make sure I am getting the best connection. Now my current is the last configuration is:

                                        sleep current oState: ~105nA
                                        sleep current cState: ~457nA

                                        @NeverDie my 2 AA battery setup right now are @ 3.452v

                                        NeverDieN Offline
                                        NeverDieN Offline
                                        NeverDie
                                        Hero Member
                                        wrote on last edited by NeverDie
                                        #87

                                        @brolly759 said:

                                        This is so frustrating, you know that?

                                        So I reseated my cables to make sure I am getting the best connection. Now my current is the last configuration is:

                                        sleep current oState: ~105nA
                                        sleep current cState: ~457nA

                                        @NeverDie my 2 AA battery setup right now are @ 3.452v

                                        In a way this might be good news. Perhaps something similar was causing the difference in your earlier measurements and not the different IDE versions?

                                        I've had similar happen to me. Epecially because of plugging/un-plugging arduino's to modify programming jostles the wires or otherwise loosens connections, and then suddenly your measurements change for no apparent reason. Sometimes it can takes a while to figure out that's what's happening.

                                        The NRF24L01+ is well known to be very sensitive to loose connections--a lot more than other radios. If you can solder your connections, definitely do!

                                        In fact, it's so sensitive that even just running your supply and ground lines to the NRF close to the data lines can cause serious problems as well! Keep them as far aspart as you can. It's an unusually touchy radio.

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

                                          I just upgraded to Arduino IDE 1.6.5:

                                          Board: "Arduino Pro or Pro Mini"
                                          Processor: "Atmega328 (3.3V, 8MHz)

                                          Sleep current: 19uA.

                                          Using previous IDE I was @ 100nA.

                                          Here is the sketch I am using:

                                          #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 WIRELESS_POWER 4
                                          
                                          MySensor sensor_node;
                                          
                                          // Change to V_LIGHT if you use S_LIGHT in presentation below
                                          MyMessage msg(PRIMARY_CHILD_ID, V_TRIPPED);
                                          
                                          void setup()  
                                          {  
                                            pinMode(WIRELESS_POWER, OUTPUT);
                                            digitalWrite(WIRELESS_POWER, HIGH);  
                                            sensor_node.begin(); 
                                            pinMode(PRIMARY_BUTTON_PIN, INPUT);
                                           
                                             // 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);  
                                          }
                                          
                                          void loop() 
                                          {
                                            digitalWrite(WIRELESS_POWER, HIGH);
                                            delay(5);  
                                            sensor_node.begin();
                                              
                                            uint8_t value;
                                            static uint8_t sentValue=2;
                                          
                                            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;
                                            }
                                          
                                            sensor_node.sleep(PRIMARY_BUTTON_PIN-2, CHANGE, 0);
                                          } 
                                          
                                          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