🤖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.

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