Get Bottom2 power connection status with a code.
-
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; -
@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
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