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.
  • 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
          • scalzS Offline
            scalzS Offline
            scalz
            Hardware Contributor
            wrote on last edited by
            #89

            I hope I won't see this difference too when I will retry with 1.6.5 (I tried with 1.6.0, and it was with Mysensors 1.4). otherwise I will move to Atmel studio...

            NeverDieN 1 Reply Last reply
            0
            • scalzS scalz

              I hope I won't see this difference too when I will retry with 1.6.5 (I tried with 1.6.0, and it was with Mysensors 1.4). otherwise I will move to Atmel studio...

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

              @scalz said:

              I hope I won't see this difference too when I will retry with 1.6.5 (I tried with 1.6.0, and it was with Mysensors 1.4). otherwise I will move to Atmel studio...

              @scalz Can you retry with both IDE 1.6.5 and MySensors v1.5 fairly soon? Of course, as you've explained, I realize you have other commitments.... It just would help a lot if we're all on the same page.

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

                I am using v1.6.5. I burned the bootloader for Pro Mini, still no change.
                Sleep mode: 17.9uA

                FYI, when upgrading from v1.4 to v1.5 of MySensors lib, DO NOT overwrite all the files, Delete the folder, add the new v1.5 I had a lot of errors just now

                I switched to v1.5 with v1.6.5 and I am getting 2uA in oState now. Now I am trying to play with the new sleep settings. will give an update soon.

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

                  The new sleep library is all over the place and I cannot make heads or tails of it.

                  I am using IDE 1.6.5 and MySensors v1.5 and I am getting 2uA in sleep mode with my modified BinarySensorSwitch sketch.

                  I want to be able to shutdown the radio pin and LOW all the pins but I don't know where to add it. Anywhere I add, the radio stays high forever basically. Any idea's?

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

                    Notionally, I should think it would fit well as a subclass of the RF24's powerDown method.

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      brolly759
                      wrote on last edited by
                      #94
                      void RF24::powerDown(void)
                      {
                        ce(LOW); // Guarantee CE is low on powerDown
                        write_register(CONFIG,read_register(CONFIG) & ~_BV(PWR_UP));
                        digitalWrite(4, LOW);
                      

                      No matter where I put it... the NRF will not fall back asleep. It stays @ 4mA

                      1 Reply Last reply
                      0
                      • B brolly759

                        The new sleep library is all over the place and I cannot make heads or tails of it.

                        I am using IDE 1.6.5 and MySensors v1.5 and I am getting 2uA in sleep mode with my modified BinarySensorSwitch sketch.

                        I want to be able to shutdown the radio pin and LOW all the pins but I don't know where to add it. Anywhere I add, the radio stays high forever basically. Any idea's?

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

                        @brolly759 said:

                        I am using IDE 1.6.5 and MySensors v1.5 and I am getting 2uA in sleep mode with my modified BinarySensorSwitch sketch.

                        I want to be able to shutdown the radio pin and LOW all the pins but I don't know where to add it. Anywhere I add, the radio stays high forever basically. Any idea's?

                        Does your wiring change at all when you switch from the first scenario to the second? I'm guessing that in the first scenario you're powering the radio through vcc, but in the second you're powering it through a pin (what you're calling the "radio pin" and which you intend to set LOW in order to turn-off the NRF rather than "power down" sleep it). Is that right?

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

                          Correct, I was able to use radio pin to shut it off (pin 4) manually in v1.4 library. I cant inject the code in v1.5. If I can put the code in the sleep function somewhere, it is not easy to find anymore.

                          1 Reply Last reply
                          0
                          • hekH Offline
                            hekH Offline
                            hek
                            Admin
                            wrote on last edited by hek
                            #97

                            You'll find the radio sleep call for NRF24L01 in MyTransportNRF24.cpp.

                            https://github.com/mysensors/Arduino/blob/master/libraries/MySensors/MyTransportNRF24.cpp#L92

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

                              No idea why but every so often I have to uninstall Arduino, delete the libraries and basically start over. Getting frustrating and I might go back to 1.0.5 + v1.4 lib.

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

                                Subsequent to yesterday I ran Gammon's "Sketch J" on the very same Pro Mini that I had started this thread with (the one where I had soldered on 30 headers and which was drawing 17.2uA in the previous attempt at sleep with no watchdog timer). Instant results! Sleep current dropped to 125nA. I used a uCurrent Gold in conjunction with a Fluke 87V to take the measurement. That number is in good agreement with the 150nA reported by Gammon himself for a barebones arduino build. And, by the way, yes, I am running the current Arduino IDE 1.6.5 and the current libraries.

                                Ridiculously easy! As before, it's just 3 steps. For the third step, just use Gammon's sketch to put your Pro Mini into sleep powerDown. Easy! Don't bother with RocketScream or LowPowerLab sketch and library. Leave them out of it.

                                More good news: you already have the library Gammon's sketch uses--it's avr/sleep.h, so if you want to replicate this measurement test for yourself you won't need to download or install anything other than Gammon's sketch itself. You can find "Sketch J" here: http://www.gammon.com.au/power

                                As far as I'm concerned, this proves the Pro Mini is a perfectly viable low power platform. This particular measurement test was my due diligence before standardizing. Therefore, I'm done here.

                                Good luck to each of you on your various low power pursuits.

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

                                  @Neverdie: I am so happy for you! you know what I mean now about those easy steps. it is very strange that I had difference with lowpowerlab. I have looked at the lib and saw the part about the powerdown but I am not familiar with this syntax yet. I prefer how sketch J looks. But I was so happy when I saw this <uA, lol!
                                  but I can't wait to see Charles' ulpnode lib. He told me that it would be Mysensors compatible. it makes more sense now with new organization of Mysensors lib. great work @Hek and mysensors team! Mysensors is so fun ahahah! I am addict!

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

                                    @NeverDie I never had issues with Gammon's code on v1.6.5 . I had issues with the mysensors v1.4 library with v1.6.5 of Arduino IDE. My power problems went away when I switched to v1.5 of mysensors library. I have stopped troubleshooting for now as I am slightly burnt out but my last test on v.1.6.5 with v1.5 MySensors gave me strange results sometimes. If I edited any files in the sleep mode functions I would not be able to go back to sleep. I was draw a constant ~3mA.

                                    Congrats though and welcome to the club. I think I am going to just combine nRF Mesh + gammon's code to make my own mesh network setup. (When I actually know programming) ;)

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

                                      Does everything which is turned off in Sketch J automatically get turned on again during wake-up? Or, does it remain off? I notice that Sketch J repeats turning everything off again before going to sleep, each and every time. There are some things which I may not being using, like I2C and ADC, which it would make sense to leave turned off. Likewise, no reason to wakeup SPI on every 8 second cycle unless there's a reason to use the radio.

                                      Furthermore, it would save valuable time at higher currents not needing to turn them off again. Anyone happen to know, or will I need to run experiments?

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

                                        By the way, perhaps a good argument in favor of an external interrupt for waking up is that it could wakeup the arduico and the radio in parallel. If the arduino wakes itself up through WDT and subsequently wakes up the radio, then it has to waste time waiting at high currents while the radio wakes up.

                                        Just a thought at present, as I don't know how feasible this would be.

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

                                          In case anyone is curious as to what happens when an Arduino is waking up from sleep, this picture tells the story:

                                          NewFile3.jpg

                                          I powered an 8Mhz Pro Mini using a 5.1V battery (because it was convenient), and set it using "Sketch I" to wake up every 16ms and then immediately go back to sleep. The picture shows the Pro Mini draws about 500uA for about 2.1ms, then it surges up to about 6.5ma (I suppose at this point it is "awake"), and then voltage plummets back down again as it returns to sleep. When asleep it draws about 3.5uA. I measured the current using a 1ohm sense resistor, so in the picture 1mv=1ma. When measuring milliamps, I seem to get a much clearer picture (less noise) using a 1ohm sense resistor than I do using the UCurrent Gold.

                                          In his write-up, Gammon warns that, depending on the sleep duration, this warm-up period can be as long as 65ms!
                                          "Warning about wake-up times

                                          Various fuse settings make a big difference to the wake-up time. Some wake-up times are quite long (eg. 65 mS) because they are designed to allow the crystal clock to settle. If you are trying to save power, taking 65 mS to wake up, add 1 to a counter, and go back to sleep, is a lot. You would want to look at a "wake-up" fuse setting that is appropriate for the type of clock source you are using."
                                          I wish he had been more clear about how the sleep settings affect the length of the wake-up period. Perhaps he or somebody else explains that elsewhere.

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


                                          28

                                          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