3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266... Even usable on ESP-01S - Quickest Start Guide
You should just use a single resistor between that voltage source and A0. Value of that resistor should be 100k for every volt more than 3.2volt. So for 15volt >> 15-3.2 = 11.8 * 100k = ~1200k (1.2Megohm).
I set the Sketch to display the readAnalog() value
Placed the 100k resistor in series
And slowly upped the bench meter 0.01 volt at a time. The 1024 reading came up at 4.16V!!!!
You ROCK!
Now, would you be so kind as to explain how that 100KΩ/V was calculated?
I'd like to learn that technique!
VBR,
Inq
3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266... Even usable on ESP-01S - Quickest Start Guide
Not sure if this applies to your board or not..but it does appear that an external RVD ( resistive voltage divider) is required as the ADC range is only 0-3.3 volts, for example: ESP8266 12-E NodeMCU Kit, WeMos D1 Mini, …) which I believe you alluded to in earlier post, which is a 0-3.3 v ADC input..
I wouldn't go beyond that to be on the safe side..just use an external RVD to make the input to the ADC in that range..as you stated.. you really don't care if it's above that anyway, you just want to know if it's <3 volts...right?
You could also do an auto shutdown at that level to keep from damaging the batteries.
The 18650 Shield seems to do a forced shutdown at 2.5V... so I better have it parked where it needs to be before that happens. 😉
Just finished the results using the 100 KΩ resistor...
@inst-tech, @zander, @will - This is plenty accurate for my project at hand. I'll save a shunt for another day.
Summary: 100 KΩ Resistor in-line between positive battery terminal of 18650 Battery Shield and the WeMos A0 analog pin. Allows 10bit A2D converter to monitor 0 to 4.2 Volts (Fully charged 18650 LiIon).
3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266... Even usable on ESP-01S - Quickest Start Guide
@inq I would like to know why a 100K ohm resistor was used. I think you said you needed 0.9V dropped across it so 4.2 looked like 3.3. In that case the current must be 9 micro amps unless they rescinded ohms law.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
@inq I would like to know why a 100K ohm resistor was used. I think you said you needed 0.9V dropped across it so 4.2 looked like 3.3. In that case the current must be 9 micro amps unless they rescinded ohms law.
@inst-tech - Said so! 😆 That's my story until a better one comes around.
He also left a reference link a couple posts back that hopefully will educate me better on the subject. Also a couple posts back, I explained I took his suggestion and tried it out using the bench power supply and incremented it in 0.01 volt increments and sure enough hit 1024 on the analogRead() method when the power supply showed 4.16V.
Slapped it in place, changed the Math in the Sketch and wa-la... nice smooth curve from 4.1V down to the battery shield shutting down.
When this thread started all I wanted was to have a way to keep from over discharging the battery, but turns out the Shield takes care of that at 2.5V
I then wanted a near end warning (3.3V was good enough) so I could head "home" in time.
But adding the 100 KΩ gives me the Full Monty.
Now, I can put a gas gauge dial on the UI remote control and know exactly where I am in the "fuel" tank.
3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266... Even usable on ESP-01S - Quickest Start Guide
@inq Sorry to be a pest, but this is what a typical Lithium discharge curve looks like. You are only showing the last little bit. There should be a little more than 10x to at least 5x time elapsed prior to your curve.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
@inq Sorry to be a pest, but this is what a typical Lithium discharge curve looks like. You are only showing the last little bit. There should be a little more than 10x to at least 5x time elapsed prior to your curve.
Not being a pest. You're just making me think about it!
I was expecting something like that curve as well. But there are several variables that are different in the way those curves are plotted.
Those Voltage=f(SOC) curves are different than Voltage=f(time)
State of Charge (SOC) is not anywhere near linear WRT time.
Those tests are performed at constant current... For most Lithium chemistries, they do it at 1C.
The current draw from the battery shield at 5.0 volts is relatively constant, BUT the 18650 Shield is having to convert a variable voltage between 2.5 and 4.2 up to 5.0 Volts. The efficiencies doing that are highly non-linear WRT supply voltage.
Besides the non-linear chip voltage conversions, there is also the fact at lower volts, more current has to be drawn to maintain the constant wattage the steppers are pulling.
Looking at it another way, the WeMos and steppers were drawing 5.0V * 600 mA * 2.42 hours = 7260 mAh.
The battery that is at least 20 years old and wasn't fully charged (4.05V) and part of some laptop battery that was abused was rated when new at 3.6V * 2350 mAh = 8460 mAh.
Still retains 86% of original rated capacity. Considering I didn't confirm the current draw during the test and the inefficiencies listed above, I'd say, that's a pretty good battery test.
3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266... Even usable on ESP-01S - Quickest Start Guide
I'm still researching exactly how the 100K in series with the ADC input works, but I'm inclined to think it's just another takeoff from the internal RVD in the ESP8266 providing a different reference voltage as far as the ADC is concerned. I'll keep at it until I can prove my theory..lol
@inst-tech Thanks, most of that I knew, was there something specific you thought I would be interested in?
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
@inst-tech I am still skeptical that a single wire from the battery + to an analog pin works. If it does, patent it and sell it to Victron, but in the meanwhile if I really want to know what is happenigh with a bettery I will use a shunt. Almost every day I see people on the RV forums using voltage to determine the health or capacity of their batteries. 99% have it wrong. For RV use you need true deep discharge batteries. Most do not have them but as long as they are always in a park and plugged in no problems. When it becomes a problem is when there is a prolonged power outage or they decide to camp off grid. Any lead acid battery will be damaged to some degree if the SOC goes below 50%. The voltage at the unloaded terminals after a resting time of maybe an hour is 12.2V. Most will think it is over 12 so good. NO. dead or soon will be.
I did my own solar, spent 2 years studying so I feel I know batteries fairly well. I can't prove it and don't care to but that measuring trick makes no sense to me. However, maybe it works well enough for his purposes so ok.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
I'm still researching exactly how the 100K in series with the ADC input works, but I'm inclined to think it's just another takeoff from the internal RVD in the ESP8266 providing a different reference voltage as far as the ADC is concerned. I'll keep at it until I can prove my theory..lol
I think, I'm starting to catch up with you. I dug this up and added what I think we're doing by adding the 100 KΩ.
Thus the Voltage Divider Formula becomes:
Vo = Vi * R2 / (R1 + R3 + R2)
Solving for R3:
R3 = (Vi / Vo - 1) * R2 - R1
Using the resistor values you found for the NodeMCU...
R1 = 220 KΩ
R2 = 100 KΩ
Vi = 4.2 Volts - Maximum voltage of a 18650 cell when fully charged.
Vo = 1.0 Volts - Maximum input voltage of the ESP8266 A2D
Thus: R3 = 100 KΩ
Works like a charm!
VBR,
Inq
3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266... Even usable on ESP-01S - Quickest Start Guide
Almost every day I see people on the RV forums using voltage to determine the health or capacity of their batteries. 99% have it wrong.
I understand you know what you are talking about. And you are correct. Using voltage to determine SOC... or battery health is a non-starter. It is wrong.
However, you are missing the point. In this project, we are not looking to know how healthy the 18650 battery is. It was originally to not over discharge the LiIon battery. This is no longer the issue. The Shield will not allow us to draw the battery down below 2.5 volts.
Now, the issue is to know when the Shield is going to shut down the robot so that the human (or robot) can make a decision to recharge. Determining the voltage is the only factor the Shield uses... therefore, it is the only one worth checking!
A shunt only measures current. There is no useful information knowing how much current the Shield/Stepper Motors are drawing in this project.
Most do not have them but as long as they are always in a park and plugged in no problems.
This is perfectly OK as long as the RV, boat... etc is using Lead-Acid batteries. Which is by-far the most common. Doing this to Lithium based batteries is the surest way to destroy them unless the power management system has smarts to disconnect the incoming supply line when it should. But that is another story and not related to this thread.
3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266... Even usable on ESP-01S - Quickest Start Guide
@inq The reputable battery manufacturers all have BMS either internally or that comes with the battery. In my case even if I did constantly stay at 100% which I don't, it is still ok because the battery capacity is slightly understated. My cells are probably 105AH but I tell the battery monitor they are 100 plus I have solar and a very smart inverter so constantly vary the SOC. Because we often have power failures here at a certain time of year I keep the batteries more full, never less than 80 but in the sunny summer I will let them drop to 60 or even lower. With my master control I can program how much grid power to use, and if I was allowed to, even feed back and scheduled recharges to whatever SOC I choose. Lot's of programmability but with LiFePO4 the watch phrase is simply give em hell and that is from the VP of the company with a 10yr warranty. They might be considered 'dead' in 10 years but what that means is that the original 600AH is now 'only' 480AH which is still more than enough to keep me going for the better part of a sunny week.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
We use cookies on the DroneBot Workshop Forums to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.