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

    Power consumption / wifi-information storage machine.deepsleep()

    Scheduled Pinned Locked Moved GPy
    deepsleepcurrentwifiinformationstorage
    11 Posts 5 Posters 2.2k 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.
    • J Offline
      jmarcelino @Andy_N.
      last edited by

      Hi @andy_n

      I think the LTE modem isn't correctly going into deepsleep after the first time, we're investigating it. As a "debug" step you can try to add

      lte = LTE()
      lte.deinit()
      

      to the end of your cycle. But note this is only for debug purposes, you shouldn't do it in production, instead it's better to let the modem handle it automatically.

      Regarding storing WiFi information the easiest place is to have it on a file in /flash. You can use regular Python file operations to write and read data from it.

      G A 2 Replies Last reply Reply Quote 0
      • G Offline
        gregcope @jmarcelino
        last edited by gregcope

        @jmarcelino How many write cycles can the pycom family internal flash handle?

        I want to keep state on an SD card (pytrack), but that is not possible as the SD consumes too much power ... (on the next version can we power the SDCard off the 3v3_sensor rail that I understand powers down on sleep).

        I would assume I write every minute. Which is 500K writes a year or so...

        M J 2 Replies Last reply Reply Quote 0
        • M Offline
          MarcoBenini @gregcope
          last edited by

          @gregcope With that volume of writes per year, and being powered by a battery, it is probably better to use a FRAM external memory (I2C or SPI).
          FRAM read/write cycles are about 10^12 - 10^15 depending manufacturer and technology used.

          G 1 Reply Last reply Reply Quote 0
          • J Offline
            jmarcelino @gregcope
            last edited by

            @gregcope
            Pycom will support LittleFS for the internal filesystem soon (already in testing) which does wear levelling

            G 1 Reply Last reply Reply Quote 0
            • G Offline
              gregcope @MarcoBenini
              last edited by

              @marcobenini thanks

              1 Reply Last reply Reply Quote 0
              • G Offline
                gregcope @jmarcelino
                last edited by

                @jmarcelino will pycom support rtc memory soon, which i understand the ESPs have?

                J 1 Reply Last reply Reply Quote 0
                • J Offline
                  jmarcelino @gregcope
                  last edited by

                  @gregcope
                  I think RTC RAM on the ESP32 gets cleared unless waking from deepsleep so it's less useful that one might think.

                  G 1 Reply Last reply Reply Quote 0
                  • G Offline
                    gregcope @jmarcelino
                    last edited by

                    @jmarcelino if the rtc memory is retained on deepsleep this is ideal for transient, but useful state.

                    If you want to keep persistence between resets i agree that internal flash is better.

                    If you want to keep data between deepsleeps, that may change allot (think temp readings like 21.9 - the decimal may change) rtc could be better.

                    Is supporting rtc memory on the roadmap?

                    1 Reply Last reply Reply Quote 0
                    • A Offline
                      Andy_N. @jmarcelino
                      last edited by

                      @jmarcelino today i was able to add the code:

                      import time
                      import machine
                      from network import LTE
                      
                      i=True
                      
                      while i==True:
                          print('nomal mode 15sec')
                          time.sleep(15)
                              
                          i = False
                      
                      lte = LTE()
                      lte.deinit()
                      
                      
                      print('deepsleep mode 15sec')
                      machine.deepsleep(15000)
                      

                      but it just runs the error:

                      >>> Running o:\Benutzerablagen\Nellis\Pycom GPY\ProjektTest\main.py
                      
                      >>>
                      >>>
                      >>>
                      >>>
                      nomal mode 15sec
                      ╝Traceback (most recent call last):
                        File "<stdin>", line 16, in <module>
                      OSError: the requested operation failed
                      ╝>
                      MicroPython v1.8.6-849-83e2f7f on 2018-03-19; GPy with ESP32
                      Type "help()" for more information.
                      

                      Is there an other solution i could try?

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

                        @Andy_N said in Power consumption / wifi-information storage machine.deepsleep():

                        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