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

    Storing variables in between deepsleep

    Scheduled Pinned Locked Moved FiPy
    deep sleepflash
    6 Posts 5 Posters 901 Views 5 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.
    • E Offline
      Edward Dimmack
      last edited by

      Hi all,

      I am creating a data logger that I want to record the value of two inputs every 15 mins then send it via cellular at the end of the day.

      In between recording I want it to go into deep sleep using machine.deepsleep. My understanding of deep sleep was that any variables will be deleted because it is like a reset. Can I store the variables in the flash during the day then delete them after sending them? If so how would I do it? If not is there any other way to do it or better way to do it?

      E 1 Reply Last reply Reply Quote 0
      • T Offline
        timh
        last edited by

        You can use NVS to store numbers.

        pycom.nvs_set(key, value)
        Set the value of the specified key in the NVRAM memory area of the external flash. Data stored here is preserved across resets and power cycles. Value can only take 32-bit integers at the moment.

        rcolisteteR 1 Reply Last reply Reply Quote 1
        • E Offline
          Elizar @Edward Dimmack
          last edited by Elizar

          @edward-dimmack Just write the values to a file. That eases debugging since you can download the file (using atom) whenever you like.

          E 1 Reply Last reply Reply Quote 0
          • rcolisteteR Offline
            rcolistete @timh
            last edited by

            Take into account that NVRAM capacity is 614 number of 32 bits :
            What is the size limitation of the nvm storage in module pycom?
            So 24 hours x 4 per hour x 2 numbers each time = 192 numbers/day, so it is ok.

            My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

            1 Reply Last reply Reply Quote 0
            • E Offline
              Edward Dimmack @Elizar
              last edited by

              @elizar Do you mean to a file on an SD card? Because we are not using an SD card in this application.

              C 1 Reply Last reply Reply Quote 0
              • C Offline
                crumble @Edward Dimmack
                last edited by

                @edward-dimmack said in Storing variables in between deepsleep:

                @elizar Do you mean to a file on an SD card? Because we are not using an SD card in this application.

                You can use the filesystem of the internal flashl. Your program files are stored there as well. But mind the wear. Depending on your task, the NVRAM shall be the better solution.

                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