🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Unexpected Vbus readings for M5StickC-Plus

    M5 Stick/StickC
    2
    3
    14
    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.
    • W
      wjcarpenter
      last edited by wjcarpenter

      I came across a mystery (well, at least a mystery to me) while porting some code to the M5Unified API. In trying to see if the USB power was unplugged, I came across the undocumented M5.Power.getVBUSVoltage() method. In following the source code all they way down, I can see that it's reading the VBus voltage from the AXP192 and then scaling it to return a value in millivolts.

      I expected to be able to compare that result against 0 to decide if the USB cable was plugged in. When it is plugged in, I get readings a little above 5000 mV. However, when the cable is unplugged, I get readings around 830 mV. That's with the internal battery nearly fully charged. I don't know if the unplugged reading changes with the internal battery charge or with the M5StickC-Plus workload or whatever.

      As a workaround, I'm comparing against 2000 mV instead of 0 mV to decide if the device is unplugged.

      Where do those 830 mV come from?

      W 1 Reply Last reply Reply Quote 0
      • W
        wjcarpenter @wjcarpenter
        last edited by

        Perhaps I should mention what I was doing before porting to the M5Unified API. I was using the M5.Axp API to read the input power status register and decoding it. That told me directly what I wanted to know, but it doesn't seem to be available in the current iteration of the M5Unified API.

        ajb2k3A 1 Reply Last reply Reply Quote 0
        • ajb2k3A
          ajb2k3 @wjcarpenter
          last edited by

          @wjcarpenter Standby voltage. the stick doesn't truly power off and there is always a small voltage present in the stick which is why the battery always runs out.
          The voltage increasing with a cable plugged in is normal and thank you for pointing out this function.

          UIFlow, so easy an adult can learn it!
          If I don't know it, be patient!
          I've ether not learned it or am too drunk to remember it!
          Author of the WIP UIFlow Handbook!
          M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post