Measuring Vin (not Vcc) on a NodeMCU

Not sure if this is an issue, feature request, or simply impossible given the hardware, but is there any way to measure the voltage at Vin (not Vcc) on the NodeMCU boards? Thanks

1 Like

you Need to create a voltage divider on the vin pin and measure in a0
Basically the circuit has two resistors
The sum of the two resistor should be a high value. Like 50k or more, so your circuit will not consume power
Now you have to create a divisor such that the maximum input value you have e.g 12volts is divided such that the result is slightly less than 3.3v (this is because the input on the nodemcu
Reads up to that value)
Search web for resistor divisor calculators so you find values you can buy.
Then on esphome you do the math to calculate the right voltage.

Here is good info for what you want https://randomnerdtutorials.com/esp8266-adc-reading-analog-values-with-nodemcu/

1 Like

Thank you both. This is helpful!