Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Monitoring battery voltage?

    Scheduled Pinned Locked Moved LoPy
    8 Posts 7 Posters 6.2k Views 9 Watching
    Loading More Posts
    • 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.
    • H Offline
      hukuzatuna
      last edited by

      Is there a way to monitor the connected battery voltage from within MicroPython? I'd like to write some code that monitors the voltage levels and generates an alert when the battery is reaching its low-voltage cutoff level so I can go fetch the LoPy from outside and charge it (I'm currently using the si7021 library I wrote to monitor outside temperature and humidity).

      I searched the forums and tried Google, but I didn't find anything clear cut.

      Cheers,
      Phil

      1 Reply Last reply Reply Quote 0
      • D Offline
        digsatman
        last edited by

        Don't think this is possible at the moment but as soon as ADC is available in "machine" for the Wipy2/Lopy, you would be able to use an ADC pin to read a value from the battery. You would need a couple of resistors to form a voltage divider to ensure that the 3.3V from the battery is reduced to below the maximum voltage that the ADC pin can handle. This is nominally 1.4V with an absolute maximum of 1,8V . The ADC input draws minimal current so you could use high resistance values to minimise any load through the resistor voltage divider.

        1 Reply Last reply Reply Quote 0
        • H Offline
          hukuzatuna
          last edited by

          Awesome, thanks! I use a high resistance voltage divider on the ESP8266, so I know exactly how to build that. Much appreciated!

          Cheers,
          Phil

          1 Reply Last reply Reply Quote 0
          • J Offline
            jomifo Pybytes Beta
            last edited by

            Would low voltage cause any damage to the LoPy?
            Thanks,
            Joe

            1 Reply Last reply Reply Quote 0
            • R Offline
              remcohn
              last edited by

              not to the LoPy, but over-discharge will damage the battery.

              1 Reply Last reply Reply Quote 0
              • R Offline
                rskoniec
                last edited by

                @hukuzatuna, @digsatman Now when ADC is available in "machine" for the Wipy2/Lopy did you try to get battery voltage monitoring working?

                The machine is working as good as it's code.

                1 Reply Last reply Reply Quote 0
                • Y Offline
                  yahia
                  last edited by

                  According to this picture: https://www.pycom.io/wp-content/uploads/2016/11/expansion_v02_pinout.pdf
                  The battery signal is at P16. I have tried reading it and the first time i read the value (After defining ADC to the correct Pin) it shows a number (52 or 44) then any other read attempts returns 0. I am not sure what this means but I know this is the correct pin also because without the battery the value returns 1023.

                  Maybe i am interpreting this incorrectly?

                  1 Reply Last reply Reply Quote 0
                  • B Offline
                    brotherdust
                    last edited by brotherdust

                    All,
                    I am cross-posting from another thread some progress I've made on battery measurement. See:
                    https://forum.pycom.io/topic/226/lopy-adcs/5

                    Hopefully it helps!

                    1 Reply Last reply Reply Quote 1

                    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
                    • 1 / 1
                    • First post
                      Last post

                    Pycom on Twitter

                    Pycom