-->
Page 1 of 1

Esp8266 nodemcu dev board running arduino analog issue

PostPosted: Fri Jul 03, 2015 9:57 pm
by Iisfaq
Hi

I am wanting to also use an ESP8266 and ACS712 via the analog IN port.

I am using a NodeMCU board running arduino

But a simple sketch that just reads from the port and displays the data shows a problem for me.

void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
}

void loop() {
// put your main code here, to run repeatedly:
Serial.println(analogRead(A0));
delay(50);
}

Shows the following values for different voltages applied to the analog input port.

0.0v = 709
0.1v = 714
0.2v = 720
0.3v = 725
0.4v = 730
0.5v = 738
1.0v = 764
1.5v = 796
2.0v = 827

Removed power = 702
Floating = 747

The power is provided by a Bench Supply with Positive connected to A0 and GND connected to GND on NodeMCU

can anyone confirm if this is also the case for other users of nodemcu dev board?

why is this not giving me a 0-1024 scale like I would expect with arduino?

Also I read online that esp8266 only supports 0-1v add but this shows something else if happening.

Re: Esp8266 nodemcu dev board running arduino analog issue

PostPosted: Fri Jul 03, 2015 10:55 pm
by trackerj
Iisfaq wrote:Hi

I am wanting to also use an ESP8266 and ACS712 via the analog IN port.

I am using a NodeMCU board running arduino

But a simple sketch that just reads from the port and displays the data shows a problem for me.

void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
}

void loop() {
// put your main code here, to run repeatedly:
Serial.println(analogRead(A0));
delay(50);
}

Shows the following values for different voltages applied to the analog input port.

0.0v = 709
0.1v = 714
0.2v = 720
0.3v = 725
0.4v = 730
0.5v = 738
1.0v = 764
1.5v = 796
2.0v = 827

Removed power = 702
Floating = 747

The power is provided by a Bench Supply with Positive connected to A0 and GND connected to GND on NodeMCU

can anyone confirm if this is also the case for other users of nodemcu dev board?

why is this not giving me a 0-1024 scale like I would expect with arduino?

Also I read online that esp8266 only supports 0-1v add but this shows something else if happening.


You should take a look at that speficic board schematic if is not a voltage divider or something on the ADC Input. The problem is related with Arduino IDE code only or also with NodeMCU LUA one?

Also a little bit of filtering near close of the ADC IN pin might help to remove noise from the signal that you want to read.

In case of ASC712, if you have a noisy environment, reducing the filter bandwidth with a proper adjust of the Cf cap can help a lot.
Other commons mistakes:
- drive more than the specified 10 nF maximum capacitance with the output of the device.
- drive less than the specified 4.7 kΩ minimum resistance with the output of the device.

See ACS712 datasheet for more details.

Might worth to take a look at the related articles from below:

- ESP8266 Internal ADC

- ACS712 Current Sensor
- PART 2 - ACS712 Current Sensor