Low Power: How much current? [Solved]



  • I am digging around and looking at the code, I think it just cycles through 8 second batches.

    We have an unsigned long, so thats 4,294,967,295 ms = 4294967.295 seconds = 71582.78825 minutes = 1193.046470833333 hours = 49.71026961805556 days.

    So IF there is not a cap on the max duration of sleep in the Mysensors library, you can theoretically go to sleep for the max duration of the unsigned long which is about 49 ish days...


  • Admin

    Actually the ATMega328 can only sleep in cycles of 8 seconds maximum:

    This is where the virtual long sleep is generated:
    https://github.com/mysensors/Arduino/blob/master/libraries/MySensors/MyHwATMega328.cpp#L124


  • Hardware Contributor

    I have some chronodots too. I thought about same thing (wake up with rtc) but I have not tested yet. And, anyway, i will stay with ulpnode. I have bought chronodots for another pcb I am working on; sort of low power Flower Power for outdoor more robust as I will do my inox ec/humidity sensors myself (I have a mini lathe at home) and with datalogging inside (so need rtc). And I will try to wake up with rtc (programmable hours).

    For Atmega328, I agree with @Hek, and you can't do what you want with watchdog. WDT is already well implemented in Lowpowerlab/MYsensors. You can't do more than 8sec cycles. It is in datasheet.
    So if you want to wake up each x min/hours or days. Best way I think is RTC. If you need smaller cycle, WDT or ulpnode power management sequence.
    I have already done your research few months ago to see if if i could do something different Charles. Unfortunately for me, I had to reproduce ulpnode sequence as he already had the good idea for this I think..it was a good exercise for me πŸ˜ƒ

    Yesterday I found this https://www.kickstarter.com/projects/flutterwireless/flutter-20-wireless-arduino-with-half-mile-1km-ran It is opensource. Well designed I think.
    Funny thing too, atsam3s1a is not bad and have rtc too.



  • @scalz said:

    Yesterday I found this https://www.kickstarter.com/projects/flutterwireless/flutter-20-wireless-arduino-with-half-mile-1km-ran It is opensource. Well designed I think.
    Funny thing too, atsam3s1a is not bad and have rtc too.

    I see they using the CC1200. I don't want to hijack this thread, but any information if they really can achive the 1000m they promise with that?


  • Hero Member

    @Oitzu said:

    @scalz said:

    Yesterday I found this https://www.kickstarter.com/projects/flutterwireless/flutter-20-wireless-arduino-with-half-mile-1km-ran It is opensource. Well designed I think.
    Funny thing too, atsam3s1a is not bad and have rtc too.

    I see they using the CC1200. I don't want to hijack this thread, but any information if they really can achive the 1000m they promise with that?

    TI did some youtube videos in Norway and South Africa showing huge outdoor range (tens of kilometers) if the conditions are ideal (line of sight, with one transmitter on a mountain, etc.). But you gotta ask yourself: why South Africa? I think probably because the noise floor is so low. It makes for a more seemingly impressive demo.

    They have very high sensitivity, which is great. I'm told much of it might be wastedl in a home environment, where the noise floor tends to be higher.



  • @NeverDie said:

    They have very high sensitivity, which is great. I'm told much of it might be wastedl in a home environment, where the noise floor tends to be higher.

    Hm.. okay. I'm asking because i'm currently trying to build an outdoor high range / low power network.
    I don't find any of these cc1200 available on the market, so i will stick to my way of testing some nrf24L01+ with high gain directional antennas. πŸ™‚


  • Hero Member

    @scalz said:

    I have some chronodots too. I thought about same thing (wake up with rtc) but I have not tested yet. And, anyway, i will stay with ulpnode. I have bought chronodots for another pcb I am working on; sort of low power Flower Power for outdoor more robust as I will do my inox ec/humidity sensors myself (I have a mini lathe at home) and with datalogging inside (so need rtc). And I will try to wake up with rtc (programmable hours).

    For Atmega328, I agree with @Hek, and you can't do what you want with watchdog. WDT is already well implemented in Lowpowerlab/MYsensors. You can't do more than 8sec cycles. It is in datasheet.
    So if you want to wake up each x min/hours or days. Best way I think is RTC. If you need smaller cycle, WDT or ulpnode power management sequence.
    I have already done your research few months ago to see if if i could do something different Charles. Unfortunately for me, I had to reproduce ulpnode sequence as he already had the good idea for this I think..it was a good exercise for me πŸ˜ƒ

    Yesterday I found this https://www.kickstarter.com/projects/flutterwireless/flutter-20-wireless-arduino-with-half-mile-1km-ran It is opensource. Well designed I think.
    Funny thing too, atsam3s1a is not bad and have rtc too.

    One of the JeeLabs articles said that with an external clock to do the wakeups, allowing WDT to be turned off, then the atmega328p sleep current (not counting the external clock) could be reduced to 100nA. At that point (and probably long before), the MCU's drain just isn't a signficant factor anymore. and other things become dominant. Things like current leaks through capacitors, then become, relatively speaking, a comparatively huge problem.

    [Edit: Found it: "With an ATmega328 powered by 3.3V, the lowest practical current consumption is about 4 Β΅A – that’s with the watchdog enabled to get us back out of sleep mode. Without the internal watchdog, i.e. if we were to rely on the RFM12B’s wake-up timer, that power-down current consumption would drop considerably – to about 0.1 Β΅A:" http://jeelabs.org/2012/06/23/low-power-uas-in-perspective/ ]


  • Hero Member

    @Oitzu said:

    @NeverDie said:

    They have very high sensitivity, which is great. I'm told much of it might be wastedl in a home environment, where the noise floor tends to be higher.

    Hm.. okay. I'm asking because i'm currently trying to build an outdoor high range / low power network.
    I don't find any of these cc1200 available on the market, so i will stick to my way of testing some nrf24L01+ with high gain directional antennas. πŸ™‚

    In that case, also keep an eye on the Sematech SX1272 and SX1276 radio chips. IIRC, they have an even bigger link budget. They're finally becoming more affordable. Or the Silicon Labs Si4463.is also geared to play in the same ISM narrowband space.


  • Hero Member

    Those radios have the potential to draw low currents. The RFM26 aspires to be one of them, but from what I gather, the libraries for it are still coming together.. I've heard comments that the SemaTech libraries are already pretty good though. So, possibly in the future, one of the above, or something similar, will get integrated with MySensors. If you live on a ranch, or maybe just a large parcel of land, perhaps they'd be quite handy. In the meantime, if you're attempting something ambitious outdoors, I'd pick the RFM69HW over the NRF24L01+. Compared to the RFM69HW, the NRF24L01+, at least without PA+LNA, is a weakling. Even then, I have some with the PA+LNA, and so far I've found them disappointing.



  • @NeverDie Thanks for the recommendations. I already ordered a pair of NRF24L01+ with PA+LNA and i planed to test some double biquad antennas on them.
    If this is not sufficient engough, maybe i should try the RFM69HW.
    The use case are multiple sensor points in a forest powered by solar power.


  • Hero Member

    @NeverDie said:

    @Sparkman said:

    @5546dug @NeverDie One thing to be cautious of is that not all Mini's use the same board configuration so the instructions may need to be altered depending on exactly with Mini you have.

    Cheers
    Al

    At the moment I'm wondering whether different Pro Mini's might consume more power than others, even if setup the same. I followed the author's directions, but I'm getting 17uA of current in power-down sleep mode (forever), not the 4.5uA that the author claims to have measured on his. Maybe it has to do with the configuration differences you're referring to? Or, I suppose it could be measurement error (either mine or the author's or both). I'm using a uCurrent Gold in conjunction with a Fluke 87V to do my measurements. The author didn't say how he did his, so I sent him an email asking for the details of how he measured.

    I am pleased though at having gotten such a gigantic reduction by following such a simple 3 step process.

    For anyone who's still curious, I heard back from the author:

    "I used the Voltcraft VC-130, Digital-Multimeter (http://www.amazon.de/gp/product/B003A5TA8U?psc=1&redirect=true&ref_=oh_aui_search_detailpage ) Datasheet: http://files.voelkner.de/1000000-1099999/001090519-da-01-en-VOLTCRAFT_VC130_1_DIGITAL_MULTIMETER.pdf "

    I'm actually not as concerned as I was earlier in the thread, now that I understand both Scalz and Brolly759 have managed to get such great results from the pro mini platform. That means at least three different people independently arrived at ultra lower current results using the Pro Mini, and I take that as good confirmation that it's possible to do with at least some of the Pro Mini offerings, such as the ones from Sparkfun or from Great Wall Electronics.



  • I'm back!!
    NeverDie, how could you butcher my username!?

    Some fun facts for everyone.

    When I am 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


  • Hardware Contributor

    Thx. Exactly near what I said. and as you have noticed you need to configure your pinmode before going to sleep (best is output=0) if you don't want to disconnect spi bus. and mosfet for radio vcc. Then you can have nA like you did. As you can see, low power is a tricky thing. great to hear it works for you too.



  • If you dont mind me asking a stupid question, how would you disable the pins going to the NRF. Wouldn't, I need to reinitialize the radio every time on wake up?


  • Hardware Contributor

    For disabling radio, I use P-Mosfet. So I cut off the power. Then in datasheet, it is explained it is best to set output=0. And you are right, when I need the radio, I have to reconfigure and reinit it. But I don't reinit all the mysensors presentation stuff, just the radio itself. But maybe I should do the presentation too.
    This is for radio with mosfet. when I use this tech, with another mosfet for sensors. i2c for example, it needs others tricks too. output=0 won't work, you need to pinmode input. and set i2c registers rightly....lots of tricks. low power I think is not an exact science which works same in all case. I could post some codes, but it is not beautiful for the moment, and all this stuff will be managed by ulpnode lib. So I am waiting...


  • Hero Member

    What kind of battery (type and configuration) or other means (supercap?) are you guys using to power your node? Over what voltage ranges? Are yo using the arduino to decide when to cut-out, or some other means? Are you running straight from the battery, or are you using a converter or regulator of some kind? Or, is it all yet to be determined?

    Even though LiPo looks like it would be a good choice (voltage ranges and energy storage and low self discharge), I don't want there to be even a remote chance of a fire starting, so I'm having to think about alternatives.

    Also, with respect to Mosfets, which ones specifically have you found that are a good match for the task at hand? Plainly it needs to have very low leakage, and I presume operates at TTL voltage?

    I haven't researched what's possible as far as low leakage Mosfets are concerned. Do they still leak, and if so how much? I'm guessing little to nothing based on your grand total for the deep sleep current, since it presumably covers everything, including mosfets. Right?

    I have some latching relays in case I ever need to turn something completely, 100% off, if it turns out Mosfets are too leaky. I haven't ever used them though.


  • Hero Member

    @Oitzu said:

    Hm.. okay. I'm asking because i'm currently trying to build an outdoor high range / low power network.
    I don't find any of these cc1200 available on the market, so i will stick to my way of testing some nrf24L01+ with high gain directional antennas. πŸ™‚

    Have you looked at these as an option: http://www.d6labs.com/Store? They are a bit pricey compared to some of the alternatives. I supported their Kickstarter campaign last year. Although the campaign was just short with reaching their goal, they proceeded with the development anyways. The modules have started to ship and I'm supposed to be getting mine in the next few weeks. Once I get them, I'll see if there's a way to integrate with MySensors.

    Cheers
    Al


  • Hardware Contributor

    As ulpnode is not released yet. I tried to reproduce how it works and get it! If you want to understand Please, I can't advise you enough to read this post on ulpnode engine management http://hallard.me/ulpnode-low-power-secret/ so you will understand. It is based on a dc booster and a voltage supervisor. This is what I am doing.
    And for my tests : 2xaaa battery so 3V. for mosfets, I tried with si2399, CJ2305 very cheap on ali. And BS250 on breadboard worked too.



  • Lets put this all in perspective. a CR2025 coin cell is 165mAh.

    If we are sleeping forever @ 6uA that means the circuit will last for: 27,500 hours or 1,145 days. The question I guess we need to figure out is what is "good enough" for coin cell applications?

    My goal is to figure out a way to sink the total circuit to around 1uA. That should be possible if Arduino is 100nA and NRF is 800-900nA.

    So why does the NRF draw so much current when connected to Arduino? I know its been touched on already but is there a cleaner way in software without adding mosfets or extra hardware to have the NRF in sleep mode but not drawing any current from Arduino?


  • Hero Member

    @brolly759 said:

    Lets put this all in perspective. a CR2025 coin cell is 165mAh.

    If we are sleeping forever @ 6uA that means the circuit will last for: 27,500 hours or 1,145 days. The question I guess we need to figure out is what is "good enough" for coin cell applications?

    My goal is to figure out a way to sink the total circuit to around 1uA. That should be possible if Arduino is 100nA and NRF is 800-900nA.

    So why does the NRF draw so much current when connected to Arduino? I know its been touched on already but is there a cleaner way in software without adding mosfets or extra hardware to have the NRF in sleep mode but not drawing any current from Arduino?

    Even if you wanted to turn the NRF completely off using just software, I don't see that it's even possible. It may require a hardware switch to pull its plug.

    Here's some brainstorming:

    According to the datasheet, NRF Powr Down state is defined as "All register values available are maintained and the SPI is kept active, enabling change of configuration and the uploading/downloading of data registers."

    You need something to keep the NRF's memory alive in the registers, unless you prefer to pay the price of a full startup cycle (which is an option).

    In theory you could lower the NRF's supply voltage to 1.9V, because that is the minimum specified in the NRF datasheet. Current might be similar, but I'm guessing that with lower voltage it would be using less energy in total?

    If so, then notionally maybe you could dial down the NRF's voltage by putting a cap across across ground and its Vcc, and then sending it just enough PWM to make the capacitor voltage hover at 1.9V? Perhaps there's a more elegant way to do it, but lowering its voltage seems like the only avenue not yet explored that might yet payoff, short of just turning it off. Unfortunately, capacitors tend to be lossy, so it might be a net loss.

    Or, if using Scalz's boost converters, maybe you could lower all voltages to the minimum 1.9V by simply not boosting them higher than that? You'd need an adjustable boost converter for that, assuming you run at a nominal 3.3V when the arduino isn't sleeping. Adjustable boost converters do exist, so I see no problem with that approach. The Atmeg328p can function even down to 1.8V, although you may need to operate it at 4Mhz if doing so (says the arduino spec sheet). If awake, would the arduino datalines still need to operate at 3.3V, or could they work just fine at 1.8-1.9v also? Important question: does awful boost conversion efficiency at such low voltages more than ruin the potential NRF energy savings from this approach, as outlined above?

    If you could turn off the NRF's SPI, and later turn it on again, without losing the registry values, that might be worth exploring also. I don't know if that's feasible though. However, the arduino's SPI is turned off, so there's nothing for the NRF's SPI to talk to anyway during the Arduino's power-down sleep, so if you could turn off the NRF's SPI too (again, it may be impossible), it would make sense to do so. Correct?

    Out of the above spitballing, the prospect of adjusting voltage to 1.91v through the boost converter to me sounds the most promising. A lot would hinge on the efficiency curves of the boost converter though. If the numbers don't support that, then maybe running the NRF's supply voltage separately at 1.91v would work?

    Maybe there's a pony in there somewhere. πŸ˜„


  • Hardware Contributor

    dc booster sequence is not my idea! It is first Charles. But these type of sequence are well explained in app notes of supervisors and dc boosters.

    In my case, I turn off nrf by mosfet . so all registers are lost I think. So I power and reinit it on wake up. and no problem of transmission, I didn't see any fails.

    for dc booster, maybe you don't understand the concept of Charles ulpnode. This is a fixed 3v dc booster with true enable. you charge a capacitor on vcc. Turn off dc booster and go to sleep. Let the capa discharge. When capa vcc is < 2V. a supervisor chip irq toggle the enable pin of dc bosster and d3 int on arduino. You have a hardware watchdog which consumes very small current. On wake up maintain enable on booster. . of course, with the capa discharge 3v to 1.8v, you will have less power consumption. but the useful thing is the hw watdchdog generated by capa. choose right capa and adapt your cycles..


  • Hero Member

    @brolly759 Is your design finished or still evolving? Are you planning to say how you did it in exacting detail, or just in general terms? At the moment I see your results (above), but at the moment I'm not sure exactly what you did, other than it involved starting with a Pro Mini, removing the Power LED, removing the power regulator, and invoking a sleep cycle. Is the following the best summation to date? http://forum.arduino.cc/index.php?topic=341958.0 If so, please let me know, and I'll give it a more careful read. On the other hand, if something else is a better summation, please let me know what that is, and I'll add it instead to the round-up.

    Yesterday I placed an order with Great Wall Electronics for 10 Arduino Pro Mini's. That may take anywhere from two to four weeks to arrive. Meanwhile, I should receive the three red Pro Mini's from Amazon (above) tomorrow. With those I plan to start with the same three steps as before and then see how the measurement numbers look. If promising, I guess I'll next proceed based on what I find in the links you and scalz provided:
    http://forum.arduino.cc/index.php?topic=341958.0
    http://www.gammon.com.au/power
    hallard.me
    jeenode
    lowpowerlab

    and see where that gets me. At the moment, those are the only guides I have that are reasonably detailed. If in addition anything else should be on that list, please let me know.



  • @NeverDie I will rewrite everything up again. The numbers I posted about was me just unplugging wires and seeing what my current draw was.... haha the link is where my dual post is located where I am talking to Gammon about this problem πŸ™‚

    @everyone So Gammon said this about our problem:

    "I am guessing you are parasitically powering the NRF. Before sleeping make sure you set the connections to it to high-impedance. For example, SPI.end() followed by making sure the SPI (and other two) pins are inputs (or maybe outputs and LOW). For example, a snippet from my code with that gadget:"

     bool ok = radio.write (&reading, sizeof reading);
      radio.startListening ();
      radio.powerDown ();
      SPI.end ();
      // set pins to OUTPUT and LOW  
      for (byte i = 9; i <= 13; i++)
        {
        pinMode (i, OUTPUT);    
        digitalWrite (i, LOW); 
        }  // end of for loop
      ADCSRA = 0;  // disable ADC
      power_all_disable();
    

    I am looking in the library to see if we do SPI.end() before sleep but cant find anything...



  • So an update, you can find all the sleep functions in the MySensor.cpp file.


  • Hardware Contributor

    yes. Gammon is right. I needed to do pinmode output=0 when I tested. I didn't do the spi.end but I think is good thing to do.
    @Neverdie: I hope and am sure you will get it!
    in the mean time I am redesigning my board with some feedbacks you gave me. thx.
    it will be 0805/atmel solderable version, no mini pro. and will be 5cmx2.3. same specs as I did on my other board. so far so good but now 4layer. only for rfm for the moment. can't do magie. but two boards on a 5cmx5cm. not expensive at elecrow... I hope I will get it finished for this week...



  • YESSSSSSSSSSSSSSS!!!!! I got sleep down to 1.5ua - 1.6uA with NO hardware changes!!!!! WOOOT sorry, kinda excited here lol


  • Hardware Contributor

    great I'm happy for you.



  • Okay, so originally I was 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.... If you open up mysensors.cpp the sleep function is there. For the BinarySwitchSleep sketch you are looking for this sleep function as there are a few:

    You want to add this:

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

    to 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);
    	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;
    }
    

    and it will 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;
    }
    

    Because you are shutting off and turning all pins low, you will need to add this to the beginning of your program loop to reinitialize the NRF:

    void loop() 
    {  
      sensor_node.begin();
    

    If you add just the SPI.end(); your current will be 2uA.
    If you add both SPI.end(); and LOW pin loop, your current will be 1.5uA



  • Some more facts here:

    If you ONLY do the for/loop to shut off PIN9-13 in the sleep function and do NOT shut off SPI... you do NOT need to reinitialize the radio on wake-up.

    The current draw for For/Loop LOW w/o shutting off SPI is 2.1uA-2.2uA.

    This is a good and bad. If you have a sensor that is going to be switched on and off a lot, the re initialization time is noticeable on a fluke meter. You can see it staying high much longer. So, if someone knows how long it takes to initialize, then we can determine if shutting off SPI is worth it. ~600nA savings vs high reconnect time.


  • Hero Member

    @brolly759 said:

    So, if someone knows how long it takes to initialize, then we can determine if shutting off SPI is worth it. ~600nA savings vs high reconnect time.

    I have an o-scope, so once I get everything set up, I can try measuring that time duration for you if you like.

    Really the comparison should be an energy comparison, which might be roughly::

    ((~600nA)(# microseconds powered-down)) vs ((arduino's current draw while powered up)(# microseconds extra setup time if NRF was turned off))



  • I have an O-scope just dont know how to use it completely lol. Leaving work now. Stayed extra 2 hours to play with power settings lol

    @NeverDie did you still need me to write up what I did or you followed it pretty much?


  • Hero Member

    @brolly759 said:

    I have an O-scope just dont know how to use it completely lol. Leaving work now. Stayed extra 2 hours to play with power settings lol

    @NeverDie did you still need me to write up what I did or you followed it pretty much?

    I'd prefer to have a nice consolidated write-up for two reasons:

    1. So I can be sure I'm following it right. If I do it differently, then any measurements I might get won't do you much good, if any. And,
    2. So others, including noobs, can follow along to both understand it as well as replicate it for themselves, because then you leverage the true power of open source. It's well proven: the mores eyes on something, the better it gets, and the more everyone benefits from the experience. For that to work, the clearer the "something" is, the better. The more details the better too.

    OK, finished editing. πŸ˜„



  • I keep watching you edit your post, its freakin me out! lol


  • Hardware Contributor

    @Neverdie @brolly759 : I will follow your progress with interest and help if I can. For the moment, I have a lot of work before playing with my uCurrent. And for respect for Charles work, I am waiting his release. But when I will receive my boards (at then end of the month), if lib is not released yet, I will clean my code. And don't forget, I am using boosters and mosfets, so it is different. but roads are crossing of course. with booster what I like is, I will have 3.3v vcc during the whole battery life too.
    Too late for me! 2am, lol. time to powerdown. See you soonπŸ˜ƒ



  • 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)
    

  • Hero Member

    @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?



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


  • Hero Member

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

    Cheers
    Al



  • @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


  • Hero Member

    @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


  • Hardware Contributor

    @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 πŸ˜„


  • Hero Member

    @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 πŸ˜„

    @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.


  • Hardware Contributor

    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...



  • 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



  • 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".


  • Hero Member

    @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.


  • Hardware Contributor

    @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.



  • @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?


  • Hero Member

    @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.



  • 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


  • Hero Member

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



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


  • Hero Member

    @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.



  • 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);
    } 
    

  • Hardware Contributor

    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...


  • Hero Member

    @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.



  • 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.



  • 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?


  • Hero Member

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



  • 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


  • Hero Member

    @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?



  • 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.


  • Admin

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

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



  • 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.


  • Hero Member

    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.


  • Hardware Contributor

    @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!



  • @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) πŸ˜‰


  • Hero Member

    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?


  • Hero Member

    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.


  • Hero Member

    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.


  • Hardware Contributor

    @Neverdie: hi. you are doing interesting tests. for the question about 65ms.. I am not sure. I think Gammon was referring about the CKSEL fuses, oscillator config fuses. it is described in datasheet from 8.2.2.



  • Hello guys,

    I'm reading your post, and that is amazing... you're fighting with u/nAmps.
    However, I'm concerned about mAmps πŸ™‚

    The lowest what I can get with Atmega328 + NRF24 on breadboard is 1mA.

    What I've done:
    Flashed Atmega328p with ATmegaBOOT_168_atmega328_pro_8MHz.hex
    Uploaded BinarySwithchSleepSensor sketch with FDTI. Tried: API 1.4/1.5, IDE 1.0.6/1.6.5 (no difference)
    Powered the sensor directly with 2xAA
    Changed ext fuses to x07 (no BOD)
    Connected NRF24 according to MySensors instructions

    On the breadboard I have only:
    Atmega328p
    NRF24
    10k resistor on 1st/reset pin.

    With this set up minimum what I can get is:
    Atmega328p w/o NRF - 3pin con - 0.1mA /not con - 3.4mA
    Atmega328p with NRF - 3pin con - 1.09mA /not con - 1mA

    I'm using cheap multi-meter, however, with Gammon's J sketch - it shows 3uA without NRF.

    I'm struggling almost a week, and can't understand, why you guys achieving such a great results while using almost the same setup (Mini 8Mhz is based on Atmega328p).

    Your ideas and suggestions are most welcome. Thank you in advance!



  • Hello @engy :

    I have approximately same results as @brolly759.
    I spent some times to reproduce due to a measurement issue but I am under uA with pull-up resistor of 10Mo.

    Can you show your sketch and your design ?

    David.



  • My problem was defected NRF24 radios. Had to order 3rd batch from ebay, and even though it contained a few defected modules.



  • @engy Hello. It's why I am using RFM69 as there is no fake πŸ™‚


Log in to reply
 

Suggested Topics

  • 87
  • 7
  • 8
  • 9
  • 1
  • 3

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts