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 can I hold a data after I used deep sleep python

    Scheduled Pinned Locked Moved Projects
    5 Posts 4 Posters 111 Views 4 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
      Erick Falcon
      last edited by

      I am using fipy and sigfox to send data from some sensors, and pytrack to get the coordinates, the sensor data will be sent every hour and the coordinates only 1 time a day, after sending a message with the sensor data I want to put fipy on deep sleep to save energy. the problem is that after using deep sleep the device restarts and I can't get the coordinates to be sent just once a day.

      My idea is to use a counter from 1 to 24, every time the counter value is at 1 send the sensor data and the coordinates, when the counter value is from 2 to 24 send only the sensor data.
      Every time the counter adds up to 1, I want the device to go into deep sleep mode, but when it restarts it saves the counter value.
      I would greatly appreciate your support.

      counter=1
      
      if counter==1:
          print("Send the sensor data and  coordinates")
      elif counter>1 and counter<=24
          print("Send Only the sensor data")
      if counter==24:
          counter.hold(false) 
          counter=1 # Here i reset the counter
      counter+=1
      counter.hold(True)# I know this function don´t work in this case.
      # pin.hold(True/false) the hold function is used to holde the state of a pin.
      machine.deepsleep (60000)
      
      1 Reply Last reply Reply Quote 0
      • R Offline
        railmonitor
        last edited by

        Hi Erick

        There are basically two solutions to the problem:

        Not using deepsleep but lightsleep instead, which does not reboot your device. It does have a higher power-consumption, but it is still saving a lot.

        Storing the data / counter or whatever on a SD card for use after wake up from Deepsleep.

        Best Regards
        RM

        A 1 Reply Last reply Reply Quote 0
        • A Offline
          agotsis @railmonitor
          last edited by

          @Erick-Falcon @railmonitor And a third one if you still want to use deep-sleep: use NVRAM to store values that are preserved after boot. How? Based on pycom's functions pycom.nvs_set(key, value) and pycom.nvs_get(key)
          BR.

          R 1 Reply Last reply Reply Quote 0
          • R Offline
            railmonitor @agotsis
            last edited by

            @agotsis That will work if things is not time-critical yes! But if your wakeup is depending on a interrupt from a sensor, and you want to be able to start sampling from the sensor(s) as soon as you get an interrupt, deepsleep is simply not feasible. You will not get data before it is finished re-booting after deepsleep, losing a lot of data in the meantime.

            1 Reply Last reply Reply Quote 1
            • A Offline
              alexa minar Banned
              last edited by

              This post is deleted!
              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