Voltage on Analag pin, without any input device?

Hy everybody
i use a wemos d1 8266 board and test thuis sketch:

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

void loop() {
  Serial.print("ADC Value: ");
  Serial.println(analogRead(A0));
  delay(300);
}

it shows me:
ADC Value: 15

but i don't have any input signal on this pin. it isn't used.
Is it normal, that there are a "default" volatage?
do i need to substract some value, if i use the pin tho measure the voltage of a sensor??

Yes.

The ADC is reading the voltage of the "unused" input.

is this millivolt?
if i use the volt to calculate something, do i need to subtract it?

Hello jumbo125

Take view here to gain the knowledge.

https://learn.sparkfun.com/tutorials/analog-to-digital-conversion/all

Try connecting the analogue input to GND. The reading may become lower.

No, it should read zero if the A0 pin of the D1 mini is not connected. As suggested, try connecting it to ground to see if that makes a difference.

On most arduino, like Uno etc, or a bare esp8266 module, a floating (unconnected) analog pin could read any value. But on D1 mini, there is a voltage divider on the board:


The resistor R2 should pull the ADC pin down and cause it to read zero if A0 is unconnected.

No. The input range of the ADC on the esp8266 module is 0.0V to 1.0V. However, that voltage divider on the D1 mini increases that range to 0.0V to 1.0x(100+220)/100 = 3.2V.

The ADC has 10 bit resolution, so an increase of 1 in the ADC reading corresponds to 3.2/(2^10) = 3.125mV

oh... okay, please a little bit slower.....

if i have nothing connect on my esp8266 it shows:
ADC Value: 15
are this 15 milliVolts?

i will be use a Anemometer.
My project:
connect plus to A0
connect minus to GND

That could damage the D1 mini (assuming it isn't already damaged, which seems to be a possibility), depending on what type of anemometer. Please post a link to the specs of the anemometer.

Did you read the post #6, didn´t you?

i choose one with lower than 3.3v output.

yes, but i'm not sure what i should do......

what should i connect to ground? i have nothing connect with the board, when it shows the ADC 15....
only the micro usb is connected

The page you linked says

Ausgangsspannung: 0V - 2V

So it should be safe to connect to A0 pin.

The linked page also describes how to calculate the wind speed:

Auswertung des Signals: Windgeschwindigkeit (m/s) = Spannung (V) x 25
Beispiel: Am Windsensor wird 1V gemessen. 1 x 25 = 25m/s
Umwandlungsfaktor m/s zu Km/h= 3,6
25m/s x 3,6 = 90Km/h

An input of 1V from the anemometer (=90Km/h) would give an ADC reading of 1/3.2x(2^10) = 320.

So your sketch can calculate the wind speed in Km/h like this

float windSpeed = 90.0 * analogRead(A0) / 320.0;

yes, i have the calcuting finish.

I only don't understand the input in the arduino:
why i get a value if i use

Serial.println(analogRead(A0));

WHEN NOTHING is connected. only the micro usb to my lapetop.
There is NO input. ONLY the MICRO USB to my computer.

I do not understand also. As I explained, it should read 0.

My theory at this time is that it is damaged or faulty.

Did you follow the suggestion from @JohnLincoln ? What was the result?

i should use GND.
but what should i put into ground?

oh..... i think i found the problem:

Please tell me if i think correct!

My idea:

ADC is NOT VOLTAGE
:exploding_head:

Analog to Digital Conversion - SparkFun Learn.

So i need to calculating the ADC to VOLT

1023adc ...... 3.3v
1adc .......... 0,0032258v ==    1adc........  3,22mV

when nothing is connected, it meassure 15 ADC. Thats are 0,045V

is it possbile thats this low voltage is the voltage from the board, becaus it is connected with my pc?

I just uploaded your code to one of my Wemos D1 Mini Pro.

I was surprised by the result.

I also see 14 or 15 with A0 not connected.
If I connect the A0 pin to ground, I get the value 10.
If I connect the A0 pin to 3V3, I get the value 1024.

I then used another D1 Mini Pro

With this board I get value 2 if A0 is not connected
If I connect the A0 pin to ground, I get the value 1.
If I connect the A0 pin to 3V3, I get the value 1024.

So maybe your results are normal for esp8266/wemos d1 mini.

I was surprised that connecting to 3V3 gave 1024 instead of 1023 which I expected. Apparently this is a known "feature":

thank you for your great help!!!!!

what do you think about my post #16

I explained this in post #6

oh.
know i understand your post!
that was mean by the confusing calculation on the bottom of the post.
sorry :flushed: :scream: