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

    How to reduce power consumption on GPy?

    Scheduled Pinned Locked Moved GPy
    helphelpneededpower saving
    8 Posts 3 Posters 638 Views 3 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.
    • techykermitT Offline
      techykermit
      last edited by

      Hello! I am building a water temperature sensor using a PyCom GPy on the Makr board, but I am not very impressed with the battery performance so far.

      I am using a 6700mAh power bank to power everything, but only gets around 17 hours of battery life. The code is set up so that it sends a request to a web server every 6 minutes, with machine.idle() while waiting. I am connecting via WiFi to an access point I have set up nearby.

      I have tried to decrease the time between updates, and yes, it does make a difference, but I am still not satisfied. Here is what I have done so far in my code to save power:

      • Using machine.idle() before every time.sleep() in the code
      • Deinit the Bluetooth radio in boot.py.

      My questions are how I can reduce power consumption even more, preferably to a level where I would only have to recharge and replace the battery once every day or every 2 days. Using LTE isn´t really an option for me since my carrier doesn't support LTE Cat M1 at the moment.
      I am also using the LED to show status and the heartbeat while idle. I can remove that, but I am just thinking how much it affecting the battery life.

      Also, another issue I have is that when my power bank runs out of battery, I have a backup battery connected on the 2-pin battery connector on the Makr board, but it seems like the board detects some current from the power bank that is too low to power the GPy, but that still doesn´t make it switch to the secondary battery until the USB cable is unplugged from the nearly-dead power bank (too dead to power the GPy). Can you somehow route or change the power source the GPy uses?

      robert-hhR 1 Reply Last reply Reply Quote 1
      • robert-hhR Offline
        robert-hh @techykermit
        last edited by

        @techykermit You can use machine.deepsleep(), which powers the device down. Recovery from deepsleep is equivalent to a boot after reset. Take care to deinit LTE before going to deepsleep.
        Machine.idle() does not save any power. It just tells the underlying RTOS that you code is not busy.
        There are quite a few posts in this forum about this topic.

        techykermitT 1 Reply Last reply Reply Quote 1
        • techykermitT Offline
          techykermit @robert-hh
          last edited by

          @robert-hh Okay, thank you! I found the documentation about this to be a bit unclear, but maybe it was just me looking at the wrong place. Thanks!

          1 Reply Last reply Reply Quote 0
          • techykermitT Offline
            techykermit
            last edited by

            @robert-hh Do I have to reconnect to the WiFi network after a deepsleep?

            robert-hhR 1 Reply Last reply Reply Quote 0
            • robert-hhR Offline
              robert-hh @techykermit
              last edited by

              @techykermit After deepsleep the device performs a soft reset with all code. Assuming you do init WiFi during that, it will be done by that. There is a flag you can check whether the device went though a hard reset or reset after deepsleep. The flag is returned by machine.reset_cause(). (see https://docs.pycom.io/firmwareapi/pycom/machine/)

              techykermitT 1 Reply Last reply Reply Quote 1
              • techykermitT Offline
                techykermit @robert-hh
                last edited by

                @robert-hh That´s what I assumed, thank you so much!

                1 Reply Last reply Reply Quote 0
                • N Offline
                  nwjlyons
                  last edited by nwjlyons

                  @techykermit what kind of battery life did you get once you used deepsleep? I am looking at creating a similar project except using LTE instead of wifi to transmit a request every five mins.

                  techykermitT 1 Reply Last reply Reply Quote 0
                  • techykermitT Offline
                    techykermit @nwjlyons
                    last edited by

                    @nwjlyons It improved drastically, from 17 hours to 2-3 days.
                    Definitely use deepsleep!

                    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