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

    Crashing after a couple of hours

    Scheduled Pinned Locked Moved GPy
    2 Posts 1 Posters 32 Views 1 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.
    • Åke ForslundÅ Offline
      Åke Forslund
      last edited by

      Hi I'm setting up a temperature sensor using the gPy device. My idea was to have it in deepsleep for ~30 minutes and then perform a measurement and go back to sleep.

      I've created a main.py that looks like this:

      from machine import Pin
      import time
      from onewire import DS18X20, OneWire
      
      
      print("Booted into application at {}".format(time.time()))
      
      
      def get_temperature():
          """Get temperature from OneWire sensor."""
          ow = OneWire(Pin('P10'))
          temp = DS18X20(ow)
          for _ in range(10):
              temperature = temp.read_temp_async()
              time.sleep(1)
              temp.start_conversion()
              if temperature:
                  break
          return temperature
      
      
      def publish_to_web(temperature):
          print('Publishing a temperature of {}'.format(temperature))
          pybytes.send_signal(0, temperature)
      
      time.sleep(1)
      temperature = get_temperature()
      publish_to_web(temperature)
      time.sleep(1)
      print("Going to sleep")
      pybytes.deepsleep(30*60*1000) # 30 Minutes
      

      And this works for some time but after 5-8 hours samples stop coming in and when looking at my computer I see that the Atom shell is trying to connect to the serial port but failing.

      Disconnecting / reconnecting then shows a SyntaxError message. Resetting the device resumes the operation.

      Has anyone seen anything similar to this? Any ideas how to make it more robust? Could I setup a watchdog in the boot.py and then feed / disable it in my main.py? would it help or is it likely that the issue occurs earlier.

      I've now connected it to an usb-charger in case there's something my computer does.

      Any help / insights would be appreciated!

      1 Reply Last reply Reply Quote 0
      • Åke ForslundÅ Offline
        Åke Forslund
        last edited by

        Having it plugged to an usb-charger instead of the computer's usb has kept it stable since I sent above message so maybe it was the USB port on my computer or possibly Atom causing the issue.

        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