Wemos A0 Pin

Is the A0 pin on the Wemos simply not that accurate? I'm getting voltage readings on the pin that are higher than the real voltage. For example, voltage is 2.03 and it is giving me a reading of 2.2. I thought it might be inaccuracies in the 220k/100k onboard divider so I removed the 100k resistor and applied a voltage of 0.902v and it still reads around 0.92v. I've tried 4 or 5 boards and they are all the same. Are they just not that accurate? I'm using Wemos D1 Mini and D1 Mini Pro.

Thanks.

I just hooked up an ADS1115 board and it's pretty much bang on with my volt meter. Meter is showing 0.997V and ADS is showing 0.999 which is 0.2% difference. The Wemos in comparison is a good 8% out.

The Wemos doesn't give you a voltage reading but simply an integer as the output of the ADC. This voltage depends on the system voltage as the input voltage is compared to it. You failed to post code so we cannot check if you made errors there.

The ADS1115 has an internal reference voltage so it doesn't depend on a constant and correct system voltage.

pylon:
The Wemos doesn't give you a voltage reading but simply an integer as the output of the ADC. This voltage depends on the system voltage as the input voltage is compared to it. You failed to post code so we cannot check if you made errors there.

The ADS1115 has an internal reference voltage so it doesn't depend on a constant and correct system voltage.

Basic code is below. The input is showing 5.00 or 5.01 volts so shouldn't be causing issues. That's just measured with a volt meter so maybe it's noisy but wouldn't think so.

void setup() {
pinMode(A0, INPUT);
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
int val1 = analogRead(A0);
float val2 = val1 / 1023.0; // * 3.2
Serial.print(val1);
Serial.print(", ");
Serial.println(val2);
delay(1000);
}

The NodeMCU has AFAIK an absolute (not ratiometric) A/D with ~1volt reference, with a 100k:220k divider.
And, like the Uno, that reference is stable but has some tolerance.
Just leave that original voltage divider in, and add 100k for every volt more than the ~3.2volt of the original divider.
Then calibrate (which you should always do anyway).
Leo..

float voltage;

void setup() {
  Serial.begin(9600);
}

void loop() {
  voltage = analogRead(A0) * 0.0029326; // calibrate by changing the last digit(s)
  Serial.print(voltage);
  Serial.println(" volt");
  delay(1000);
}

Wawa:
The NodeMCU has AFAIK an absolute (not ratiometric) A/D with ~1volt reference, with a 100k:220k divider.
And, like the Uno, that reference is stable but has some tolerance.
Just leave that original voltage divider in, and add 100k for every volt more than the ~3.2volt of the original divider.
Then calibrate (which you should always do anyway).
Leo..

I have tried doing a calibration but from memory it moves. I'll give it another try, it could be that I swapped out to a different Wemos. It's still something I would prefer not to do as I will quite often flash a Wemos, run out to various parts of my property (sheds, front gate) and swap it out.

You might try the code mentioned in the October 10, 2018 post: Fluctuating ADC with stabilized source · Issue #2070 · esp8266/Arduino · GitHub If it works, let us know!

DaveEvans:
You might try the code mentioned in the October 10, 2018 post: Fluctuating ADC with stabilized source · Issue #2070 · esp8266/Arduino · GitHub If it works, let us know!

Thanks, I just gave it a try but no go. I tried disconnecting wifi and it's still no good. That thread has really just confirmed the issues with the analog input. As someone in that thread pointed out, use an ADS1115 and it's rock solid straight off. It didn't take long to get it working and those boards are only a couple of dollars.

Wawa:
The NodeMCU has AFAIK an absolute (not ratiometric) A/D with ~1volt reference, with a 100k:220k divider.

Correct.

I've been using the ADC of the ESP8266 a lot, haven't found instabilities yet. The ADS1115 also does the job of course.