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

    Get Bottom2 power connection status with a code.

    Scheduled Pinned Locked Moved Modules
    2 Posts 2 Posters 1.5k 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.
    • I Offline
      ioamas
      last edited by ioamas

      How can I monitor the status of the power connection through the pogo pins on the Bottom2 module? Are there any specific methods or code examples for detecting power presence or absence?

      M5.Lcd.setCursor(startX, currentY);
      float vinVoltage = M5.Axp.GetVinVoltage();
      bool hasUsbPower = (vinVoltage > 4.5);
      bool hasBackPower = M5.Axp.isCharging(); // Check if charging via any source
      M5.Lcd.setTextColor(WHITE);
      M5.Lcd.print(F("USB-C: "));
      M5.Lcd.setTextColor(hasUsbPower ? PAL_GREEN : RED);
      M5.Lcd.printf("%.1fV", vinVoltage);
      currentY += lineSpacing;
      
      M5.Lcd.setCursor(startX, currentY);
      M5.Lcd.setTextColor(WHITE);
      M5.Lcd.print(F("Back: "));
      M5.Lcd.setTextColor(hasBackPower ? PAL_GREEN : RED);
      if (hasBackPower && !hasUsbPower) { // Only show back power if it's the source
          M5.Lcd.printf("%.1fV", M5.Axp.GetVBusVoltage());
      } else {
          M5.Lcd.print(" --");
      }
      currentY += lineSpacing;
      
      // Check battery level
      M5.Lcd.setCursor(startX, currentY);
      float batteryLevel = M5.Axp.GetBatteryLevel();
      M5.Lcd.setTextColor(WHITE);
      M5.Lcd.print(F("Battery: "));
      M5.Lcd.setTextColor(batteryLevel > 20 ? PAL_GREEN : RED);
      M5.Lcd.printf("%d%%", (int)batteryLevel);
      currentY += lineSpacing;
      
      kurikoK 1 Reply Last reply Reply Quote 0
      • kurikoK Offline
        kuriko @ioamas
        last edited by

        @ioamas
        According to the schematic diagram, the 5V of the Pogo pin is directly connected to the VIN pin. So I think maybe you can determine whether the Pogo pin is connected by judging whether the battery is connected

        Good morning, and welcome to the Black Mesa Transit System.

        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
        • First post
          Last post