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

    High current consumption in deep sleep: 80 mA

    Scheduled Pinned Locked Moved GPy
    gpydeep sleep
    8 Posts 5 Posters 1.1k Views 6 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.
    • A Offline
      averri
      last edited by averri

      Hi, I'm testing GPy on deep sleep mode, and the current consumption is around 80 mA. I was expecting something in the uA range, do you know what's wrong?

      I'm invoking the deep sleep with:

      import machine
      
      machine.deepsleep(10000)
      

      I have a boot.py file with WiFi configuration. I'm using GPy v1.0.

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

        @averri You have to de-init the LTE modem.

        1 Reply Last reply Reply Quote 0
        • A Offline
          averri
          last edited by

          It does not work. I'm using the following code:

          import pycom
          import time
          import json
          import machine
          from mqtt import MQTTClient
          from network import WLAN, LTE
          
          
          def sleep(millis):
              print('Going to sleep...')
              lte = LTE()
              lte.deinit()
              machine.deepsleep(millis)
          
          
          def handler(topic, data):
              print(topic, data)
              payload = json.loads(data.decode('utf-8'))
              msg = payload['msg'] if 'msg' in payload else None
              if msg == 'deepSleep':  # Here we enter deep sleep.
                  sleep(10000)
          
          
          def connect_mqtt():
              """Connects to the MQTT queue."""
              print('Connecting to the MQTT server...')
              c = MQTTClient('alex-device', 'xxx', port=1883, user='xxx', password='xxx')
          
              c.set_callback(handler)
              c.connect()
          
              c.publish('inTest', 'Device connected!')
              c.subscribe('outTest')
          
              return c
          
          
          def wait_for_wlan():
              while True:
                  if WLAN().mode() == WLAN.STA:
                      break
                  else:
                      time.sleep(0.5)
          
          
          def main():
          
              wait_for_wlan()
          
              c = connect_mqtt()
          
              while True:
                  time.sleep(0.5)
          
                  # Check MQTT message.
                  c.check_msg()
          
          
          if __name__ == '__main__':
              main()
          
          

          The result:

          Going to sleep...
          Traceback (most recent call last):
            File "main.py", line 112, in <module>
            File "main.py", line 95, in main
            File "mqtt.py", line 206, in check_msg
            File "mqtt.py", line 193, in wait_msg
            File "main.py", line 34, in handler
            File "main.py", line 15, in sleep
          OSError: the requested operation failed
          Pycom MicroPython 1.18.0.r1 [v1.8.6-849-9569a73] on 2018-07-20; GPy with ESP32
          Type "help()" for more information.
          
          A 1 Reply Last reply Reply Quote 0
          • A Offline
            averri
            last edited by

            @robert-hh The LTE deinit is not working, please see the message above.

            J 1 Reply Last reply Reply Quote 0
            • J Offline
              jcaron @averri
              last edited by

              @averri Do you have a SIM card in the module? IIRC LTE.deinit() won't work without one.

              A 1 Reply Last reply Reply Quote 0
              • A Offline
                averri @jcaron
                last edited by

                @jcaron No, I don't have a SIM card. Is it possible to disable the LTE without the SIM card?

                1 Reply Last reply Reply Quote 0
                • S Offline
                  serafimsaudade
                  last edited by serafimsaudade

                  I'm having the same problem. When I arrive at home a will insert a SIM card and check if the current consumption decrease.

                  Update:

                  I have insert a SIM card. And make lte.deinit() and de current consumption in deepsleep drop to 0.022 mA.

                  1 Reply Last reply Reply Quote 0
                  • A Offline
                    andreas @averri
                    last edited by

                    @averri said in High current consumption in deep sleep: 80 mA:

                    OSError: the requested operation failed
                    

                    We just mitigated this through [1] by invoking lte.deinit() with the "reset" operation like

                    lte.deinit(detach=False, reset=True)
                    

                    [1] https://github.com/hiveeyes/hiveeyes-micropython-firmware/commit/ec7c80e1219fb119c2881a0019cecdfad220f29f

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

                    Pycom on Twitter

                    Pycom