When looking for a way to measure the battery voltage of an ESP8266, the idea came up to show this on a display as well.
The ESP is supplied via mini USB or a battery. The display shows the voltage at Vin (in this version max. 33Volt).
The voltage for the ESP is then reduced to a maximum of 3.3V by dividing the voltage.
The structureThe SH1106 display is connected via I2C, with D1 on the ESP with SCK on the display (yellow line) and D2 with SDA (green line). Ground with ground (black wire) and 5V with VDD (red wire). The 10k Ohm resistor comes from ground (black wire) and to A0 on the ESP (blue wire). The 100K Ohm resistor is connected to Vin (brown wire) and also to A0 on the ESP (blue wire).
AttentionWith the brown wire you can test the 3.3V or 5V of the ESP, but if you want a long time test with DeepSleep, you should add a transistor on the brown wire.
In the Sketch you should add your values off R1 and R2.
The Sketch did not work correct with ESP32 on any GPIOs.
Then the sketch continues...
Comments