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. Troubleshooting
  3. Unknown battery drain

Unknown battery drain

Scheduled Pinned Locked Moved Troubleshooting
26 Posts 8 Posters 3.1k Views 7 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.
  • Richard van der PlasR Richard van der Plas

    2XAA gives 2.9 volts with rechargable batteries, that is not enough to power the 5v pro mini ?

    B Offline
    B Offline
    boozz
    wrote on last edited by
    #7

    @richard-van-der-plas
    get yourself a boost converter. Something like this:

    DC-DC 0.9V -> 5V
    I remove the USB connector, disable the LED's and it increases the battery voltage to 5VDC.You need an extra cap on the 5VDC output as it will otherwise compromise the working of the nrf24L01+.

    I use 5V pro-mini's as well on batteries and my NiMH batteries last at least one month, doing a somewhat similar thing as what you have in mind.
    I have to power a pressure sensor which is used to monitor the ground-water level around my house. This sensor takes slightly less power than your water sensor.

    I do agree with @mfalkvidd a 3.3V pro-mini would be better for this as you do not have to get the 5VDC down to 3.3VDC for the nrf24L01+, but the 5V version is the next best option in my opinion.

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

      Maybe you could burn an 8Mhz bootloader and use the batteries

      Nca78N 1 Reply Last reply
      1
      • gohanG gohan

        Maybe you could burn an 8Mhz bootloader and use the batteries

        Nca78N Offline
        Nca78N Offline
        Nca78
        Hardware Contributor
        wrote on last edited by
        #9

        @gohan said in Unknown battery drain:

        Maybe you could burn an 8Mhz bootloader and use the batteries

        Yes you can burn a bootloader using internal oscillator then you can run at 8 or even 1MHz, and so at a much lower voltage and 2 AA/AAA will be enough.
        Next step is to use I2C sensors that can also run at low voltage, and you're good for years of battery life :)

        1 Reply Last reply
        0
        • Richard van der PlasR Offline
          Richard van der PlasR Offline
          Richard van der Plas
          wrote on last edited by
          #10

          Gonna try something else first, got 12 V AC running through the garden wich turns on every night for a few hours, Gonna recitfy that and convert to 5 V, than use a NimH powerbank as a in between station to power the Arduino.
          That should give me enough juice for the day, as i can skip the l7805cv

          B 1 Reply Last reply
          0
          • Richard van der PlasR Richard van der Plas

            Gonna try something else first, got 12 V AC running through the garden wich turns on every night for a few hours, Gonna recitfy that and convert to 5 V, than use a NimH powerbank as a in between station to power the Arduino.
            That should give me enough juice for the day, as i can skip the l7805cv

            B Offline
            B Offline
            boozz
            wrote on last edited by
            #11

            @richard-van-der-plas

            You'd still need the 7805 after the rectifier...

            Richard van der PlasR 1 Reply Last reply
            0
            • B boozz

              @richard-van-der-plas

              You'd still need the 7805 after the rectifier...

              Richard van der PlasR Offline
              Richard van der PlasR Offline
              Richard van der Plas
              wrote on last edited by
              #12

              @boozz yeah but thats only drawing charge when the garden lights are on and charging the PowerBank, the powerbank itself runs the arduino @ 5 volt

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

                If I were you I'd go for the 3.3V arduino and a solar charger

                Richard van der PlasR 1 Reply Last reply
                0
                • gohanG gohan

                  If I were you I'd go for the 3.3V arduino and a solar charger

                  Richard van der PlasR Offline
                  Richard van der PlasR Offline
                  Richard van der Plas
                  wrote on last edited by
                  #14

                  @gohan thought of that to, but havent got any 3.3 laying around.
                  The seem more expensive than the 5v though ;(
                  the most are the atmega 168 with to little memory

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

                    you can get them at 1.5€ each on aliexpress or even cheaper if you get a 10pcs bundle

                    1 Reply Last reply
                    1
                    • tbowmoT Offline
                      tbowmoT Offline
                      tbowmo
                      Admin
                      wrote on last edited by
                      #16

                      as others have said already, go for the 3v3 nanos, a 5V nano can be converted to 3v3, by setting the fuses (with an avr-isp programmer), so it runs on the internal 8Mhz rc oscillator.

                      My Sensebender Micros (basically stripped down nano's) have been running 2.5 years now, with the same set of 2xAA batteries (have 5 running now, one of them even with an extra BMP280 for measuring barometric pressure). All of them measure temperature / humidity every minute, but only transmit when a change is detected.

                      ahmedadelhosniA 1 Reply Last reply
                      1
                      • I Offline
                        I Offline
                        iahim67
                        wrote on last edited by iahim67
                        #17

                        @Richard-van-der-Plas - you can use any Arduino Mini or Mini Pro for a battery powered sensor.
                        It does not matter much if you buy a 5V or a 3V3 Mini Pro version as you will better flash an internal 8MHz bootloader, remove the linear voltage regulator on these boards and the LED or LEDs as well. I use battery powered temperature sensors (with thermistors)since November 2017 and they still work fine -> I use 2xR6 batteries. Things you can do (like I did, after lots of reading on this forum):

                        • important! remove the LDO (the low drop output voltage regulator) equipped on the Arduinos
                        • remove the LED or LEDs
                        • flash an 8MHz internal oscillator bootloader (I read in this forum that using 1MHz internal osc. may give you occasional faults, don't know if that is still valid!) - do you know how to do that?
                        • internal 8MHz could be precise enough to work with your Dallas temperature sensors, I'm not sure without checking the datasheet
                        • an 8MHz Arduino (ATMega328P in this case) can work down to about 2V4 according to the datasheet, while the radio works down to 1V9
                        • either use 2 x R6 batteries to power both the Arduino and the radio module
                        • or use 3 xR6 batteries to power the Arduino BUT (important!) get power for the radio only from two of the R6 batteries or you'll damage it
                        • I bought battery powered Christmas lights from LIDL and Kaufland, they had very cheap Christmas lights with both 2 and 3 R6 batteries - so I just use the very convenient battery plastic housing equipped with an ON/OFF switch. Or just look for some R6 or AAA battery holders ...
                        • make sure you connect the Ground of both the Arduino and the Radio to the "-" of the battery string
                        • NiMH rechargeable batteries have a much higher self discharge rate than alkaline non rechargeable batteries, NiMH would not be a good option to me as I would have to replace them quite often, but may fit your needs:-)
                        • ATMega328P can measure its internal 1V1 reference and by doing that you can calculate the battery voltage without a resistor divider that would drain a few more uA, use this library:
                          https://forum.mysensors.org/topic/186/new-library-to-read-arduino-vcc-supply-level-without-resistors-for-battery-powered-sensor-nodes-that-do-not-use-a-voltage-regulator-but-connect-directly-to-the-batteries
                        • you can use thermistors to measure the temperature as they are very cheap and most important - you can power the thermistor from an Arduino pin by making it an OUTPUT and set it HIGH. After reading the temperature set it back to LOW and put the Arduino to sleep. You will conserve even more power this way. Hope it helps ...
                        • forgot to clarify, you are supposed to connect the "+" of the battery string to the 5V pin header on the Arduino (there are 2 such pins I think), not to the RAW pin header. 5V can be anything between 2V4 and 5V (for an 8MHz Arduino) and goes directly to the ATMega VCC pin while RAW connector goes to the input of the Linear Voltage Regulator you are supposed to remove
                        • while looking to your code I can see you have many delay() lines which means your Arduino is awake for many seconds, that's just not good enough for a battery powered sensor :-), try to remove these delays as much as possible, use different sensors that do not require delays eventually as the Arduino should be mostly sleeping. Use eventually a #define DEBUG x statement (x=1 if you like to have a serial debug output or x=0 if you don't) and only output the Serial.print when needed.Here is an example for a temperature sensor with a thermistor and 2xR6 batteries (not using here the VCC library I mentioned before but something similar):
                        // Enable debug prints to serial monitor
                        //#define MY_DEBUG
                        
                        #define MY_RADIO_NRF24
                        #define MY_NODE_ID 10
                        #define DEBUG 0
                        #define BATTERY_SENSOR 1
                        
                        #include <MySensors.h>
                        
                        #define TH1_CHILD_ID 11
                        #define VOLTAGE_CHILD_ID 12
                        #define TH_PIN 3
                        
                        int _nominal_resistor = 4700;
                        int _nominal_temperature = 25;
                        int _b_coefficient = 3950;
                        int _series_resistor = 4877;
                        int _pin = 0;
                        
                        float BatteryMin = 2.4;
                        float BatteryMax = 3.0;
                        
                        MyMessage msgTemp(TH1_CHILD_ID, V_TEMP);
                        MyMessage msgVoltage(VOLTAGE_CHILD_ID, V_VOLTAGE);
                        
                        void setup()
                        {
                          //Serial.begin(115200);
                        }
                        
                        void presentation()
                        {
                          // Send the sketch version information to the gateway and Controller
                          sendSketchInfo("TH1_Mini_2xR6", "1.0");
                          present(TH1_CHILD_ID, S_TEMP, "TH1");
                          present(VOLTAGE_CHILD_ID, S_MULTIMETER, "TH1_Batt_Voltage");
                        }
                        
                        void loop()
                        {
                          tempReport();
                          batteryReport();
                          sleep(180000);
                        }
                        
                        // Measure VCC
                        float getVcc() {
                        #ifndef MY_GATEWAY_ESP8266
                          // Measure Vcc against 1.1V Vref
                        #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
                          ADMUX = (_BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1));
                        #elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
                          ADMUX = (_BV(MUX5) | _BV(MUX0));
                        #elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
                          ADMUX = (_BV(MUX3) | _BV(MUX2));
                        #else
                          ADMUX = (_BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1));
                        #endif
                          // Vref settle
                          wait(70);
                          // Do conversion
                          ADCSRA |= _BV(ADSC);
                          while (bit_is_set(ADCSRA, ADSC)) {};
                          // return Vcc in mV
                          return (float)((1125300UL) / ADC) / 1000;
                        #else
                          return (float)0;
                        #endif
                        }
                        
                        // Send a battery level report to the controller
                        void batteryReport() {
                          // measure the board vcc
                          float volt = getVcc();
                          // calculate the percentage
                          int percentage = ((volt - BatteryMin) / (BatteryMax - BatteryMin)) * 100;
                          if (percentage > 100) percentage = 100;
                          if (percentage < 0) percentage = 0;
                        #if DEBUG == 1
                          Serial.print(F("BATT V="));
                          Serial.print(volt);
                          Serial.print(F(" P="));
                          Serial.println(percentage);
                        #endif
                        #if BATTERY_SENSOR == 1
                          // report battery voltage
                          send(msgVoltage.set(volt, 3));
                        #endif
                          // report battery level percentage
                          sendBatteryLevel(percentage);
                        }
                        
                        void tempReport()
                        {
                          // set TH pin in output mode
                          pinMode(TH_PIN, OUTPUT);
                          // set TH_PIN HIGH
                          digitalWrite(TH_PIN, HIGH);
                          wait(1);
                          // read the voltage across the thermistor
                          float adc = analogRead(_pin);
                          // set TH_PIN LOW
                          digitalWrite(TH_PIN, LOW);
                          // calculate the temperature
                          float reading = (1023 / adc)  - 1;
                          reading = _series_resistor / reading;
                          float temperature;
                          temperature = reading / _nominal_resistor;     // (R/Ro)
                          temperature = log(temperature);                  // ln(R/Ro)
                          temperature /= _b_coefficient;                   // 1/B * ln(R/Ro)
                          temperature += 1.0 / (_nominal_temperature + 273.15); // + (1/To)
                          temperature = 1.0 / temperature;                 // Invert
                          temperature -= 273.15;                         // convert to C
                        #if DEBUG == 1
                          Serial.print(F("THER I="));
                          Serial.print(TH1_CHILD_ID);
                          Serial.print(F(" V="));
                          Serial.print(adc);
                          Serial.print(F(" T="));
                          Serial.println(temperature);
                        #endif
                          send(msgTemp.set(temperature, 1));
                        }```
                        1 Reply Last reply
                        1
                        • tbowmoT tbowmo

                          as others have said already, go for the 3v3 nanos, a 5V nano can be converted to 3v3, by setting the fuses (with an avr-isp programmer), so it runs on the internal 8Mhz rc oscillator.

                          My Sensebender Micros (basically stripped down nano's) have been running 2.5 years now, with the same set of 2xAA batteries (have 5 running now, one of them even with an extra BMP280 for measuring barometric pressure). All of them measure temperature / humidity every minute, but only transmit when a change is detected.

                          ahmedadelhosniA Offline
                          ahmedadelhosniA Offline
                          ahmedadelhosni
                          wrote on last edited by ahmedadelhosni
                          #18

                          @tbowmo wow 2.5 years !! Which bootloader are you using for your sleeping node ? It is Sensebender or did you modify it ?

                          tbowmoT 1 Reply Last reply
                          0
                          • ahmedadelhosniA ahmedadelhosni

                            @tbowmo wow 2.5 years !! Which bootloader are you using for your sleeping node ? It is Sensebender or did you modify it ?

                            tbowmoT Offline
                            tbowmoT Offline
                            tbowmo
                            Admin
                            wrote on last edited by tbowmo
                            #19

                            @ahmedadelhosni

                            It's the standard dualoptiboot, that we ship with the sensebender micro. But the bootloader is not essential in this context. What is essential, is how often you power up your radio etc. for transmitting.

                            My sketch for the sensors is more or less like the standard Sensebender Micro sketch that we have on github, which wakes up the mcu once every minute, takes a measurement and compare to the value last sent to the gateway. If the deviation is greater than X then transmit the new value. Otherwise, just go to sleep for 1 more minute.

                            Every half hour or so, I do a forced transmit of the measurement values. This to make sure it will report back periodically, so the controller get's some data for graphing.

                            ahmedadelhosniA 1 Reply Last reply
                            0
                            • tbowmoT tbowmo

                              @ahmedadelhosni

                              It's the standard dualoptiboot, that we ship with the sensebender micro. But the bootloader is not essential in this context. What is essential, is how often you power up your radio etc. for transmitting.

                              My sketch for the sensors is more or less like the standard Sensebender Micro sketch that we have on github, which wakes up the mcu once every minute, takes a measurement and compare to the value last sent to the gateway. If the deviation is greater than X then transmit the new value. Otherwise, just go to sleep for 1 more minute.

                              Every half hour or so, I do a forced transmit of the measurement values. This to make sure it will report back periodically, so the controller get's some data for graphing.

                              ahmedadelhosniA Offline
                              ahmedadelhosniA Offline
                              ahmedadelhosni
                              wrote on last edited by
                              #20

                              @tbowmo Thanks for the info.

                              So here I have two questions. How do you power your node/radio ? how much days did it survive till now ?

                              gohanG 1 Reply Last reply
                              0
                              • ahmedadelhosniA ahmedadelhosni

                                @tbowmo Thanks for the info.

                                So here I have two questions. How do you power your node/radio ? how much days did it survive till now ?

                                gohanG Offline
                                gohanG Offline
                                gohan
                                Mod
                                wrote on last edited by
                                #21

                                @ahmedadelhosni If the node is using 10uA or less when sleeping, you should be expecting a battery life in the year range

                                1 Reply Last reply
                                0
                                • tbowmoT Offline
                                  tbowmoT Offline
                                  tbowmo
                                  Admin
                                  wrote on last edited by
                                  #22

                                  @ahmedadelhosni

                                  I'm powering my sensebenders (5 pcs) with 2xAA batteries, and they have been running for 2.5 years now, without changing batteries.

                                  I think that this is a pretty decent battery life for a sensor :)

                                  ahmedadelhosniA 1 Reply Last reply
                                  1
                                  • ahmedadelhosniA Offline
                                    ahmedadelhosniA Offline
                                    ahmedadelhosni
                                    wrote on last edited by
                                    #23

                                    Thanks all.

                                    Actually @tbowmo i was asking about bootloader because I have opened another thread reagrding a problem where my node stops working sometimes when i use 1 Mhz. So i was asking what would it be the problem ? And what booloader + power supply technique do people use.

                                    1 Reply Last reply
                                    0
                                    • tbowmoT tbowmo

                                      @ahmedadelhosni

                                      I'm powering my sensebenders (5 pcs) with 2xAA batteries, and they have been running for 2.5 years now, without changing batteries.

                                      I think that this is a pretty decent battery life for a sensor :)

                                      ahmedadelhosniA Offline
                                      ahmedadelhosniA Offline
                                      ahmedadelhosni
                                      wrote on last edited by
                                      #24

                                      @tbowmo are they alkaline or lithuim ?

                                      mfalkviddM 1 Reply Last reply
                                      0
                                      • ahmedadelhosniA ahmedadelhosni

                                        @tbowmo are they alkaline or lithuim ?

                                        mfalkviddM Offline
                                        mfalkviddM Offline
                                        mfalkvidd
                                        Mod
                                        wrote on last edited by
                                        #25

                                        I use alkaline. Easy to buy and cheap.

                                        1 Reply Last reply
                                        0
                                        • tbowmoT Offline
                                          tbowmoT Offline
                                          tbowmo
                                          Admin
                                          wrote on last edited by tbowmo
                                          #26

                                          @ahmedadelhosni

                                          Alkaline, cheap "IKEA" batteries.. :)

                                          My units reports around 60% battery capacity left (very unscientifically measurements)

                                          About operating frequency. If you have a sleeping node, then you won't gain anything from using 1Mhz versus 8Mhz, on the contrary you might end up using more power, when using 1Mhz, than 8Mhz. Because the time that the MCU is awake is longer at 1Mhz, than at 8Mhz. Remember, that when the MCU is sleeping, the power usage is the same, regardless of what frequency the MCU is working at, because the oscillator is shut down.

                                          at 8Mhz you would complete your operation quicker, and return to sleep mode again faster, than when running at 1Mhz.

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


                                          29

                                          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