ESP32 LoRaV3 read Battery Voltage

I'm currently having the problem that I can't measure the battery voltage correctly on the LoRaV3 board.

I took the following as an example:

You will need to explain the details of what problem you having and show us the code your using.

you can See my picture or?
I have used 1:1 the Code from Video.

What do you see, why do you think it is incorrect?

Have You See my picture? My voltage must be 3,7volts or 3700mV

No, and no. I can't see your picture as there are multiple pictures, and why must be 3.7V?
Let me make a guess,
You have a LiPo battery that is labelled 3.7V. Is that correct?
Does that make you think you should see ONLY 3.7V when you measure it?
If so that is the equivalent of saying your car's 40L fuel tank will always show 40L on the fuel gauge as you drive it from full to empty.
Am I close?

You seem to be very educated! It is logical that it is not 3.7 volts permanently. The battery will of course also discharge, but the voltage should be approximately in this range.

ALL batteries have a voltage curve. I will try to find one to add to my post, but here is the simple explanation. First the voltage written on the battery is known as the 'nominal' voltage. The battery is fully charged when it is 4.2V and considered fully discharged at 3.0V
These numbers are specifically for a given chemistry, all Lithium are similar. The very safe chemistry of LiFePO4 (Lithium Iron Phosphate) has a nominal voltage of 3.2V which is why 4 cells in series is the same as an old fashioned LeadAcid battery of 12.8V. Here is a picture of the discharge curves at different temperatures AND a link to a fairly good article all about LiPo batteries.


https://www.dnkpower.com/lithium-polymer-battery-guide/

If you want to be 'highly educated' in the subject of Lithium batteries, here is one of the most authoritative sites. https://batteryuniversity.com/article/bu-409-charging-lithium-ion

Have you actually measured the battery voltage with a voltmeter and can confirm it is 3.7V

please take a look at my photo where the voltage is shown on the display..

the battery voltage should actually be visible there (it is not just the pure AD value that is shown) it is the same board as in the video and also the same code.. only it does not show the voltage for me and according to the multimeter it is 3.7vdc

Then there must be a fault on the board. It's obviously getting 3.7V or it would not be powered up.

I would need some time to study the schematics.

Thank you for your help and not just smart talking.
I'm going to take a measurement on the FET right away (see photo)

The ADC_Ctrl signal must be LOW or you won't see any voltage at that point.

digitalWrite(37,LOW);

Yes, exactly, does the software that can be seen in the video above (according to the source code..) I'll check that right away.

uint16_t readBatteryVoltage() {
  // ADC resolution
  const int resolution = 12;
  const int adcMax = pow(2,resolution) - 1;
  const float adcMaxVoltage = 3.3;
  // On-board voltage divider
  const int R1 = 390;
  const int R2 = 100;
  // Calibration measurements
  const float measuredVoltage = 4.2;
  const float reportedVoltage = 4.095;
  // Calibration factor
  const float factor = (adcMaxVoltage / adcMax) * ((R1 + R2)/(float)R2) * (measuredVoltage / reportedVoltage); 
  digitalWrite(ADC_Ctrl,LOW);
  delay(100);
  int analogValue = analogRead(VBAT_Read);
  digitalWrite(ADC_Ctrl,HIGH);

  float floatVoltage = factor * analogValue;
  uint16_t voltage = (int)(floatVoltage * 1000.0);

  delay(10000);
}

So when you go to make your measurement with the voltmeter at the point you indicated, just run some simple code that sets GPIO 37 LOW

you mean:

  digitalWrite(ADC_Ctrl,LOW);
  delay(100);
  digitalWrite(ADC_Ctrl,HIGH);
  delay(100);

like this?

I made one edit to the original code that will keep the control signal permanetly LOW

#include <Arduino.h>
#include <Wire.h>  
#include "HT_SSD1306Wire.h"

#define VBAT_Read    1
#define  ADC_Ctrl    37

SSD1306Wire  factory_display(0x3c, 500000, SDA_OLED, SCL_OLED, GEOMETRY_128_64, RST_OLED); // addr , freq , i2c group , resolution , rst

void VextON(void)
{
  pinMode(Vext,OUTPUT);
  digitalWrite(Vext, LOW);
}

void VextOFF(void) //Vext default OFF
{
  pinMode(Vext,OUTPUT);
  digitalWrite(Vext, HIGH);
}

void setup()
{
  Serial.begin(115200);
  VextON();
  delay(100);
  factory_display.init();
  factory_display.clear();
  factory_display.display();

  pinMode(LED ,OUTPUT);
  digitalWrite(LED, LOW);

  pinMode(ADC_Ctrl,OUTPUT);
  pinMode(VBAT_Read,INPUT);
  adcAttachPin(VBAT_Read);
  analogReadResolution(12);
  readBatteryVoltage();
}

void loop()
{
  readBatteryVoltage();

}

uint16_t readBatteryVoltage() {
  // ADC resolution
  const int resolution = 12;
  const int adcMax = pow(2,resolution) - 1;
  const float adcMaxVoltage = 3.3;
  // On-board voltage divider
  const int R1 = 390;
  const int R2 = 100;
  // Calibration measurements
  const float measuredVoltage = 4.2;
  const float reportedVoltage = 4.095;
  // Calibration factor
  const float factor = (adcMaxVoltage / adcMax) * ((R1 + R2)/(float)R2) * (measuredVoltage / reportedVoltage); 
  digitalWrite(ADC_Ctrl,LOW);
  delay(100);
  int analogValue = analogRead(VBAT_Read);
  digitalWrite(ADC_Ctrl,LOW); // *********************** Jim

  float floatVoltage = factor * analogValue;
  uint16_t voltage = (int)(floatVoltage * 1000.0);

  factory_display.clear();
  factory_display.display();  
  factory_display.setFont(ArialMT_Plain_10);
  factory_display.setTextAlignment(TEXT_ALIGN_CENTER);
  factory_display.drawString(64, 0, "Battery Status");
  factory_display.setTextAlignment(TEXT_ALIGN_LEFT);
  factory_display.drawString(0, 10, "Voltage");
  factory_display.setTextAlignment(TEXT_ALIGN_RIGHT);
  factory_display.drawString(128, 10, String(floatVoltage));
  factory_display.setTextAlignment(TEXT_ALIGN_LEFT);
  factory_display.drawString(0, 20, "milliVolts");
  factory_display.setTextAlignment(TEXT_ALIGN_RIGHT);
  factory_display.drawString(128, 20, String(voltage));  
  factory_display.display();
  delay(10000);
}

If you don't see 3.7V at ADC_IN then I suspect that the MOSFET is bad.

the MOSFET and pin 37 works. i have measured 0,68VDC @ ADC_IN