How to get longest battery life



  • I have created myself a motion sensor node using one of these:
    motion sensor
    Here is the sketch I have currently uploaded to it. This is basically the example sketch from the MySensors site.

    /**
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     *******************************
     *
     * REVISION HISTORY
     * Version 1.0 - Henrik Ekblad
     * 
     * DESCRIPTION
     * Motion Sensor example using HC-SR501 
     * http://www.mysensors.org/build/motion
     *
     */
    
    // Enable debug prints
    // #define MY_DEBUG
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    #include <MySensors.h>
    #include <SPI.h>
    
    unsigned long SLEEP_TIME = 60000 * 15; // Sleep time between reports (in milliseconds) 60000 is 1 minute x number of minutes
    #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
    #define CHILD_ID 1   // Id of the sensor child
    
    // Initialize motion message
    MyMessage msg(CHILD_ID, V_TRIPPED);
    
    void setup()  
    {  
      pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
    }
    
    void presentation()  {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Motion Sensor", "1.0");
    
      // Register all sensors to gw (they will be created as child devices)
      present(CHILD_ID, S_MOTION);
    }
    
    void loop()     
    {     
      // Read digital motion value
      bool tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH;
    
      //Serial.println(tripped);
      send(msg.set(tripped?"1":"0"));  // Send tripped value to gw 
    
      // Sleep until interrupt comes in on motion sensor. Send update defined by SLEEP_TIME.
      sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
    }
    

    Previously I had the SLEEP_TIME to the standard 120000 which was 2 minutes, and the battery only lasted a few days. I have changed the SLEEP_TIME to 15 minutes in hopes to increase battery life. I have had the sensor running for 2 days now and it is still running strong.

    The hardware I am running is a 5 volt pro mini on an easy newbie PCB. One thing I haven't done yet which I will do on the next test is to remove the red power LED from the nano. I am guessing that that will improve the battery life quite a bit too. My question though is, would I get significantly better battery life switching to a 3.3 volt pro mini? Currently I only have 5 volt versions in my arsenal of parts, so I would have to order some. I will not order them though unless I can confirm that they will significantly prolong battery life on sensors such as these. Can anyone tell me approximately how long a 9 volt should last under ideal conditions?

    EDIT:
    One other thing, Can anyone recommend a good project case for this type of sensor? I am thinking of putting a few of these around the house for occupancy sensing if I can get the battery to last long enough.


  • Hero Member

    Why do you need SLEEP_TIME to wake up your node at all? Is not the interrupt from motion enough to get you what you need from this node?

    My understanding is that you get the most significant improvement in battery life if you remove the on-board voltage regulator and LED from the Pro Mini.


  • Hardware Contributor

    There is also several posts about how to use the motion detector with low power as well.
    No links, but search and you will find!



  • @korttoma I suppose I don't need the SLEEP_TIME, but whoever built the sample sketch had included it. If I am not going to use SLEEP_TIME then I need to research how to use an interrupt to call a function. I see they use one in the sleep() call in the sample sketch. I would have thought too that having the send call in the main loop, that it would constantly sen.

    send(msg.set(tripped?"1":"0"));  // Send tripped value to gw
    

    But when I tested with the Serial.println(tripped); it only seemed to do the print when the motion sensor changed state. I would have thought that you would put the send in the interrupt method call.

    @sundberg84 will running it at 3.3 volts give significant battery life improvement?


  • Hardware Contributor

    @dbemowsk - Yes.
    Running pro mini + motion at 5v is doing it harder than necessary.


  • Admin

    @dbemowsk

    running at lower voltages, and using a lower oscillator frequency, causes the cpu to use less power.

    So yes, running without regulators (the PIR sensor can also run at 3V, if I remember right), and run it at 3v3 instead of 5V. and set the oscillator in your atmega to 8Mhz (or 1Mhz), it will require reprogramming of the fuses though, to switch operating frequency.

    Also use a battery closer to the operating frequency, so you don't have to waste energy in lowering the voltage to the operating voltage of your circuitry.

    Another thing, 9V batteries doesn't have that high a capacity, ordinary alkaline have only 500mAh, while 1.5V AA alkaline batteries have 1800-2600mAh. (according to this and this)


  • Hero Member

    @dbemowsk

    Rather than re-invent the wheel, why don't you just build a PIR project that has already been optimized for battery life? Example: https://www.openhardware.io/view/75/MyMultisensors



  • Here you find a sketch including battery report which I found best. Works also with your PIR I think. For a advanced sketch you can ckeck this.

    I use an arduino pro mini 3.3V with 2 AA batteries at 8 MHZ CPU speed.

    Most important is to remove the voltage regulator on the PIR and supply it directly with 3V. My battery lasts over month with this combination.

    There are different solutions for this. Most powersaving is to remove the regulator.
    The solution n the picture above has the advantage that the electrolytic capacitor downright is still in use. The additional blue capacitor 100nF is optional, should serve as noise filter.
    PIR modification



  • @sundberg84 and @tbowmo, What you are saying makes sense. If I remove the regulators though, how do I get to a stable 3.3v for the nano and the radio. Do I need to get some of the battery boosters? I heard those are prone to a lot of noise that can interfere with the radio. If I need them, what are the best capacitors to filter the noise?

    Are you saying that I can remove the regulator from a 5V pro mini to run it at 3.3v? How do I reprogram the fuses to switch the operating frequency? Might just be easier to get some 3.3v pro minis that are already set up to run at that freq.

    Standard 1.5v alkaline batteries are 1.5v which when 2 are used only brings the voltage to 3v, not the 3.3 needed for the nano. Can the nano run at lower than 3.3v? I know the nRF24 radios can run down to I think 1.9v.

    @NeverDie That looks like a nice project, but it mentions that it runs with a RFM69CW radio. My setup uses nRF24L01 radios. It does say that an nRF24 version is coming soon, but not there yet apparently.

    @heizelmann The first project you linked to uses a different PIR motion sensor than the ones that I have. You mention that the PIRs that I have are equipped with a regulator that I did not know about. I am assuming that you are talking about the diode circled on the right in your pic. I am guessing that that is a zener diode doing the regulation. Also, what type of capacitor is that?


  • Hardware Contributor

    @dbemowsk
    yes nrf24 version of my board is not released yet. Release-able..soon 😉

    I'm not really expert with this PIR module, I have some though, but it uses a bit too much power for goals i had.
    You could for instance run your 328P mcu with Internal RC 8Mhz through a 3V vcc.

    That said, about :

    • why 3.3v use less power than 5v. regarding frequency etc..
    • why Nano is 5V 16Mhz whereas mini pro is 3V 8Mhz
    • the interruptions mechanism
    • some tips etc...

    You'll find lots of infos here https://www.gammon.com.au/forum/?id=11497 .
    with the well known curve 328P Speed vs Voltage.
    0_1481115728938_Atmega_Speed_Vs_Voltage_11497.png

    I hope this helps 😉



  • @dbemowsk The picture shows the modified PIR. The right circle shows the place where the diode was. It is also removed and the contacts are bridged by soldering. The regulator was on position marked with the left circle. it is removed and the two upper contacts are bridged. The adde blue capacitor is contected from this point ( now 3.3V) input to the lower pad which is Ground. It is a 100nF ceramic capacitor.



  • @dbemosk
    Look for a datasheet for the PIR e.g.here.
    In the diagram you can find the regulator IC1 on the topright as well as the diode D1 below of it.


  • Hero Member

    @Heizelmann
    How much current does it draw after your suggested modifications are made?



  • @NeverDie My Multimeter is not very good, but I tried to measure the total current. I got 3 values: 0.03mA when sleeping, 0.16mA when PIR triggered and about 18mA when RF is sending. Last is very short an cannot measured with my digital multimeter directly. I measured this value on startup the node when the registration process is longer and I guess it is a similar value when sending.


  • Hero Member

    Here's some additional background that explains some of the "why" behind Heizelmann's approach: http://techgurka.blogspot.com/2013/05/cheap-pyroelectric-infrared-pir-motion.html

    In practice, how beneficial is the 100nf capacitor? Have you noticed whether it makes any difference, or is it there just for good measure?



  • @Never Thanks for this additional link.
    The solution described there is very common, I saw it on some places. The advantage is that no modification of the board is necessary but the disadvantage is that the regulator is still in place and might draw some current back from the 3.3V supply. I prefer to remove unused parts.

    I had no problems without the 100nf capacitor. It was only a preventive measure.


  • Admin

    @dbemowsk

    with propper fuses set, the atmega328p can run down to 1.8V, so you do not need 3v3 to run either radio, or the atmega on your arduino board. The PIR might be another story, I haven't looked at the datasheets for that one..

    As an example of boards without regulators, you could take a look at the sensebender micro, which is designed to run without regulators at all. I have had 4 sensors running of 2xAA batteries for more than 18 months, they report 66% battery left now..


  • Hero Member

    If it could be done cheaply enough, maybe this would be a good use-case for energy harvesting. If the energy harvesting were expensive, though, then it would be cheaper to just use a more energy efficient PIR. So far I've been quite surprised at just how expensive the best energy harvesting chips seem to be.



  • Thanks everyone for the great input. It helps a lot in understanding all of this.

    @Heizelmann , Is is really necessary to remove the diode when removing the regulator? Seems like it would give some protection from reverse voltage/current. Does removing it save that much power? I see now that the spot for the regulator is right under the blue cap in your pic.

    @tbowmo , I see you mentioned reprogramming the arduino's fuses to switch the operating frequency. Does this require flashing a new reconfigured bootloader or something? I just ordered some 3.3v pro mini boards and some 2 x AA battery holders, so I will try some of this when those arrive.


  • Admin

    @dbemowsk

    Reprogramming, of fuses is probably needed for low voltage operation, if they have set BOD fuses for 2.5V, then the atmega will not operate under that voltage. Also clock selection is set by programming the fuses. This can be done with another arduino acting as an ISP device.

    A diode has a voltage drop across it, so if a diode has 0.5V, and the atmega / radio can work at 1.8V, then the battery voltage needs to be above 2.3V (1.8V operating voltage + diode drop voltage). This means that you can not utilize the full battery life, if you have the diode in the circuit for reverse polarization protection. That is probably why the diode have been removed from the PIR sensor.



  • @tbowmo A diode typically has a 0.7v drop. The diode that I am talking about is the one on the PIR sensor. The specs for the PIR say that the working voltage is DC 4.5-20V, but I am sure that they are basing that on the fact that it has a 3.3v regulator on it and don't really give the specs for if the regulator (and diode) are removed. I guess I will just have to hook up my bench supply and do some testing to see how low the voltage can get before it stops functioning with the regulator and diode removed.


  • Admin

    @dbemowsk

    the voltage drop across a diode varies with the technology.. Schottky diodes only have 0.2V drop, while germanium has 0.3V, and silicon has 0.7V.

    the 0.5V was just an example.. But the message was, that you have to take the diode drop into account, if you have it inline with the supply, as a reverse polarity protection.. In my example (with 0.5V diode drop) then if you supply your circuit with 2V, then the circuitry after the diode will get 1.5V, which is below the 1.8V minimum operating voltage.

    And by removing the diode on the PIR sensor (if it's in the supply line), you can achieve a lower operating voltage.



  • Here are some measured values (not very precise):

    The unmodified HC-SR50: Supply 5.0V, Standby 0.05mA, Tripped: 0.19mA

    Regulator and diode removed: Supply 3.0V, Standby 0.03mA, Tripped 0.15mA
    Regulator and diode removed: Supply 2.4V, Standby 0.02mA, Tripped 0.11mA

    Below 2.4 V the Sensor doesn't work reliable.
    The voltage drop of the diode depends on the current and is minimum 0.5V.
    So if you would like to operate with 3 AA-Batteries it is recommended to remove/shortcut the diode.


  • Hardware Contributor

    @dbemowsk for an ultra low drop voltage, a ridiculous drop voltage, and regarding reverse polarity protection, at the node level, i would use a P mosfet, a lot better than a diode even a schottky, for low power nodes..
    i do this for my nodes, works well 😉

    Simple: connect GND to your Gate, VBAT to your Source and your 3VCC to the Drain.
    When batt is well connected, VBAT normally flows. But when reversed, you have no GND connected to your board.

    You can think this acting like a resistor then, so with a low Rdson for your mosfet, and U=R.I, you can easily calc this micro volt drop voltage !
    About the power consumption of this, it's also ridiculous, as this power consumption does matter in low power "sleep" mode, in uA, power loss is negligeable.

    Enjoy 🙂

    about the min voltage of this PIR module, if i remember the onboard controller ic is given for 3v min. lucky it can go to 2.4v.


  • Hero Member

    Here's a really good youtube video which elucidates what scalz just said:
    How to protect circuits from reversed voltage polarity! – 06:46
    — Afrotechmods

    @scalz Any suggestions as to which p-channel mosfet to pick? Have you any favorites or found any that stand out as just generally better than all the rest at these lower voltages and currents?



  • So I thought since the PIRs that I have say for the chip that the voltage minimum is 3 volts. If I am going to make sensors that run on 2 AA batteries, once the voltage drops a bit the PIR will be useless, thus decreasing the usable battery life for that sensor even though the pro mini and the radio will run at a significantly lower voltage. What about using something like this to step up the voltage just for the PIR, but leaving the radio and arduino directly connected to the battery? This one will work down to 0.8 volts.
    Step up booster 1
    Or this one which works down to 1.8 volts which is about what the drop off point of the radio and pro mini is. Step up booster 2
    I figure the current draw from the PIR would be low enough at 65ma tripped, and a quiscent current of 50ua for the second step up module (can't find quiscent current for the first one) that it shouldn't be too much of a drain on the battery, correct?


  • Hero Member

    Heizelman says (above) that the sensor works on voltages down to 2.4v. So, use two 1.5v lithium batteries. They have a flatter discharge curve than alkaline batteries.


  • Hardware Contributor

    @dbemowsk you don't want to use a step up/step down to run a pir, these generate a lot of noise and can be trouble for radio transmission. With a PIR which is much more sensible it is not a viable option. The only thing you can use to change voltage is a voltage regulator which is less efficient when you have a big voltage drop, but will reduce noise instead of increasing it.
    But the best option is I think as NeverDie says, use 2AA with lithium technology, the voltage will stay high enough to run the PIR for most of the capacity of the batteries.

    I just made a test with 2 nimh AAA and the SR501 runs reliably at 2.7V after removing diode and regulator, but my measurements are higher:

    • 36µA in idle mode
    • 190µA when triggered.

    I did a test with another one, from another supplier (it had different diode an regulator).

    • 51µA in idle mode
    • 130µA when triggered.

    Too high for battery power imho 😞



  • @NeverDie Being that the specs say 3v at the low end, makes me wonder how reliable it is down at 2.4v. That is 0.6v lower than it's rating.



  • @Nca78
    Take a battery lifetimecalculator, e.g. like this
    and you will see that battery life time is sufficient. In my opinion more than 1 year is enough.


  • Hardware Contributor

    the more lifetime, the less maintenance 🙂

    @NeverDie
    That's the beauty of mosfets, and Pmosfets 🙂
    i have not really a favorite for this, actually i use what i have at hand. That can be Vishay's (i've multiple ref like si2323 for instance), or cheap ali CJ2305 also work ok etc.


  • Hardware Contributor

    @Heizelmann said:

    @Nca78
    Take a battery lifetimecalculator, e.g. like this
    and you will see that battery life time is sufficient. In my opinion more than 1 year is enough.

    I like to use CR2032 batteries 😛
    And when you use the calculator, you have to adapt the really available capacity to stay over a minimum voltage that will keep the sensor running reliably. If sensors can go down to 2.5 - 2.4V and still run reliably with enough range and sensibility, then with some agressive power management yes you can probably survive about one year with 2AAA.

    @NeverDie said:

    If it could be done cheaply enough, maybe this would be a good use-case for energy harvesting. If the energy harvesting were expensive, though, then it would be cheaper to just use a more energy efficient PIR. So far I've been quite surprised at just how expensive the best energy harvesting chips seem to be.

    I will give it a try "the cheap way" 🙂
    5.5V solar panel, small lipo taken from a 2$ mp3 player and CN3063 to manage the charge.
    I will need good lighting to be able to charge but I can put the panel in the corner of a window and wires to the sensor at the corner of the window/ceiling which is a good position for a PIR.


  • Hero Member

    @Nca78 said:

    I will give it a try "the cheap way" 🙂
    5.5V solar panel, small lipo taken from a 2$ mp3 player and CN3063 to manage the charge.

    just make sure you share your results 😉


  • Hardware Contributor

    @korttoma said:

    just make sure you share your results 😉

    I will of course, but at the moment it's a bit early I just prepared 2 PIRs, 2 panels and soldered CN3063 and MCP73831 on adapter boards. I will compare the two, CN3063 is supposed to be better at this task but you never know...0_1481285235823_IMAG1109_1.jpg



  • What about using 2 of these in parallel? That would give 5200 mAh at 3.7v
    Lithium ion rechargeable


  • Hardware Contributor

    @dbemowsk I would put only one. Capacity is already very good and you won't gain battery life by using 2 cells as they self-discharge in around one year...
    And if you buy those, just throw away the charger. It's made with very low quality charging ICs that might destroy the batteries...


  • Hero Member

    @dbemowsk said:

    What about using 2 of these in parallel? That would give 5200 mAh at 3.7v
    Lithium ion rechargeable

    It seems to defeat the purpose of buying a $1 PIR if it takes $16 to make it work in your use case. For instance, the last time I checked, you could buy a really nice, small, highly integrated Panasonic PIR with about 1ua standby current for around $19.

    Of course, it hardly matters either way if you're making just one. But if you want to make a lot of them (and I don't know that you do), maybe it becomes a consideration.


  • Hero Member

    @dbemowsk said:

    So I thought since the PIRs that I have say for the chip that the voltage minimum is 3 volts. If I am going to make sensors that run on 2 AA batteries, once the voltage drops a bit the PIR will be useless, thus decreasing the usable battery life for that sensor even though the pro mini and the radio will run at a significantly lower voltage. What about using something like this to step up the voltage just for the PIR, but leaving the radio and arduino directly connected to the battery? This one will work down to 0.8 volts.
    Step up booster 1
    Or this one which works down to 1.8 volts which is about what the drop off point of the radio and pro mini is. Step up booster 2
    I figure the current draw from the PIR would be low enough at 65ma tripped, and a quiscent current of 50ua for the second step up module (can't find quiscent current for the first one) that it shouldn't be too much of a drain on the battery, correct?

    Anyhow, to answer your question, I have a hunch those voltage converters would drain your battery even faster for a number of reasons:

    1. Inefficiency introduced by the up-converter itself. Purely guessing, but it might be only 30-60% efficient at converting lower voltages and currents.
    2. It takes a lot more low voltage current to produce a higher voltage current. Ultimately, your battery is limited by the amount of mah in it, and so those higher currents will drain it faster.
    3. The quiescent current you already mentioned.

    #3 could be managed by using a storage capacitor and running the up-converter only intermittently, as needed, to recharge the capacitor. For instance, you could use a voltage detector to decide when to turn it on (for instance, maybe http://www.digikey.com/product-detail/en/rohm-semiconductor/BD49K25G-TL/BD49K25G-TLCT-ND/3693402 , which itself draws less than 1ua of current while monitoring the voltage). However, I don't see an easy way around #1 and #2, except maybe this: run on battery power only (i.e. no boosting) until your batteries are down to around 2.4-2.5v, and only then turn on your booster circuit. That would, in fact, give you at least some extra run-time versus just giving up and replacing the batteries after they became drained down to 2.4-2-5v. You might also want to boost to a lower voltage than 3.3v, as that would mitigate #2.

    Maybe others here also have suggestions on how you might approach it.



  • @NeverDie I was just using that link as an example. Here is a 10 pack for $9.99 US. That's $1 per battery. And, these boast that they can supply 5800 mAh. Not sure if I believe that, but even if it could source half of that, it should last a while. Also, being rechargeable I wouldn't have to keep buying batteries.


  • Hero Member

    I'd wadger there's 0.0000% chance of them being 5400mah. The best that I'm aware of are the one's made by panasonic, and those are reputedly 3400mah.


  • Hardware Contributor

    @dbemowsk you won't get nearly as the half of that with those cheap cells. I've seen some on Aliexpress boasting 9600mAh and in the end user comments pointed to capacity around 1000mAh...
    I can buy some cheap ones in local electronic market here in Vietnam, the cheapest are 1.5$ and only 1200mAh. If you want genuine 3400mAh it's around 8$...
    I would buy from Aliexpress with good seller and lot of comments so you can have some feedback on the real capacity of the batteries.


  • Hero Member

    Let's put this in perspective: according to Wikipedia ( https://en.wikipedia.org/wiki/D_battery), an Energizer Alkaline D-cell battery has 20,000mah at a 25ma draw, which is obviously far higher than the average current draw of the modified PIR. Also in the D-cell's favor is that it has comparatively low self discharge as well as little risk of spontaneously bursting into flames....

    So, you'd definitely get at least 2 years, and probably 3+ years from a pair of D-cells. Maybe a lot more years than that even. Good enough? Those are just some lower bound numbers, but even so, that sounds like a winner to me. 😄 By all means, though, use a sharper pencil and see what you figure it at. Of course, it will be a larger physical package than if you were running from a coin cell, but for the low cost, simplicity of construction, and long battery life, it seems like a worthwhile trade-off to me. 😀

    Wow. I really didn't expect anything worthwhile to come from this thread, but now I'm glad I stuck with it. 😃



  • @NeverDie said:

    Wow. I really didn't expect anything worthwhile to come from this thread, but now I'm glad I stuck with it.

    I agree, I am really glad I posed the question.


  • Hero Member

    Looking at the costco price for D-cell batteries (http://www.costco.com/Duracell-D-Alkaline-Batteries-14-Unit%2C-2%2B-Pack-Pricing.product.100322549.html), two D-cells would cost just over $1 plus tax.

    So, rough BOM:
    $1 for batteries
    $1 for PIR
    $1(?) for battery holder
    $4 for atmega328p+RFM69HW mote (maybe $2 for an nrf24L01 mote)

    Total: around $6 to $8

    At that price you could afford lots of them, which would also offer a way to correct for possible false positives.


Log in to reply
 

Suggested Topics

  • 3
  • 2
  • 8
  • 1
  • 6

44
Online

11.4k
Users

11.1k
Topics

112.7k
Posts