Page 1 of 1

Lipo voltage Lolin D32

Posted: Mon Apr 15, 2019 10:09 am
by yanosz
Hello folks,

I'm wondering how to measure the LiPo voltage using a Lolin's D32. I wasn't able find any pins attached to one of the adcs. Do you know a code example for putting the esp32 into deepsleep when the battery reaches a critical level?

Thanks,
yanosz

Re: Lipo voltage Lolin D32

Posted: Mon Apr 15, 2019 2:58 pm
by papaluna
Hi,
The battery voltage monitor is on GPIO#35 (not exposed). More info at https://youtu.be/yZjpYmWVLh8?t=88

Re: Lipo voltage Lolin D32

Posted: Sun Dec 15, 2019 9:38 pm
by juanpabloaj
yanosz wrote:
Mon Apr 15, 2019 10:09 am
I'm wondering how to measure the LiPo voltage using a Lolin's D32. ...
I used this code, I'm not sure if it is correct or not.

Code: Select all

void loop()
{

  int ADC_VALUE = analogRead(35);
  Serial.print("ADC VALUE = ");
  Serial.println(ADC_VALUE);
  int adc_percentage = int(100 * ADC_VALUE / 4095);
  //delay(1000);
  float voltage_value = (ADC_VALUE * 3.3 ) / (4095);
  Serial.print("Voltage = ");
  Serial.print(voltage_value);
  Serial.println(" volts");
  //delay(1000);


  EPD.clearBuffer();
  EPD.fillScreen(EPD_WHITE);
  EPD.setCursor(0,0);
  EPD.print(adc_percentage);
  EPD.println("%");
  EPD.setCursor(0,26);
  EPD.println(voltage_value);
  EPD.setCursor(0,52);
  EPD.println(ADC_VALUE);
  EPD.display();
  delay(60000);
}
https://github.com/juanpabloaj/lolin_d ... el.ino#L40