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.2k 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.
  • Martin TellblomM 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?

    AWIA Offline
    AWIA 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
    • Martin TellblomM Offline
      Martin TellblomM 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

      AWIA 1 Reply Last reply
      0
      • Martin TellblomM 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

        AWIA Offline
        AWIA 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
        • Martin TellblomM Offline
          Martin TellblomM 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

          AWIA 1 Reply Last reply
          0
          • Martin TellblomM Martin Tellblom

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

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

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

            1 Reply Last reply
            0
            • Martin TellblomM Offline
              Martin TellblomM 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

              AWIA 1 Reply Last reply
              0
              • Martin TellblomM Martin Tellblom

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

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

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

                Martin TellblomM 1 Reply Last reply
                1
                • AWIA AWI

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

                  Martin TellblomM Offline
                  Martin TellblomM 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

                  AWIA 1 Reply Last reply
                  0
                  • clio75C Offline
                    clio75C 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
                    • Martin TellblomM 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

                      AWIA Offline
                      AWIA 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

                      Martin TellblomM 1 Reply Last reply
                      2
                      • AWIA 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

                        Martin TellblomM Offline
                        Martin TellblomM 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
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        12

                        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