Battery status on LillyGO T7 S3

I’m trying to read the battery status on LillyGo T7 S3. As per documentation/scematic (T7-S3/schematic at main · Xinyuan-LilyGO/T7-S3 · GitHub), it is attached to pin 2.
So I tried this:

    - platform: adc
      id: battery_level
      pin: 2

But the sensor showed the exact value of 0.961 forever until the device died from an empty battery.

Is the battery detection on gpio02 perhaps intended as a simple connected/not connected sensor rather than a battery level monitor?

Do the onboard LEDs change when a battery is connected?

You could test to see if this may be the case by using a gpio binary sensor on gpio02 and changing between power supplies?

Battery level would require onboard voltage divider circuitry I guess.

These are just thoughts, I did not read the circuit diagrams (I’m not very good with them).

After digging deeper into the problem, I’ve found the solution. Actually, it was in the example projects. I need to add an attenuation parameter for the sensor.
Currently it looks like this:

    - platform: adc
      id: battery_level
      pin: 2
      update_interval: 30min
      unit_of_measurement: "%"
      accuracy_decimals: 0
      device_class: battery
      attenuation: 11db
        - calibrate_linear:
          - 1.5 -> 0.0
          - 2.1 -> 100.0

I have to calibrate because the sensor’s raw data is 2.1 max, and the device switches off when the level becomes a little bit less than 1.5

1 Like