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. Best or any way to get battery before regulator

Best or any way to get battery before regulator

Scheduled Pinned Locked Moved Hardware
12 Posts 3 Posters 2.7k 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.
  • M Offline
    M Offline
    Martin Tellblom
    wrote on last edited by
    #1

    As I understand after some failed attempt to do a soil moisture sensor with battery check included I can't use any analog pins when using this method described in Battery Powered sensors.

    My sensor looks like this:
    alt text

    And this does it impossible to use the VCC library since I have a regulator.

    Any other way to get the batterylevel in my setup?

    MySensors MQTT Client Gateway, Openhab, Dashing, Razberry, 1-wire

    A 1 Reply Last reply
    0
    • M Martin Tellblom

      As I understand after some failed attempt to do a soil moisture sensor with battery check included I can't use any analog pins when using this method described in Battery Powered sensors.

      My sensor looks like this:
      alt text

      And this does it impossible to use the VCC library since I have a regulator.

      Any other way to get the batterylevel in my setup?

      A Offline
      A Offline
      AWI
      Hero Member
      wrote on last edited by
      #2

      @Martin-Tellblom why can't you use analog pins? You need one of these to measure. As your battery voltage is lower than the Arduino vcc you do not need a voltage divider. Just connect the battery (+) to an analog pin.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Martin Tellblom
        wrote on last edited by
        #3

        If I use this code:

        #if defined(__AVR_ATmega2560__)
          analogReference(INTERNAL1V1);
        #else
          analogReference(INTERNAL);
        #endif
        

        And try to use the analog pins for this soil moisture sensor the values I get from the other analog pins goes all crazy with its values

        MySensors MQTT Client Gateway, Openhab, Dashing, Razberry, 1-wire

        A 1 Reply Last reply
        0
        • M Martin Tellblom

          If I use this code:

          #if defined(__AVR_ATmega2560__)
            analogReference(INTERNAL1V1);
          #else
            analogReference(INTERNAL);
          #endif
          

          And try to use the analog pins for this soil moisture sensor the values I get from the other analog pins goes all crazy with its values

          A Offline
          A Offline
          AWI
          Hero Member
          wrote on last edited by
          #4

          @Martin-Tellblom don't use the internal reference, stick to the external (default)

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Martin Tellblom
            wrote on last edited by
            #5

            @AWI How do I do that? This is my first battery node tryout :)

            MySensors MQTT Client Gateway, Openhab, Dashing, Razberry, 1-wire

            A 1 Reply Last reply
            0
            • M Martin Tellblom

              @AWI How do I do that? This is my first battery node tryout :)

              A Offline
              A Offline
              AWI
              Hero Member
              wrote on last edited by
              #6

              @Martin-Tellblom Try to comment out the
              //analogReference(INTERNAL1V1);

              1 Reply Last reply
              0
              • M Offline
                M Offline
                Martin Tellblom
                wrote on last edited by
                #7

                @AWI So that should be enought? I'll try that

                MySensors MQTT Client Gateway, Openhab, Dashing, Razberry, 1-wire

                A 1 Reply Last reply
                0
                • M Martin Tellblom

                  @AWI So that should be enought? I'll try that

                  A Offline
                  A Offline
                  AWI
                  Hero Member
                  wrote on last edited by
                  #8

                  analogReference(DEFAULT); is the alternative for using a 5v (vcc) reference.

                  M 1 Reply Last reply
                  1
                  • A AWI

                    analogReference(DEFAULT); is the alternative for using a 5v (vcc) reference.

                    M Offline
                    M Offline
                    Martin Tellblom
                    wrote on last edited by
                    #9

                    @AWI But that is always 5V until the end of the battery since I use a step-up or am I thinking completely wrong here

                    MySensors MQTT Client Gateway, Openhab, Dashing, Razberry, 1-wire

                    A 1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      clio75
                      wrote on last edited by
                      #10

                      If you are using the internal ref 1.1 you need to divide the voltage on the pin down to this level.
                      If you like in the example using a 1M and 470K you will have a approx 1Volt in the point.

                      1 Reply Last reply
                      0
                      • M Martin Tellblom

                        @AWI But that is always 5V until the end of the battery since I use a step-up or am I thinking completely wrong here

                        A Offline
                        A Offline
                        AWI
                        Hero Member
                        wrote on last edited by
                        #11

                        @Martin-Tellblom The 5 volt is the reference... the analog pin is where you measure with respect to the reference. Try reading this article

                        M 1 Reply Last reply
                        2
                        • A AWI

                          @Martin-Tellblom The 5 volt is the reference... the analog pin is where you measure with respect to the reference. Try reading this article

                          M Offline
                          M Offline
                          Martin Tellblom
                          wrote on last edited by
                          #12

                          @AWI said:

                          e 5 volt is the refer

                          Once again. Big thank you @AWI . As you understand I'm new to this battery thing and it's kind of driving me crazy :)

                          MySensors MQTT Client Gateway, Openhab, Dashing, Razberry, 1-wire

                          1 Reply Last reply
                          0

                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                          With your input, this post could be even better 💗

                          Register Login
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          8

                          Online

                          12.0k

                          Users

                          11.2k

                          Topics

                          113.4k

                          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