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. Battery life for Motion Sensor

Battery life for Motion Sensor

Scheduled Pinned Locked Moved Hardware
24 Posts 8 Posters 6.7k Views 8 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.
  • sundberg84S Offline
    sundberg84S Offline
    sundberg84
    Hardware Contributor
    wrote on last edited by
    #4

    And use 2xAA instead of 9v 👍

    Controller: Proxmox VM - Home Assistant
    MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
    MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
    RFLink GW - Arduino Mega + RFLink Shield, 433mhz

    P 1 Reply Last reply
    1
    • bgunnarbB bgunnarb

      Hi!
      Sorry to say, but the Arduino Nano may not be the best choice for battery operation and maybe the Motion Detector also is not the most power economic application. I guess, to start with you have not done any modification to the Nano like removing the power LED? There goes a few milliamps the whole time.

      The PIR need rather high voltage to be stable and not generate random detects. I run mine on 8V. But the Nano needs only 5V so you burn off a bit of power in the voltage regulator chip, even if the sleep current of the Nano is very low. Of course, the more detections there are, the more power is used during the day.

      The Arduino ProMini is a better choice for battery operation. Please see Battery Powering in the left-hand column on the MySensors site. There are a few tricks there to really bring down power consumption. Then again the PIR needs more than 5V so you will have to use a power booster if you use the ProMini 8 MHz version that runs on 3.3 V.

      I think sleeping for 600000 mS will only marginally improve battery economy. I went through the same ordeal as you and I run my Motion Detector on a 9 V wall-wart.

      For sensors that really work well on battery I would suggest Light, Temperature and Humidity. I have a few of these built around ProMini 8 MHz and they typically run for 9 months or more on 2 x AA reporting every 2 minutes, but if you look at the link above, people achieve much better results. But I'm happy with 9 months.:grinning:

      Best of luck and keep experimenting!

      P Offline
      P Offline
      popsyann
      wrote on last edited by
      #5

      @bgunnarb Thank you for your quick answer! I have to investigate Arduino Mini (Uno was my first choice, apparently wrong). I really need to operate those sensors for a one year period without replacing batteries, and having a wired power (5V from AC 220 does not seem to be a viable solution).
      I'll keep working on it.:+1:

      1 Reply Last reply
      0
      • hekH hek

        You should also have a look at this thread on how to modify a commonly used motion detector to run off 3v3.

        https://forum.mysensors.org/topic/1088/battery-powered-pir

        P Offline
        P Offline
        popsyann
        wrote on last edited by
        #6

        @hek Interesting but may be a bit too complicated for my knowledge level. Thanks:+1:

        1 Reply Last reply
        0
        • sundberg84S sundberg84

          And use 2xAA instead of 9v 👍

          P Offline
          P Offline
          popsyann
          wrote on last edited by
          #7

          @sundberg84 Noted. Thanks:ok_hand:

          1 Reply Last reply
          0
          • gohanG Offline
            gohanG Offline
            gohan
            Mod
            wrote on last edited by
            #8

            There are also am 312 pir sensors that work at 3.3v, but the have some blind spots. Or just buy the xiaomi gateway and motion sensors if you don't want to modify things, since making something battery friendly means removing all those components that consume energy.

            P 1 Reply Last reply
            0
            • dbemowskD Offline
              dbemowskD Offline
              dbemowsk
              wrote on last edited by
              #9

              You can also use 3 AA batteries in a configuration like this:
              0_1527203055146_56abb91d-781c-46e9-a50e-73a4cbe5046d-image.png

              I have noted values for rechargeable batteries as these have a nominal value of 1.2 volts vs 1.5 volts for an alkaline battery. The 4.5v side would be to power the PIR and the 3V side to power the pro mini.

              Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
              Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

              P 1 Reply Last reply
              0
              • gohanG gohan

                There are also am 312 pir sensors that work at 3.3v, but the have some blind spots. Or just buy the xiaomi gateway and motion sensors if you don't want to modify things, since making something battery friendly means removing all those components that consume energy.

                P Offline
                P Offline
                popsyann
                wrote on last edited by
                #10

                @gohan Thanks for the info, but I would like to build my own sensors. So i'll study the Pro Mini on 3.3V further.

                rozpruwaczR 1 Reply Last reply
                0
                • P popsyann

                  @gohan Thanks for the info, but I would like to build my own sensors. So i'll study the Pro Mini on 3.3V further.

                  rozpruwaczR Offline
                  rozpruwaczR Offline
                  rozpruwacz
                  wrote on last edited by
                  #11

                  @popsyann and get yourself a good current meter. It is almost imposible to make low power node without the current meter.

                  P 1 Reply Last reply
                  1
                  • rozpruwaczR rozpruwacz

                    @popsyann and get yourself a good current meter. It is almost imposible to make low power node without the current meter.

                    P Offline
                    P Offline
                    popsyann
                    wrote on last edited by
                    #12

                    @rozpruwacz What do you mean by "good current meter"? Can you be a bit more specific? Have some knowledge of electricity and electronics domain but that does not ring a bell to me. Thanks in advance for your answer.

                    1 Reply Last reply
                    0
                    • dbemowskD dbemowsk

                      You can also use 3 AA batteries in a configuration like this:
                      0_1527203055146_56abb91d-781c-46e9-a50e-73a4cbe5046d-image.png

                      I have noted values for rechargeable batteries as these have a nominal value of 1.2 volts vs 1.5 volts for an alkaline battery. The 4.5v side would be to power the PIR and the 3V side to power the pro mini.

                      P Offline
                      P Offline
                      popsyann
                      wrote on last edited by
                      #13

                      @dbemowsk Thank you for the info. I have made some progress and I have one sensor working on Pro Mini, with 2 x AA batteries. I am facing an issue with radio range. Apparently everything works well within close range but if I put the sensor some 8-10 meters from the gateway, I do not have accurate update of the sensor state (on-off). I though the NRF24 was able to cover such range.....

                      alexsh1A 1 Reply Last reply
                      0
                      • gohanG Offline
                        gohanG Offline
                        gohan
                        Mod
                        wrote on last edited by gohan
                        #14

                        Use a multimeter that can measure uA or build your own (there is a project on openhardware).

                        If your nrf24 are clones it is normal, also the material of your house affects range.

                        1 Reply Last reply
                        0
                        • P popsyann

                          @dbemowsk Thank you for the info. I have made some progress and I have one sensor working on Pro Mini, with 2 x AA batteries. I am facing an issue with radio range. Apparently everything works well within close range but if I put the sensor some 8-10 meters from the gateway, I do not have accurate update of the sensor state (on-off). I though the NRF24 was able to cover such range.....

                          alexsh1A Offline
                          alexsh1A Offline
                          alexsh1
                          wrote on last edited by
                          #15

                          @popsyann Poor RF issues can be a sign power issues (GW) or an indication of a low quality nrf24l01+

                          I have 3 PIRs. One of them have been working for 1.5 years on 2xAA batteries (Arduino Pro Mini modified + nrf24l01+). Some nodes are very remote from the gateway.

                          P 1 Reply Last reply
                          0
                          • alexsh1A alexsh1

                            @popsyann Poor RF issues can be a sign power issues (GW) or an indication of a low quality nrf24l01+

                            I have 3 PIRs. One of them have been working for 1.5 years on 2xAA batteries (Arduino Pro Mini modified + nrf24l01+). Some nodes are very remote from the gateway.

                            P Offline
                            P Offline
                            popsyann
                            wrote on last edited by
                            #16

                            @alexsh1 Hi, maybe you can help me with the following:

                            I have built motion sensors with Arduino mini 3.3V and they have been working well, integrated in Home Assistant. However, the battery life is far from being satisfactory (I am looking for at least a year, and currently I reach a month, at most).

                            While replacing batteries, I have discovered (because the sensor was not working well after battery replacement) that the sensor component works well (3V when motion detected, 0V when no motion) when not connected to the Arduino Mini. As soon as I connect the output to pin 3 (as defined in the sketch), I get 3V when there is motion, and 1.1V when no motion (which results in no status update). Do you have any clue on what could be the reason of this 1.1V once connected (instead of 0V with no motion)?

                            Help appreciated.

                            alexsh1A bgunnarbB 2 Replies Last reply
                            0
                            • P popsyann

                              @alexsh1 Hi, maybe you can help me with the following:

                              I have built motion sensors with Arduino mini 3.3V and they have been working well, integrated in Home Assistant. However, the battery life is far from being satisfactory (I am looking for at least a year, and currently I reach a month, at most).

                              While replacing batteries, I have discovered (because the sensor was not working well after battery replacement) that the sensor component works well (3V when motion detected, 0V when no motion) when not connected to the Arduino Mini. As soon as I connect the output to pin 3 (as defined in the sketch), I get 3V when there is motion, and 1.1V when no motion (which results in no status update). Do you have any clue on what could be the reason of this 1.1V once connected (instead of 0V with no motion)?

                              Help appreciated.

                              alexsh1A Offline
                              alexsh1A Offline
                              alexsh1
                              wrote on last edited by alexsh1
                              #17

                              @popsyann you have to provide more info :

                              • did you modify arduino pro mini for batteries life?
                              • what PIRs do you have?
                              • post your sketch please
                              P 1 Reply Last reply
                              0
                              • P popsyann

                                @alexsh1 Hi, maybe you can help me with the following:

                                I have built motion sensors with Arduino mini 3.3V and they have been working well, integrated in Home Assistant. However, the battery life is far from being satisfactory (I am looking for at least a year, and currently I reach a month, at most).

                                While replacing batteries, I have discovered (because the sensor was not working well after battery replacement) that the sensor component works well (3V when motion detected, 0V when no motion) when not connected to the Arduino Mini. As soon as I connect the output to pin 3 (as defined in the sketch), I get 3V when there is motion, and 1.1V when no motion (which results in no status update). Do you have any clue on what could be the reason of this 1.1V once connected (instead of 0V with no motion)?

                                Help appreciated.

                                bgunnarbB Offline
                                bgunnarbB Offline
                                bgunnarb
                                wrote on last edited by
                                #18

                                @popsyann
                                In your sketch, please check that you have defined the input pin for the PIR pin as pinMode (PIR_PIN, INPUT) and not pinMode (PIR_PIN, INPUT_PULLUP). If you have activated the internal pullup in the arduino this will prevent the PIR from pulling the input low when there is no motion.

                                I have never been so busy since I retired!

                                1 Reply Last reply
                                0
                                • alexsh1A alexsh1

                                  @popsyann you have to provide more info :

                                  • did you modify arduino pro mini for batteries life?
                                  • what PIRs do you have?
                                  • post your sketch please
                                  P Offline
                                  P Offline
                                  popsyann
                                  wrote on last edited by
                                  #19

                                  @alexsh1

                                  Hi

                                  1. I did not modify the Arduino Pro Mini for Batteries life. What is there that I should do? Did not read anything about it.
                                  2. I use either the standard PIR Motion sensor (with two potentiometers on board the module to adjust sensitivity and timer) (Seems to be HC-SR501), or the mini version of this sensor .
                                  3. The code I use is the one given in the MySensors
                                  /**
                                   * 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_NRF5_ESB
                                  //#define MY_RADIO_RFM69
                                  //#define MY_RADIO_RFM95
                                  
                                  #include <MySensors.h>
                                  
                                  uint32_t SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
                                  #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 every two minute.
                                  	sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
                                  }
                                  
                                  
                                  1 Reply Last reply
                                  0
                                  • alexsh1A Offline
                                    alexsh1A Offline
                                    alexsh1
                                    wrote on last edited by alexsh1
                                    #20

                                    @popsyann

                                    1. https://www.mysensors.org/build/battery
                                    2. OK
                                    3. This is a standard sketch. Cannot see anything wrong.
                                    P 1 Reply Last reply
                                    0
                                    • alexsh1A alexsh1

                                      @popsyann

                                      1. https://www.mysensors.org/build/battery
                                      2. OK
                                      3. This is a standard sketch. Cannot see anything wrong.
                                      P Offline
                                      P Offline
                                      popsyann
                                      wrote on last edited by
                                      #21

                                      @alexsh1 Indeed, I saw the batteries life page but I did not want to cut into my Pro Minis (and I believe that the LED provides a good info as to the sensor is well powered).

                                      Even if I make this modification, that does not explain the 3V to 1V instead of 3V to 0V phenomenon. Does it?

                                      alexsh1A 1 Reply Last reply
                                      0
                                      • P popsyann

                                        @alexsh1 Indeed, I saw the batteries life page but I did not want to cut into my Pro Minis (and I believe that the LED provides a good info as to the sensor is well powered).

                                        Even if I make this modification, that does not explain the 3V to 1V instead of 3V to 0V phenomenon. Does it?

                                        alexsh1A Offline
                                        alexsh1A Offline
                                        alexsh1
                                        wrote on last edited by
                                        #22

                                        @popsyann I de-soldered power LEDs and power regulators. You do not need them for battery powered nodes and this is reversible. Otherwise you wont get low uA.
                                        This is about power.

                                        Talking about voltage - did you measure it? How do you know if goes to 1V?
                                        Did you double-triple check all wires and everything is correct?

                                        FYG - HR-SR501 has to be modified as well for 3.3V (remove regulator)
                                        http://www.instructables.com/id/Convert-a-5v-PIR-Motion-Sensor-to-33v-for-ESP8266/

                                        P 1 Reply Last reply
                                        0
                                        • alexsh1A alexsh1

                                          @popsyann I de-soldered power LEDs and power regulators. You do not need them for battery powered nodes and this is reversible. Otherwise you wont get low uA.
                                          This is about power.

                                          Talking about voltage - did you measure it? How do you know if goes to 1V?
                                          Did you double-triple check all wires and everything is correct?

                                          FYG - HR-SR501 has to be modified as well for 3.3V (remove regulator)
                                          http://www.instructables.com/id/Convert-a-5v-PIR-Motion-Sensor-to-33v-for-ESP8266/

                                          P Offline
                                          P Offline
                                          popsyann
                                          wrote on last edited by
                                          #23

                                          @alexsh1 Noted for the de-soldering info. I get it.

                                          For voltage measurements, yes I did measure the voltage between the ground and the output pin of the motion sensor: when the pin is not connected to Arduino, I get 3V when motion is detected and 0V when no motion.
                                          Then I connect the output pin of the PIR to the Arduino (pin 3) and I measure on Arduino pin 3: I get 3V when motion is detected and 1.2V when no motion.
                                          As for the modification of the PIR: noted. But I mainly use the mini PIR, where such modification cannot be applied (as the circuitry is very different and very simple).

                                          For the cabling: when I load on the Arduino the Serial Gateway sketch, everything works well, the Gateway starts properly, meaning the radio is well connected.

                                          When I load the motion sensor sketch, it start properly, finding the right "parent" and immediately after this, there is a flow of info going out of the Arduino+sensor, sending 0s or 1s, constantly (like if there was an issue with the interrupt process).

                                          And what I do not understand is that this (these) sensor(s) has(have) been working well for a while.

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


                                          33

                                          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