Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to measure battery level? #38

Open
andrecurvello opened this issue Jun 3, 2020 · 4 comments
Open

How to measure battery level? #38

andrecurvello opened this issue Jun 3, 2020 · 4 comments

Comments

@andrecurvello
Copy link

Hello,

There is any example on how to measure the battery level of hte TTGO T-Beam?

Thank you.

@KenADev
Copy link

KenADev commented Jul 12, 2020

With v1.0+ you can query the AXP chip with:
axp.getBattVoltage()/1000.0

@fphammerle
Copy link

tested on t-beam v1.1:

#include <Wire.h>
// https://github.com/lewisxhe/AXP202X_Library
#include <axp20x.h>

AXP20X_Class axp;

void setup() {
  // ...
  Wire.begin(21, 22);
  if(axp.begin(Wire, AXP192_SLAVE_ADDRESS) == AXP_FAIL) {
    Serial.println(F("failed to initialize communication with AXP192"));
  }
}

void loop() {
  // ...
  Serial.print(axp.getBattVoltage());
  Serial.println(" mV");
}

@amalinda
Copy link

Hi, is the library https://github.com/lewisxhe/AXP202X_Library no longer maintained? Would there be an alternate lib?

@chinswain
Copy link

Lewis has created a library for all of the power chips LilyGO use:

https://github.com/lewisxhe/XPowersLib/blob/master/examples/AXP202_Example/AXP202_Example.ino

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants