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. Announcements
  3. 💬 Battery Powered Sensors

💬 Battery Powered Sensors

Scheduled Pinned Locked Moved Announcements
battery
347 Posts 55 Posters 67.1k Views 53 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.
  • parachutesjP parachutesj

    Hi,
    I just built the circuit which is explained in the thread with a Pro Mini 3.3 8 mHz
    So far so good, I can read the voltage of the battery etc but my problem is, it consumes about 1.2 mA while in sleep, this is about factor 10 of the findings from the thread.
    I just copied the code 1:1
    Any glue what could be wrong or what get others with that setup? The Arduino is not modified at all.

    Thanks
    SJ

    N Offline
    N Offline
    Nicklas Starkel
    wrote on last edited by
    #30

    @parachutesj you have to modify the pro mini. Remove the power led according to instructions!

    parachutesjP 1 Reply Last reply
    1
    • N Nicklas Starkel

      @parachutesj you have to modify the pro mini. Remove the power led according to instructions!

      parachutesjP Offline
      parachutesjP Offline
      parachutesj
      wrote on last edited by
      #31

      @Nicklas-Starkel thank you. If one could read...
      I read the description again and thought that it should be 120uA stock and when removing LED and regulator it will even go down further but thinking about it, how should at base 120 uA and removing LED save additional 1.5mA???? LOL, sorry was a long day.

      My Fluke reads 0.044 mA in sleep now (without LED). Sweet!

      1 Reply Last reply
      0
      • N Offline
        N Offline
        Nicklas Starkel
        wrote on last edited by
        #32

        Another battery related question that I really do not understand.
        Are there different versions on how to read battery consumption?

        I see some sketches uses:

        long readVcc() {
          long result;
          // Read 1.1V reference against AVcc
          ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
          delay(2); // Wait for Vref to settle
          noInterrupts ();
          // start the conversion
          ADCSRA |= _BV (ADSC) | _BV (ADIE);
          set_sleep_mode (SLEEP_MODE_ADC);    // sleep during sample
          interrupts ();
          sleep_mode (); 
          // reading should be done, but better make sure
          // maybe the timer interrupt fired 
          while (bit_is_set(ADCSRA,ADSC));
          result = ADCL;
          result |= ADCH<<8;
          result = 1126400L / result; // Back-calculate AVcc in mV```
        

        However some (like the original one in this thread) uses:

         int sensorValue = analogRead(BATTERY_SENSE_PIN);
        

        Is it due to different libraries or maybe it is the same but just programming wise different?

        1 Reply Last reply
        0
        • G Offline
          G Offline
          gloob
          wrote on last edited by
          #33

          If you are using the first sketch you dont have to use a seperate pin to measure the input voltage. There are also no resistors.

          You can run this on a bare ATmega with minimal hardware.

          N 1 Reply Last reply
          0
          • G gloob

            If you are using the first sketch you dont have to use a seperate pin to measure the input voltage. There are also no resistors.

            You can run this on a bare ATmega with minimal hardware.

            N Offline
            N Offline
            Nicklas Starkel
            wrote on last edited by
            #34

            @gloob thanks!
            One would think running with no resistors and not using a separate PIN would be better.

            @hek or @mfalkvidd , any comments as to why the original sketch is preferred over the other 'way' in this article?

            hekH 1 Reply Last reply
            0
            • N Nicklas Starkel

              @gloob thanks!
              One would think running with no resistors and not using a separate PIN would be better.

              @hek or @mfalkvidd , any comments as to why the original sketch is preferred over the other 'way' in this article?

              hekH Offline
              hekH Offline
              hek
              Admin
              wrote on last edited by
              #35

              @Nicklas-Starkel

              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

              N 1 Reply Last reply
              1
              • hekH hek

                @Nicklas-Starkel

                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

                N Offline
                N Offline
                Nicklas Starkel
                wrote on last edited by
                #36

                @hek , I've read that post several times :)
                Since it was so outdated (2 years) I naturally assumed the 'battery powering article' was a newer way to do it (especially since mys2.0).
                Also, the post you linked to is attributed if you use no voltage regulator.
                And in the article this is also one of the things you are recommended to remove, hence making it even more confusing as to why the article describes another way than the post.

                1 Reply Last reply
                1
                • Meshx86M Offline
                  Meshx86M Offline
                  Meshx86
                  wrote on last edited by Meshx86
                  #37

                  i just want to get this once and for all, so others coming by gets it directly instead of going through all the 2 threads posts, please correct me if i am wrong:

                  1- using the voltage divider is needed if there is a voltage regulator / booster where where VBatt != Vcc.
                  2- using the voltage regulator is not needed if the voltage regulator is removed / no booster is used (powering directly from 2 x AA batteries) where VBatt == Vcc.

                  *I've noticed the 2nd method requires inputting battrie's DMM measured values vs arduino ones for correction, is this a down side if you need to change the battery later on ? or is it just programmed once ? and does the 1st method rquirs these corrections too ?

                  Cheers

                  GertSandersG 1 Reply Last reply
                  0
                  • Meshx86M Meshx86

                    i just want to get this once and for all, so others coming by gets it directly instead of going through all the 2 threads posts, please correct me if i am wrong:

                    1- using the voltage divider is needed if there is a voltage regulator / booster where where VBatt != Vcc.
                    2- using the voltage regulator is not needed if the voltage regulator is removed / no booster is used (powering directly from 2 x AA batteries) where VBatt == Vcc.

                    *I've noticed the 2nd method requires inputting battrie's DMM measured values vs arduino ones for correction, is this a down side if you need to change the battery later on ? or is it just programmed once ? and does the 1st method rquirs these corrections too ?

                    Cheers

                    GertSandersG Offline
                    GertSandersG Offline
                    GertSanders
                    Hardware Contributor
                    wrote on last edited by
                    #38

                    @Meshx86
                    actually, you need a voltage divider if the voltage to be measured is above the maximum allowed by the processor at the speed you are running it.

                    If Vcc is 5V, then any voltage above 5V should be measured via a voltage divider.
                    If Vcc is 3.3V same principle, but you could get away with measuring 5V directly (would not kill the processor), but your values may be off.

                    Meshx86M 1 Reply Last reply
                    0
                    • GertSandersG GertSanders

                      @Meshx86
                      actually, you need a voltage divider if the voltage to be measured is above the maximum allowed by the processor at the speed you are running it.

                      If Vcc is 5V, then any voltage above 5V should be measured via a voltage divider.
                      If Vcc is 3.3V same principle, but you could get away with measuring 5V directly (would not kill the processor), but your values may be off.

                      Meshx86M Offline
                      Meshx86M Offline
                      Meshx86
                      wrote on last edited by Meshx86
                      #39

                      @GertSanders following the instructions of this post suggest using Alkaline batteries (apparently Li-ion aren't a good idea for sensor nodes ?! plus they are expensive), the optimal solution would be using 2 x AA batteries as some ans this post suggested.

                      I believe there is no way 2 x AA batteries in series would measure anywhere near 3.3v, the max i measured with brand new batteries was 3.2v.

                      my major concern is:
                      would i still need to the do the voltage corrections when using the voltage divider ? if so, does that need to be reprogrammed every time you replace the battery ?

                      sorry to bring this again @Yveaux @axillent

                      GertSandersG 1 Reply Last reply
                      0
                      • Meshx86M Meshx86

                        @GertSanders following the instructions of this post suggest using Alkaline batteries (apparently Li-ion aren't a good idea for sensor nodes ?! plus they are expensive), the optimal solution would be using 2 x AA batteries as some ans this post suggested.

                        I believe there is no way 2 x AA batteries in series would measure anywhere near 3.3v, the max i measured with brand new batteries was 3.2v.

                        my major concern is:
                        would i still need to the do the voltage corrections when using the voltage divider ? if so, does that need to be reprogrammed every time you replace the battery ?

                        sorry to bring this again @Yveaux @axillent

                        GertSandersG Offline
                        GertSandersG Offline
                        GertSanders
                        Hardware Contributor
                        wrote on last edited by
                        #40

                        @Meshx86
                        No problem to ask. I use the intern measurement method, which uses the internal 1.1V reference of the atmega328, so even if the Vcc value changes from 3.2V -> 2.6V, the reference will always be 1.1V, and the internal method allows you to calculate the actual measured battery voltage based on a difference with the reference, even with a declining value on Vcc (if powered by the same batteries).

                        Meshx86M 1 Reply Last reply
                        0
                        • GertSandersG GertSanders

                          @Meshx86
                          No problem to ask. I use the intern measurement method, which uses the internal 1.1V reference of the atmega328, so even if the Vcc value changes from 3.2V -> 2.6V, the reference will always be 1.1V, and the internal method allows you to calculate the actual measured battery voltage based on a difference with the reference, even with a declining value on Vcc (if powered by the same batteries).

                          Meshx86M Offline
                          Meshx86M Offline
                          Meshx86
                          wrote on last edited by
                          #41

                          @GertSanders sorry mate, am more of a software guy..

                          according to the lib i've seen and @Yveaux's example for the internal method, at the begining you need to define a corrective value :

                          const float VccCorrection = 1.0/1.0;  // Measured Vcc by multimeter divided by reported Vcc
                          
                          Vcc vcc(VccCorrection);
                          

                          is this necessary for an accurate reading ? and is the corrective value need to be just entered once (like a calibration per arduino) or need to be reconfigured every time you replace a battery ?

                          GertSandersG 1 Reply Last reply
                          0
                          • N Offline
                            N Offline
                            Nicklas Starkel
                            wrote on last edited by
                            #42

                            Good article/site on why Alkaline is the best way to go for Mysensors nodes :)
                            http://batteryuniversity.com/learn/article/elevating_self_discharge

                            AWIA 1 Reply Last reply
                            2
                            • Meshx86M Meshx86

                              @GertSanders sorry mate, am more of a software guy..

                              according to the lib i've seen and @Yveaux's example for the internal method, at the begining you need to define a corrective value :

                              const float VccCorrection = 1.0/1.0;  // Measured Vcc by multimeter divided by reported Vcc
                              
                              Vcc vcc(VccCorrection);
                              

                              is this necessary for an accurate reading ? and is the corrective value need to be just entered once (like a calibration per arduino) or need to be reconfigured every time you replace a battery ?

                              GertSandersG Offline
                              GertSandersG Offline
                              GertSanders
                              Hardware Contributor
                              wrote on last edited by
                              #43

                              @Meshx86
                              The corrective value is needed every time you change a battery, AND if you need high accuracy.
                              On my battery based nodes I do not have a need for absolute accuracy, I just need to see the trend of the Vcc value.
                              Changing the battery happens every 12-24 months (depends on the use), so I'm not very interested in absolute accuracy. If you need real accurate measuring, I would suggest a real Analog-To_Digital chip.

                              Meshx86M 1 Reply Last reply
                              2
                              • GertSandersG GertSanders

                                @Meshx86
                                The corrective value is needed every time you change a battery, AND if you need high accuracy.
                                On my battery based nodes I do not have a need for absolute accuracy, I just need to see the trend of the Vcc value.
                                Changing the battery happens every 12-24 months (depends on the use), so I'm not very interested in absolute accuracy. If you need real accurate measuring, I would suggest a real Analog-To_Digital chip.

                                Meshx86M Offline
                                Meshx86M Offline
                                Meshx86
                                wrote on last edited by
                                #44

                                @GertSanders thanks , i think accuracy isn't a deal breaker, i believe everyone's concern is to just know when the batteries need to be replaced (hopefully that can be done without specifying the voltage correction).

                                YveauxY 1 Reply Last reply
                                1
                                • Meshx86M Meshx86

                                  @GertSanders thanks , i think accuracy isn't a deal breaker, i believe everyone's concern is to just know when the batteries need to be replaced (hopefully that can be done without specifying the voltage correction).

                                  YveauxY Offline
                                  YveauxY Offline
                                  Yveaux
                                  Mod
                                  wrote on last edited by
                                  #45

                                  @Meshx86 ok, being quoted so many times I can also add my 5 cents :smile:
                                  The correction factor is optional. You can use it to improve the measured voltage, as the internal voltage reference is only accurate up to so many percentage (have to look up the number). It is unique to the arduino used.
                                  This factor should however not depend on the batteries, possibly on environmental factors (e.g. Temperature)

                                  http://yveaux.blogspot.nl

                                  Meshx86M 1 Reply Last reply
                                  0
                                  • YveauxY Yveaux

                                    @Meshx86 ok, being quoted so many times I can also add my 5 cents :smile:
                                    The correction factor is optional. You can use it to improve the measured voltage, as the internal voltage reference is only accurate up to so many percentage (have to look up the number). It is unique to the arduino used.
                                    This factor should however not depend on the batteries, possibly on environmental factors (e.g. Temperature)

                                    Meshx86M Offline
                                    Meshx86M Offline
                                    Meshx86
                                    wrote on last edited by
                                    #46

                                    @Yveaux one last, i promise :P

                                    if max battery voltage is actually 3.2v, does that mean that the battery percentage would show 100% for quite sometime before it starts dropping below 3.0v (assuming vmax is set to 3.0) ? or would it increase the inaccuracy gap ?

                                    YveauxY 1 Reply Last reply
                                    0
                                    • Meshx86M Meshx86

                                      @Yveaux one last, i promise :P

                                      if max battery voltage is actually 3.2v, does that mean that the battery percentage would show 100% for quite sometime before it starts dropping below 3.0v (assuming vmax is set to 3.0) ? or would it increase the inaccuracy gap ?

                                      YveauxY Offline
                                      YveauxY Offline
                                      Yveaux
                                      Mod
                                      wrote on last edited by
                                      #47

                                      @Meshx86 the function Read_Perc() takes a boolean as 3rd parameter. Default it's true, which means the result is clipped to 0..100% range.
                                      So, if maximum is set to 3v, and you are currently above it, it will report 100% until you drop below 3v.

                                      http://yveaux.blogspot.nl

                                      1 Reply Last reply
                                      0
                                      • N Nicklas Starkel

                                        Good article/site on why Alkaline is the best way to go for Mysensors nodes :)
                                        http://batteryuniversity.com/learn/article/elevating_self_discharge

                                        AWIA Offline
                                        AWIA Offline
                                        AWI
                                        Hero Member
                                        wrote on last edited by
                                        #48

                                        @Nicklas-Starkel The article mostly talks about rechargeable batteries. I prefer non rechargeable Lithium batteries (like coin cells) for their energy density and very low self discharge.
                                        My major concern with (cheap) alkaline batteries is their leakage of aggressive chemicals. I had to trash my first nodes because of this :unamused:

                                        N tonnerre33T 2 Replies Last reply
                                        0
                                        • AWIA AWI

                                          @Nicklas-Starkel The article mostly talks about rechargeable batteries. I prefer non rechargeable Lithium batteries (like coin cells) for their energy density and very low self discharge.
                                          My major concern with (cheap) alkaline batteries is their leakage of aggressive chemicals. I had to trash my first nodes because of this :unamused:

                                          N Offline
                                          N Offline
                                          Nicklas Starkel
                                          wrote on last edited by
                                          #49

                                          @AWI in the first part it states:
                                          "Primary cells such as lithium-metal and alkaline retain the stored energy best, and can be kept in storage for several years."
                                          So you are correct and between Alkaline and Lithium-metal maybe the latter would be best. :)
                                          I have no experience with coin cells and will do some testing with them as soon as I can.
                                          Since this is the battery article, would you please tell me what you use and how you use it. What you expected and if the batteries lived up to your expectations. Would be cool to know as you've had more experience then me (and many like me)!

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


                                          21

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 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