The weather station is run by a 18650 Li-Ion battery, so it is very important to monitor its status. The max voltage input to the Wemos board is around 3.2~3.3V but a fully charged 18650 battery voltage is 4.2V. So to measure this voltage we have to step down the voltage by using a voltage divider network.
The Wemos D1 mini already has an internal voltage divider that connects the A0 pin to the ADC of the ESP8266 chip. The voltage divider is made up off 220k (R1) and 100k (R2). So, we have to add an external resistance with the inbuilt 220k resistor to read the battery voltage. By using a 100k resistance we can measure the max voltage of the battery, but taking some margin, a 220k resistor is selected. It is named R1 on the PCB board and located just above the battery holder.
To select the voltage divider resistance values, you can use this online calculator.
You can also read this article on battery voltage monitoring.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.