Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
sibianul
Normal user
Posts: 28
Joined: 28 Jun 2017, 11:53

Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#1 Post by sibianul » 04 Oct 2017, 10:13

Hello guys,

I burned v2.0.0-dev12 in this board, and I wanted to be able to measure the onboard battery voltage, but because I didn't found any documentation about this board, with the battery socket embeded, I don't know if it has an volt divider or not.

I'm one step away to give up and throw away this board, I'm so pissed of right now as I tried another thing someone esles recommanded and I still dont get a good reading.

If anyone knows how to measure the battery voltage on this board please let me know !!!

1. I tried so far to make a volt divider using R1 a 15k and R2 a 4k7 resistor, using this the voltage on the A0 pin was very low, just 0.2v when the battery was 3.9v.

2. If I mounted the a wire and no wires to the A0 pin, the reading was saturated, and I got a 1024 value

3. On someone else recommandation I placed just a resistor between the + pin of the battery and the A0 pin. First I measured with the multimeter multiple resistors, to find which one droped the voltage to 1v, and it was 3M3 resistor, but I didn;t know that after connecting the wire to the A0 pin the voltage dropped even more :( So I swapped the resistor with a 1M one, with this one and the wire connected to the A0 pin I have 0.76v and a reading of 295... but for 0.76v shouldn't the reading be higher, if max is 1v than 0.76v should have resulted a reading of ~700 ?

Any help is appreciated, I will ask you later about the formula, but now I first want to have a good reading value, than we will see how to convert it to volts, so the board will report to my controller directly the voltage value, not an number between 0 - 1024.
3m3 resistor to A0 pin.jpg
3m3 resistor to A0 pin.jpg (41.24 KiB) Viewed 20475 times
ESP-WROOM-02 with 18650 battery.jpg
ESP-WROOM-02 with 18650 battery.jpg (77.82 KiB) Viewed 20475 times
Thank you.

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#2 Post by Drum » 04 Oct 2017, 18:17

You need a resister divider rather than just a resister. Google will give you several calculators. You probably want to figure a max of 4.5 to 5V = 1V then figure the multiplier and add that to the formula.

That is an interesting board, where did you find it?

To revise the above, try a resister divider, but I think you need to find a schematic to really know how to do this. Without that, use something like an INA219 or a ADS1115

Try contacting Wemos, but there is nothing on their site about this

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#3 Post by grovkillen » 04 Oct 2017, 18:59

I just ordered that board! Good to see more ppl also using it.

@Drum: I bought this one...
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#4 Post by papperone » 04 Oct 2017, 19:46

You need to check if there's already a voltage divider on the PCB (I don't see it but I can't confirm just form a picture).
The best way to check, if you can, is to apply 1VDC to the ADC and see the reading; if close to 1024 then no voltage divider confirmed.
A good voltage divider I do use is 100K/220K resistor (100k between ADC and GND and 220K between ADC and reading point); this will bring 5V to 1V.
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

sibianul
Normal user
Posts: 28
Joined: 28 Jun 2017, 11:53

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#5 Post by sibianul » 04 Oct 2017, 22:22

Drum wrote: 04 Oct 2017, 18:17 You need a resister divider rather than just a resister. Google will give you several calculators. You probably want to figure a max of 4.5 to 5V = 1V then figure the multiplier and add that to the formula.
@Drum, a volt divider was my first option, but with a volt divider the reading was very low, as I said in my first post, with a volt divider the reading was ~200 for a 3.9v battery, so the battery was almost full

@papperone, near the A0 pin you can see 2 resistors , I though that was a volt divider, but when I placed the 3.9v + wire to the A0 it was saturated, so that is not a volt divider, or it's not a volt divider to measure it's own battery, it seemed weird for me.
I need to bring 4.2v to 1 v, the li-ion battery will not be charged more than 4.2v.

I want to use this board togheter with a 69x150mm 5v solar panel, hobefully the battery will last a few years this way :) But I will need to monitor the battery voltage, I need to make that work.

I attached a close up with the 2 resistors that I though ware used as a volt divider
File_000 (27).jpeg
File_000 (27).jpeg (1.46 MiB) Viewed 20437 times

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#6 Post by papperone » 05 Oct 2017, 06:57

Oh well, that's weird...
ADC pin on the WROOM-02 should be (looking at your picture) 3rd from the bottom on the left side (upside down as it is).
while on the output AD I do see a 220K resistor (224) that is matching what I wrote, the other one is a 1ohm!! (010) making the didiver pointless.
But... I don't see traces on this side of the PCB from the AC pin to "somewhere else" so I'm fairly assuming they are on the other side, so if you can't see other side will be hard to give you a steady answer.

BTW, if you have a bench power supply, woudl be great to try to supply 1VDC to the AD pin as I suggested and check what is the chip reading...
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#7 Post by papperone » 05 Oct 2017, 07:00

just noted as well (just to make sure you did it) the jumper for sleep mode is shorten...
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

sibianul
Normal user
Posts: 28
Joined: 28 Jun 2017, 11:53

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#8 Post by sibianul » 05 Oct 2017, 09:02

papperone wrote: 05 Oct 2017, 07:00 just noted as well (just to make sure you did it) the jumper for sleep mode is shorten...
Just a quick reply (I can't test more now as I have some urgent things to do) but just wanted to let you know that I shorten sleep the jumper, I activated sleep, it's now reporting to my controller every 4 minutes. Having it on all times, the battery was discharged in less than a day. With sleep activated the voltage is dropping very slow, still at 3.91v.

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#9 Post by Drum » 05 Oct 2017, 11:45

Those 2 resisters could be a divider, but without a schematic there is really no way to tell.

The wroom-02 also has this in the datasheet for the ADC (TOUT) pin "Tests the power supply voltage of VDD3P3 (Pin3 and Pin4) and the input power voltage of TOUT (Pin6). However, these two functions cannot be used simultaneously. This interface is typically used in sensors." but I am not really sure what they are saying and again, without the schematic, there is no way to know what is between the Wroom-02 and that pin.

Have you tried contacting Wemos?

As far as measuring voltage on something like this, I have found using an ina219 on a separate ESP8266 works much better and will not draw on the battery further, you can also use that to monitor the power from the solar cell to see how effective it is. If you can get the ADC pin to work, that is easier, cheaper and probably a lot better long term, but the ina219 will also give you mA, which would be interesting for the solar cell, I think. I am using that on several to monitor batteries.

A couple of other notes:
This uses an AMS1117 regulator ( I refuse to call it an LDO, max of 39% of output is NOT low) which has between 1V and 1.3V dropout. If the battery is feeding in to this, you need 4.3 to 4.6V to get 3.3V! If there is a diode on this it will be even worse. This is fine for a 5V wall wart, but not so great for batteries. I assume these must be dirt cheap, because there are a lot of better voltage regulators out there.

I have several solar powered ESP units I am testing and I am still split between 18650 and 4 X AA Nimh. For the 18650 units, I use 6V solar cells (you never actually see 6V out of them, especially with a load.) feeding into an inexpensive TP4056, and a MCP1826 Voltage regulator with a shutdown pin. I have also started using a KA75330 voltage detector to turn off the regulator when the battery voltage drops below 3.3V. This winter will be a good test, as it gets very cloudy here, but the one unit outside ( not in a window) has never run down and as an example just before the sun came up today the battery voltage was 3.91V. This is on a ESP8285 with external antenna, BME280, 6V - 6 X 11 cm solar cell, 18650 battery set to sleep for 10 minutes, running ESPEasy 148 I think.

I had a problem of the ESP "locking" at low voltage and not resetting when the voltage comes back up, so I bought a bench power supply and started testing. If the input voltage drops to 2.0V the esp will not recover without a hard reset. With the MCP1826 and good Schotky diode, max dropout is about .5V, so at 3.3V battery I still get 2.8V to the ESP. I also have several capacitive soil moisture sensors where input voltage dramatically changes the moisture reading (860 at 3.3V and 760 at 3.0V). I can use the KA75330 to shut down if the output voltage from the voltage regulator falls below 3.3V. Of course this also keeps the batteries from getting drained to nothing hopefully extending their useful life.

While the modules like Node MCU and wemos work great, they are designed for a 5V wall wart and do not work on batteries very well (ams1117). The adafruit feather huzzah is an exception as it has a built in Lipo charging circuit and the voltage regulator is an AP2112 with a typical dropout of 250mv at 600 mA. If it had Solar charging built in, it would be almost perfect, although expensive.

The best solar charging circuit I have used is https://learn.adafruit.com/usb-dc-and-s ... q?view=all . It really maximizes the amount of power from the sun. Unfortunately it is expensive and has more bells and whistles than I need for most projects. I also don't know if it will work on an 18650 battery. The chip it uses is not easy to solder so I have not tried to incorporate something like this into my design, yet. I have dreams of doing re-flow, but I probably need to find a job first, which would limit the time I have to work on these things. ;)

sibianul
Normal user
Posts: 28
Joined: 28 Jun 2017, 11:53

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#10 Post by sibianul » 05 Oct 2017, 16:35

Another short reply as it seems today wasn't a good day either, I feel so so sick to my stomach :(
Drum wrote: 05 Oct 2017, 11:45 ... ina219 on a separate ESP8266 works much better..
Why on a separate ESP ? can't this battery powered ESP measure the voltage of it's battery ? It seems those ina219 are dirt cheap on ebay.

Someone esle also told me to measure the resistors, I hope I did it correctly, please check out this short video

https://www.youtube.com/watch?v=gGO5WWQRGSw

Here is a schematic of the charging part of the battery, I found on banggood website
wroom 02 battery 18650.png
wroom 02 battery 18650.png (13.95 KiB) Viewed 20396 times
I also purchased some LiFePo batteries (3.2v) that I want to try without any regulator, this I think will be the best option for battery powered projects, but Ihaven't received yet the sockets for the battery, if I will get them I will try to spend a little time to make a PCB to mount the small board that will help to also charge the battery (by solar) I purchased some boards that can charge LiFePo battery also (just a solder bridge to change from Li Ion to LiFePo)

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#11 Post by papperone » 05 Oct 2017, 17:23

You can't measure resistors while they are actually soldered in a PCB as the measure is influenced by other components of course.
we need to rely on the numbers print on them and the one on the right in your video (as I wrote) reports 224 = 220k ohm while the left one if it's "010" it means 1 ohm which can't be in a correct implemented voltage divider.
So either you have a wrong resistor or the second resistor of the voltage divider is somewhere else. yu shoudl follow the PCB track from the ADC pin of WROOM2 to see where it goes.
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#12 Post by Drum » 05 Oct 2017, 23:39

Why on a separate ESP ?

If you use the same unit, you limit the number of time points, to only when it is running and not doing something else and you run the risk of the measurement process affecting the measurement.

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#13 Post by Shardan » 06 Oct 2017, 18:31

papperone wrote: 05 Oct 2017, 17:23 You can't measure resistors while they are actually soldered in a PCB as the measure is influenced by other components of course.
we need to rely on the numbers print on them and the one on the right in your video (as I wrote) reports 224 = 220k ohm while the left one if it's "010" it means 1 ohm which can't be in a correct implemented voltage divider.
So either you have a wrong resistor or the second resistor of the voltage divider is somewhere else. yu shoudl follow the PCB track from the ADC pin of WROOM2 to see where it goes.
Basically this is absolutely correct.

But what you can do easily is this:
- Use a good digital voltmeter/multimeter
- connect black cord of the multimeter to GND
- with the other cord check the voltage of the battery first,
then the voltage of the analog pin of the ESP (AOUT).

The ADC inside the ESP chip can convert analog voltages in the range of 0....1 V.
If you get very low voltages with a fully loaded battery the divider has a problem.

Regards
Shardan
Regards
Shardan

sibianul
Normal user
Posts: 28
Joined: 28 Jun 2017, 11:53

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#14 Post by sibianul » 07 Oct 2017, 11:28

Drum wrote: 05 Oct 2017, 23:39 Why on a separate ESP ?

If you use the same unit, you limit the number of time points, to only when it is running and not doing something else and you run the risk of the measurement process affecting the measurement.
That sensor also measures voltage? as I'm not that interested in current value, probably the current will be at the highest value when the ESP will be turned on from sleep, and indeed the measurements will not be quite realistic , but I don't mind having the voltage measured only once at 5 minutes, as I will set sleep interval ~5 minutes, will the voltage drop that much when the board will be ON from sleep?
dashboard measuring battery.jpg
dashboard measuring battery.jpg (73.61 KiB) Viewed 20364 times
These are the measurements made until now, the maximum value is around 300 .. so ~0.3v with the wiring I made a few days ago. I will try to make some scripts in my dashboard to find out when the voltage drops at a higher rate, to send a notification to my phone when the voltage drops faster, as I can see at low voltage, the battery voltage dropped quite fast. The values are not useful now, but I will see when I will be able to measure from 4.2v


I also want to let you know that I received more informations about the board, a user on esp8266.com forum found another blog with some more pictures with this board, it seems the R1 is 220k and R2 is 100k, so it will be able to measure up to 3.3v :(

https://macsbug.wordpress.com/2017/05/1 ... fi-module/

I don't get it, what's the point of measuring up to 3.3v when the battery maximum is 4.2v ? This is a battery powered board, isn't it logical to be able to measure the battery voltage with it ?

What suggestions do you have regarding on what modifications I can make to be able to measure up to 4.2v ? Is there anything simpler than just replacing the R2 resistors ? I will look over to see what resistors do I have around 68k value, as this is what the voltage divider calculator reported to be the R2 value, to be able to measure up to 4.2v

Any more advices are welcome.

Thank you

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#15 Post by Shardan » 07 Oct 2017, 12:17

sibianul wrote: 07 Oct 2017, 11:28 I don't get it, what's the point of measuring up to 3.3v when the battery maximum is 4.2v ? This is a battery powered board, isn't it logical to be able to measure the battery voltage with it ?

Thank you
Hello,

Remember, a "Battery Low" signal isn't a voltmeter. It is just a binary signal saying battery is OK or should be replaced / charged.

For a binary "Battery Low" signal a voltage higher then 3.3 V is out of any interest.

The voltage getting to 3.3V and below is important.

The divider is dimensioned to read a voltage of 3.3V and below with maximum accuracy.

That makes sense.

If you want to read the exact battery voltage instead the divider should be dimensioned to 1:4,5 instead of 1:3.3 .

Regards
Shardan
Regards
Shardan

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#16 Post by papperone » 07 Oct 2017, 12:30

Shardan wrote: 07 Oct 2017, 12:17
sibianul wrote: 07 Oct 2017, 11:28 I don't get it, what's the point of measuring up to 3.3v when the battery maximum is 4.2v ? This is a battery powered board, isn't it logical to be able to measure the battery voltage with it ?

Thank you
Hello,

Remember, a "Battery Low" signal isn't a voltmeter. It is just a binary signal saying battery is OK or should be replaced / charged.

For a binary "Battery Low" signal a voltage higher then 3.3 V is out of any interest.

The voltage getting to 3.3V and below is important.

The divider is dimensioned to read a voltage of 3.3V and below with maximum accuracy.

That makes sense.

If you want to read the exact battery voltage instead the divider should be dimensioned to 1:4,5 instead of 1:3.3 .

Regards
Shardan
I am not sure but being the ADC pin of ESP8266 1v tolerant, sending 4.2V with that voltage divider will step down to 1.3V.
I'm confident it can be handled but it's really out of specs (+30% from Vmax).
If you are familiar with SMD soldering, replace 220k resistor with a 400k resistor, this will make the AD0 input accept up to 5V (that will generate 1V on the ADC pin of ESP8266)
if you don't want to go to SMD then put a 180k resistor in series betwen the input pin of your module and the positive of your battery (180k+220k on the PCB = 400k)
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#17 Post by Shardan » 07 Oct 2017, 16:03

Hello papperone,

i've tested the ADC of the ESP8266 to see where the limits of conversion are.
I connected a potentiometer to 3.3V and ground, the slider to the ADC so i could vary the the voltage at the analog pin from 0 to 3.3 V.

Well, the ESP i used for that is luckily still alive.....

According to the HUZZAH manual from Adafruit the input can take 1,8V.
(Page 13 in http://www.mouser.com/pdfdocs/adafruith ... eakout.PDF )
so 1.3 V should be safe.

Regards
Shardan
Regards
Shardan

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#18 Post by Drum » 07 Oct 2017, 19:08

On the ESP-8166 ADC pin, you can exceed 1V, and the reading will be 1024. Exceeding it by too much may cause damage, but what that point is I do not know, best not to find out.
Before trying to replace resisters, you really need to check the schematic to see what these resisters actually do.

If you have an adjustable power supply, send 1 V to the ADC pin and see what value it gives you, that should tell you how much you can send through and what formula to use to get voltage.

The 2 resistors on the board where I would expect a divider to be do not make any sense for that purpose.

sibianul
Normal user
Posts: 28
Joined: 28 Jun 2017, 11:53

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#19 Post by sibianul » 07 Oct 2017, 22:41

As the board already had a 220k resistor I connected an 100k one inline and now I finally have a good reading :D

I used this formula to match the reading with my multimeter

%value%*4.4/1024

In the morning I will check again to compare the voltage on my multimeter with the reported voltage, hope it will still be synced.

Can you guys tell me how much those 3 resistors are affecting the battery life ? Can I use an transistor as a switch to close the circuit to the battery positive side only when the board is active, and before sleeping to open that circuit, for the A0 pin only, will it help ?

Yesterday the board dropped from the table, and since than I hear a whine, it's from the 3R3 coil on the board that now is cracked, the plastic parts, should I replace it ? It bothers me when it's on my table and it's complete silence, but the board will be on my roof soon, so I won't hear that. I don;t know if I can find one locally, I think I will need to order that coil online - hope 1 month as it takes an order from ebay will not damage the board, I don't know if the coil is still working as it should.
dashboard battery reading.jpg
dashboard battery reading.jpg (81.47 KiB) Viewed 20327 times
Tanks guys. Have a nice weekend.

chaoticatom
New user
Posts: 1
Joined: 26 Oct 2017, 17:37

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#20 Post by chaoticatom » 26 Oct 2017, 17:40

sibianul, any chance you could post a picture of how you connected the 100k resister? Did you remove the second 010 smd resister and replace with the 100k?

adampr1
Normal user
Posts: 17
Joined: 27 Jun 2016, 13:34
Location: Germany

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#21 Post by adampr1 » 27 Oct 2017, 08:36

Hallo all,
please check again photo with SMD resistor again - it's NOT "010" !!! its "01D" - 1% resistor with value of 100kOhm (please refer to http://www.rom.by/files/SMD-Resistors-EIA-Markings.html). Some high (mostly 1206 size SMD) precise resistors are marked with 4 digits, but smaller 0805 and 0603 resistors have mixed coding with digits and letters. It is already 100kOhm on PCB. For that modification please ONLY cut trace between 220kOhm resistor and A0 pin , scrape some lack from track on both sides cut place and solder small resistor 100kOhm on that place or put small axial wired resistor between pad of 220kOhm and A0 pin.
Sorry I don't have that board and can't make photos.

B.R.
Adam
Domoticz Beta release on OrangePI PC and BananaPI,
2x RFLink (last version),
ESPEasy, ESPEasy32 (different configurations),
MySensors (different configurations),
2x MiLight RGBW (over RFLink)
and others things :D

nehulagr
New user
Posts: 1
Joined: 07 Jan 2019, 20:48

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#22 Post by nehulagr » 07 Jan 2019, 20:51

If some got the code. Please share it! Here I am not able to understand how can I calculate the value of it, its really hard to get.

Thank you!

MaikelK
Normal user
Posts: 11
Joined: 20 Jun 2017, 19:56

Re: Some help to measure the Li-Ion voltage of ESP-WROOM-02 with battery socket

#23 Post by MaikelK » 21 May 2019, 23:01

So do we need to solder a wire from the + terminal too the AD pin?

I also want to monitor the battery voltage.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 3 guests