counting mAh

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
karl222
Normal user
Posts: 90
Joined: 23 Aug 2017, 17:18
Location: Vienna

counting mAh

#1 Post by karl222 » 04 Jan 2018, 11:40

Hi there,

I would like to realize a Charge/Discharge module for Li-Ion batteries with ESPEASY which can control a bunch of batteries at one time.

Setup as follows:
1. activate TP4056 with relay or mosfet in order to Charge 18650 battery
2. readout led "fully charged" with esp using a MCP23017
3. After time delay of 1min, start discharge with 1R resistor controlled by mosfet.

In order to get a precise reading of amperage I would use a INA219 and by measuring voltage via ADS1115 and current every second I can calculate mAh

From a hardware perspective this is not too complicated in my view, but I have no clue how to code it in order to write values into ram or external sd-card. There is a lot of values to be recorded and at the end mAh has to be calculated...

I thought using one ESP for a pack of 4 batteries makes sense but I would love to utilize ESP better. Maybe an ESP32 makes more sense. Is uPyEASY the better solution for that? For displaying results I could use my home Automation System Loxone or NodeRed with MQTT communication.

Does someone have an idea how to approach this and maybe there are some suggestions on hardware in order to make the setup a bit cheaper.

Looking forward to your suggestions
Karl

karl222
Normal user
Posts: 90
Joined: 23 Aug 2017, 17:18
Location: Vienna

Re: counting mAh

#2 Post by karl222 » 11 Jan 2018, 14:52

No idea guys?

kimot
Normal user
Posts: 190
Joined: 12 Oct 2017, 20:46

Re: counting mAh

#3 Post by kimot » 21 Jan 2018, 14:44

Maybe I do not understand what you exactly wants.
But for my perspective there is no problem.
For each battery you need only one variable - energy sum ( and each of 12 tasks can store 4 of this variables ).
I think one second interval is too short for ESPeasy. I suggest 10s.
With rules measure mA every 10s and add this value to variable.
At end of measuring you will have got number xxx (mA*10s) in this variable.
Divide it by 360 and got mAh.
If you want some discharging graphs, send data to domoticz for example.
But precision timing 10 sec interval with Timers will be difficult with ESP easy, I think.
And you do not need measuring voltage for calculating capacity in mAh.
Voltage is needed only for correct sensing end of discarging, but this can be done with analog comparator circuit and gpio in ESPEasy too.

Some theory:

http://www.instructables.com/id/Arduino ... ity-meter/

karl222
Normal user
Posts: 90
Joined: 23 Aug 2017, 17:18
Location: Vienna

Re: counting mAh

#4 Post by karl222 » 25 Jan 2018, 16:31

Hi
Thx for the input!

I think i have found my approach. I will use an esp32 in order to have sufficient cpu power as well as gpios and adcs for at least 4 cells in parallel. Maybe i use an ADC wit i2c as well es i2c gpio. Esp32 will be used to switch mosfets and measure voltage and current on a 5 or 10 sec basis but current will be controlled via stabilizing (making it constant) the voltage coming from the battery and going over 1R resistor and using ohms law. By finetuning the current to exactly 500 mA and controlling the voltage of the battery, i just have to run a timer in order to identify the time of discharge at 500 mA. Esp32 will send start and end to a raspberry with nodered and dashboard on it. Communication via mqtt. With the raspi there should be no problem measuring time exactly...

Hope my approach is explained clearly.

Regards
Karl

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests