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

    PySense library on Extension Board 3.1

    Scheduled Pinned Locked Moved Firmware
    2 Posts 2 Posters 44 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.
    • A Offline
      aparcar
      last edited by

      I'm trying to read the battery voltage with the PySense/pycoproc library function read_battery_voltage(), however the board detection fails with the error message below. Is there no support for the Extension Board 3.1?

      rst:0x7 (TG0WDT_SYS_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)
      configsip: 0, SPIWP:0xee
      clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
      mode:DIO, clock div:1
      load:0x3fff8020,len:8
      load:0x3fff8028,len:2140
      ho 0 tail 12 room 4
      load:0x4009fa00,len:19760
      entry 0x400a05bc
      Smart Provisioning started in the background
      See https://docs.pycom.io/smart for details
      Traceback (most recent call last):
        File "main.py", line 15, in <module>
        File "/flash/lib/pysense.py", line 20, in __init__
        File "/flash/lib/pycoproc.py", line 115, in __init__
        File "/flash/lib/pycoproc.py", line 115, in __init__
      Exception: Board not detected: I2C bus error
      Pycom MicroPython 1.20.2.rc6 [v1.11-01f49f7] on 2020-02-28; LoPy4 with ESP32
      Pybytes Version: 1.3.1
      Type "help()" for more information.
      >>> 
      
      robert-hhR 1 Reply Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @aparcar
        last edited by

        @aparcar On expansion Boards you can determine the battery voltage with the internal ADC on Pin P16. There is a voltage divider between the battery an P16, which divides the battery voltage by 2 or by 3.05, depending on the board. So you can use the ADC class (see https://docs.pycom.io/tutorials/all/adc/) with 11dB attenuation to read the input voltage and scale that by the divider. E.g. if the ADC tells 1.9V, and the divider is 2, the the battery voltage is 3.8V. Since the ADC is noisy, you may have to calculate an average over say 100 values taken. If you have an voltage meter, you should take that to obtain the proper scaling value.

        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