I want to monitor the input voltage on a ESP32 for to can handle the percentage and time left before my battery come to 3.3V
I can already handle this using a voltage divider and an average of adc1_get_voltage() values during a small time but prefer to can get this without any external wires/resistors
Note that Ihat I think to use an TP4056 for to handle the battery charging
it is safe to charge the battery when using the output of the TP4056 for to power the ESP32 on the same time ?
And have I to add a regulator between the TP4056 and the ESP32 if the battery voltage can vary betwen 3.3V and 4.2V ?
(if yes, I think that I cannot handle this directly on the ESP32 and have obligatory to use the voltage dvider and adc1_get_voltage() calls for to can have the voltage before the regulator )
I use this AZDelivery NodeMCU32
(this is a ESP32-WROOM 32)
Where can I find an example sketch that measure directly the Vin (5V) input of the ESP32 using only internals ?
I prefer to can first directly measure the Vin=5V voltage without the use of externals resistors.
But if this is isn't possible or if I have to measure the input voltage before an optional regulator from 3.7V .. 4.2V to 3.3V between the TP4046 and the ESP32, I think to pass via an external diviser.
Because the V-in circuitry has no connection to the processor.
You could monitor 3.3volt VCC for a slight drop when the battery is nearly flat.
Or keep track of how long the ESP has been used after a re-charge.
Two external resistors is easier, and they can be of relative high value.
ESP8266 boards use values of 100k-220k. Virtually no drain on the battery.
I think perhaps to buy the SparkFun ESP32 Thing in the future because it's seem already to have all the necessary for to can charge the LIPO battery without any supplementary chips or resistors
Can it handle the load sharing, cf. can only sometimes to be alimented via the USB port for to charge the battery when the ESP32 is already alimented/running from the battery ?
And what about the bluetooth part, this part don't seem to be present in this development platform ?
(I project to use the bluetooth for to can use this system as a classic bluetooth speaker at a "near" term)
But I have already a lot of 5x ESP32 that I have finded at 32,99 € the lot, so only about 6.60 € by unity
a lot of 10x TP4056 at 6,99 €, so about 0.70 € the unity
and have buy a lot of 3.3V output regulators with the input voltage that can vary from 2.3V to 6V at 11,39 € the lot of 10, so about 1.15 € by unity
=> this give a little total of 6.60 € + 0.70 € + 1.15 € = only 8.45 € per unity if I assemble the all myself
==> this is very very more cheap than the price of 21.95 $ for the SparkFun ESP32 Thing, cf. more than 2.5 times less + I have the bluetooth support in addition ...
(but OK, the Sparkfun solution occupies very much less space for to handle the LIPO part ... but without the bluetooth support )
My ESP32 cannot operate via a 5V booster between the + and - pins on the LIPO battery and the GND / V5 pins on the ESP32
(I have too tested with a breadboard alimentation on 5V and with another on 3.3V, such as with a USB cable where I have extract the + and - wires but nothing seem to work with the alimentation on the V5 or V3.3 pins, only with an alimentation via the USB port)
So ultimately, I use now this power supply module and it allows perfectly me to power an ESP32 by a LIPO battery through the USB port
(no need for the USB anymore because I am now updating the ESP32 in OTA)
I don't know if this module can manage load-sharing, i.e. allow the LIPO battery to be loaded via the micro USB port at the same time as the USB type-A socket is used to power the ESP32 but I have asked the vendor about it and think test it in the middle of the next week if I get not response from it
I think to use a simple voltage divider for to can control the tension on the LIPO side in a very near time