Navigation

    LILYGO

    • Register
    • Login
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    t-deck Battery Indicator

    Technical Discussion
    2
    3
    448
    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.
    • A
      abdnatsheh last edited by

      im working on battery indicator for t-deck for a project im working on , any help

      teastain2 1 Reply Last reply Reply Quote 0
      • teastain2
        teastain2 @abdnatsheh last edited by teastain2

        @abdnatsheh I don't have a T-Deck, but this works on my LilyGO T-Display S3

        Add these lines:

        #define BAT_ADC_PIN 4
        and the the loop:
          uint32_t voltage = readAdcVoltage(BAT_ADC_PIN) * 2;
          tft.setCursor(50, 70, 4);  //add correct offsets as required for your board
          tft.setTextColor(TFT_RED);
          tft.fillRect(42, 70, 70, 25, TFT_BLACK);//add correct offsets as required
          tft.print(((float)voltage/1000) +0.32);
        

        The ESP32 has a notoriously bad ADC with linearity and offset issues, so this reading cannot be used for scientific observations, only a relative health check.
        Also when the USB is hooked up the Battery charge voltage is 5V !!!
        You can only see the battery when USB is unplugged.
        Hope this helps
        -Terry

        1 Reply Last reply Reply Quote 0
        • A
          abdnatsheh last edited by

          thanks for your reply !

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          Powered by NodeBB | Contributors