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

    I2C bus error pytrack read_battery_voltage()

    Scheduled Pinned Locked Moved LoPy
    i2c bus error
    2 Posts 2 Posters 484 Views 2 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.
    • C Offline
      chvl
      last edited by

      The pytrack regularly gives an i2c bus error when reading the battery voltage with the function "read_battery_voltage ()".
      The firmware of the pytrack read out with "read_fw_version ()" returns 8

      The information about the version of the pyncom that I retrieve with "os.uname ()" is:
      [0] LoPy4
      [1] LoPy4
      [2] 1.17.5.b6
      [3] v1.8.6-849-56d00234 on 2018-05-18
      [4] LoPy4 with ESP32
      [5] 1.0.2

      A 1 Reply Last reply Reply Quote 0
      • A Offline
        agmatthews @chvl
        last edited by

        @chvl
        I have the same issue with bus errors on battery read so I use a 'try' 'except' to catch the error and I limit my battery check to something reasonable - like every 10 minutes
        eg:

        batt_check_interval = 600 # check the battery voltage every 10 minutes
        
        def readBattery():
            global vBatt
            global last_batt_check
            global batt_check_interval
            if(utime.time() - last_batt_check > batt_check_interval):
                try:
                    vBatt = pytrack.read_battery_voltage()
                    # keep track of time since last battery check
                    last_batt_check = utime.time()
                    print ('Battery read: ' + str(vBatt))
                    if (vBatt < lowBatt):
                        # do more here
                        print ('Battery voltage: LOW')
        
                except Exception as e:
                    print ('Battery read: ERROR')
                    return
            return
        
        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