I need to monitor the battery voltage with the on chip ADC , pin 6 on the ESP8266.
The basic command value = io(ai) works fine to get a value of the voltage on the pin .
From the datasheet the ADC can be connected to pin 3/4 and in that case it will provide the value of the chip supply voltage , else the analog value will be from outside .
Is there a way to switch between the 2 options , I notice it is part of the startup sequence so not possible while program is running i would think.
The other problem is the reference voltage / value that is used to get the ADC value.
In a quick test with the supply voltage at 3.315V I did a few readings :
1.06v 1023 count any higher input and it stay at 1024
1.0 v 966
0.9v 865
0.8v 772
0.7v 675
0.6v 579
0.5v 481
0.4v 387
0.3v 292
0.2v 195
0.1v 95
0.05v 49
The above readings change if the supply voltage changes.
The chip datasheet also mention a 2.5V default value that can be selected for RF Calibration and optimization . How to select it , will it help ?
I do not want to use an external adc due to space problems.
Any ideas how to get stable adc readings ?