Comments on: ESP8266 ADC – Read Analog Values with Arduino IDE, MicroPython and Lua https://randomnerdtutorials.com/esp8266-adc-reading-analog-values-with-nodemcu/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Tue, 11 Jun 2024 13:55:29 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Manfred Bikardes https://randomnerdtutorials.com/esp8266-adc-reading-analog-values-with-nodemcu/#comment-904483 Mon, 08 Apr 2024 08:16:16 +0000 http://randomnerdtutorials.com/?p=13479#comment-904483 Great tutorial but what is on a ESP8266-01S Chip. We use this smal-tiny-chip for several jobs and all works fine. Last days i tried to read an Voltage within 0 V – 3,3 V. In my understanding there is PIN GPIO0 to use for this in additon with a voltage-divider. I use a 100 kOhm and 220 kOhm resitors. This should brings 0 to 3,3 V in a range of 0 to 1V in the middle of the divider.

Minutes later the first test is placed on a bread-board. The sketch is realy simple like this:

#define LEDPin 2 // Internal LED on GPIO2
const int A0 = 0; // IO0 as ADC-input

void setup() {

// Serial-output active and PIN-Modes
Serial.begin(115200);
pinMode(LEDPin, OUTPUT);
pinMode(A0, INPUT);

// read voltage as (0-1023)
int Voltage = analogRead(A0);

// UB+ calculation depend on 3,3V
float ActualVoltage = (Voltage / 1023) * 3.3;

// Print Voltage on serial-monitor for testing
Serial.print("Voltage: ");
Serial.print(ActualVoltage);
Serial.println(" V");

delay(1000);

}

In every loop-step i see only 0,00 V as output. Where is th ebug in this quite easy run?

I read in an other article that the ESP8266-01S have 2 separate ADC-Modes. One is to read the VCC+ internal and another ist to read voltage on GPIO0 as a ADC-Input.

Have i missed some preparations? Hope you can help this problem on my ESP82-01S chip.

Thanks and have a great day,
Manfred

]]>
By: Russell https://randomnerdtutorials.com/esp8266-adc-reading-analog-values-with-nodemcu/#comment-581058 Mon, 29 Mar 2021 11:14:13 +0000 http://randomnerdtutorials.com/?p=13479#comment-581058 In reply to Sara Santos.

Thanks Sara, Been on it for 3 days got a ADS1115 ill try that . Thanks for your help..

]]>
By: Sara Santos https://randomnerdtutorials.com/esp8266-adc-reading-analog-values-with-nodemcu/#comment-581033 Mon, 29 Mar 2021 10:25:41 +0000 http://randomnerdtutorials.com/?p=13479#comment-581033 In reply to Russell walker.

Hi.
ADC2 pins cannot be used when Wi-Fi is used. So, if you’re using Wi-Fi and you’re having trouble getting the value from an ADC2 GPIO, you may consider using an ADC1 GPIO instead, that should solve your problem.
See our GPIO pinout guide: https://randomnerdtutorials.com/esp32-pinout-reference-gpios/
Regards,
Sara

]]>
By: Russell walker https://randomnerdtutorials.com/esp8266-adc-reading-analog-values-with-nodemcu/#comment-580735 Sun, 28 Mar 2021 23:00:47 +0000 http://randomnerdtutorials.com/?p=13479#comment-580735 I need to send the anolog data to a web server have you got anthing on that I see many using digital inputs but i cant get it to work with analog input???

]]>
By: Sara Santos https://randomnerdtutorials.com/esp8266-adc-reading-analog-values-with-nodemcu/#comment-517832 Sat, 14 Nov 2020 11:34:55 +0000 http://randomnerdtutorials.com/?p=13479#comment-517832 In reply to Max.

Hi Max.
You are right.
Thanks for pointing that out.
I’ll fix the tutorial.
Regards,
Sara

]]>
By: Max https://randomnerdtutorials.com/esp8266-adc-reading-analog-values-with-nodemcu/#comment-517143 Thu, 12 Nov 2020 17:25:41 +0000 http://randomnerdtutorials.com/?p=13479#comment-517143 Hello,
Thank you for all!!
About your comment :
“If you want to output PWM signals based on the input voltage of the ADC pin, you need to convert the ADC values to a range of 0 to 255. You need to do this because the PWM output only has 8-bit resolution”
I think that PWM output 8-bit resolution is for Arduino Uno.
I think that Esp8266 use 10 bit for pwm.
It’s correct?
Max

]]>
By: Karanbir https://randomnerdtutorials.com/esp8266-adc-reading-analog-values-with-nodemcu/#comment-465264 Thu, 11 Jun 2020 02:30:46 +0000 http://randomnerdtutorials.com/?p=13479#comment-465264 Hi,
The article like all others is a fantastic read.
Do you have one to read temperature using NTC and ESP8266?
Best regards.

]]>
By: Alan https://randomnerdtutorials.com/esp8266-adc-reading-analog-values-with-nodemcu/#comment-463068 Wed, 03 Jun 2020 20:06:00 +0000 http://randomnerdtutorials.com/?p=13479#comment-463068 How would you go about changing on the fly the color of an icon to match the temperature or humidity?

]]>
By: Lee de Vries https://randomnerdtutorials.com/esp8266-adc-reading-analog-values-with-nodemcu/#comment-428714 Wed, 12 Feb 2020 01:57:13 +0000 http://randomnerdtutorials.com/?p=13479#comment-428714 Great series Rui & Sara!
One thing that I have noticed with all my ESP8266’s is that when I connect A0 or ADC sirect to ground, I NEVER read 0. It is always a value of 2 and occasionally 3. Have you noticed this at all?
The value can be scaled of course by subtracting 2, but this occasionally gives an error when it is 3.
I suspect this must have something to do with noise on the Vref, but of course there is no decoupling pin for it!
How do you overcome the problem?

]]>
By: warsonne https://randomnerdtutorials.com/esp8266-adc-reading-analog-values-with-nodemcu/#comment-403696 Tue, 29 Oct 2019 13:36:26 +0000 http://randomnerdtutorials.com/?p=13479#comment-403696 Hello,

Thank you very much to share this nice code ! I have a problem. I try to use this code with a DHT22. On the charts it Always shows the same value for temperature (24.3°C), humidity (57%).

If I print the values in the serial monitor Inside the loop, the values changed and are true but not on the charts. It seems that the function of reading temperature, humidity and pressure are not executed.

Could you help me to fix this problem. Thank you very much !
Best regards

]]>