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. My Project
  3. 5v Battery level

5v Battery level

Scheduled Pinned Locked Moved My Project
7 Posts 3 Posters 2.4k Views 3 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.
  • ErrKE Offline
    ErrKE Offline
    ErrK
    Plugin Developer
    wrote on last edited by
    #1

    Hi.
    I have a Arduino mini 5v node with DHT11 and a Motion Sensor.
    Now i want to add a battery level function but i have only find how to do it with 3.3v.
    I am currently using 4st AA batteries for this node.

    1 Reply Last reply
    0
    • mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by mfalkvidd
      #2

      @ErrK you're using http://www.mysensors.org/build/battery#measuring-and-reporting-battery-level ?

      If so, use the following numbers instead:

      // 1M, 200K divider across battery and using internal ADC ref of 1.1V
      // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
      // Vmax = 1.1*((1e6+200e3)/200e3) = 6.6 Volts
      // 6.6/1023 = Volts per bit = 0.006451613
      float batteryV = sensorValue * 0.006451613;
      

      (switch the 470k resistor to a 200k resistor and use 0.006451613 in the code)

      ErrKE 1 Reply Last reply
      0
      • mfalkviddM mfalkvidd

        @ErrK you're using http://www.mysensors.org/build/battery#measuring-and-reporting-battery-level ?

        If so, use the following numbers instead:

        // 1M, 200K divider across battery and using internal ADC ref of 1.1V
        // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
        // Vmax = 1.1*((1e6+200e3)/200e3) = 6.6 Volts
        // 6.6/1023 = Volts per bit = 0.006451613
        float batteryV = sensorValue * 0.006451613;
        

        (switch the 470k resistor to a 200k resistor and use 0.006451613 in the code)

        ErrKE Offline
        ErrKE Offline
        ErrK
        Plugin Developer
        wrote on last edited by
        #3

        @mfalkvidd that's exactly what I was looking for.
        Thanks for the quick answer.

        1 Reply Last reply
        0
        • mfalkviddM Offline
          mfalkviddM Offline
          mfalkvidd
          Mod
          wrote on last edited by
          #4

          Great! You're welcome.

          1 Reply Last reply
          0
          • ErrKE Offline
            ErrKE Offline
            ErrK
            Plugin Developer
            wrote on last edited by
            #5

            My node has been on for a week now and the battery meter shows 102%. It feels like a bit to much.

            1 Reply Last reply
            0
            • sundberg84S Offline
              sundberg84S Offline
              sundberg84
              Hardware Contributor
              wrote on last edited by
              #6

              @ErrK thats nothing unusual. I use this code on 2x1.5A batterys and normally you get readings on 3.2V which is over 100%,

              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

              ErrKE 1 Reply Last reply
              0
              • sundberg84S sundberg84

                @ErrK thats nothing unusual. I use this code on 2x1.5A batterys and normally you get readings on 3.2V which is over 100%,

                ErrKE Offline
                ErrKE Offline
                ErrK
                Plugin Developer
                wrote on last edited by
                #7

                @sundberg84 ok. Thanks for the help and the quick reply.

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


                24

                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