ESP8266 10 having a built-in ADC, ADC is only one channel (A0 pin) , i.e., only one ADC analog input voltage pin can be read from an external device
ADC channels and on-chip supply voltage ESP8266 multiplexing, which means we can set the system to measure voltage or the external voltage
Measuring the external voltage
analogRead (A0), an external voltage is applied to the ADC reading pin module;
Input voltage range: 0 - 1.0V;
Accuracy Since the ADC resolution of 10 bits, and therefore gives a value range of 0-1023;
Precautions : To support external voltage range (0-3.3v), NodeMcu made a resistive divider, as shown:
example
Write a read analog voltage on the ADC pin NodeMcu. Here we use potentiometer provides a variable voltage 0-3.3V on the ADC pin. FIG cable follows:
Code:
void setup() { Serial.begin ( 115200 ); // Set the baud rate } void loop() { Serial.print("ADC Value: "); Serial.println (analogRead (A0)); // output corresponding to the external input voltage 0-1023 0-1.0v Delay ( 1000 ); }
Long emperor arrogance