DIY Wi-Fi Battery Monitor for Inverters/UPS (IoT Lead Acid Battery?)

A Never Ending Back Story:

About two and a half years ago, I bought an inverter that needed four batteries running at 48V:

https://techenclave.com/threads/wtb-sinewave-ups-inverter-so-need-suggestions.198174/#post-2269678

The inverter was paired with four Amaron Quanta batteries, this was a decision I made — I thought the were really cool looking, colour matched the inverter nicely, didn’t need any maintenance and I later learned that this kind of lead acid battery (vrla/agm) doesn’t have any corrosion on the battery terminals as you would see in flooded lead acid batteries. I also found out that there are detailed datasheets with charge/discharge curves (with Peukert’s law taken into account).

I also did the installation on my own, and I never did something like this before. How hard could it be? Turns out, there’s more to this than just wiring up four batteries in series. The terminals should be scrubbed down until the copper is nice and shiny, the batteries should be pre-charged individually for a day each, and it’s a good idea to check to see if the batteries are from the same batch.

I didn’t do any of that and I didn’t notice that one of the four batteries did not have a serial number that was sequential with the others. It was also missing the Q sticker on top of the battery, which was present on the other three batteries. For whatever reason, this battery was different — either a customer return or exchanged/forgotten stock.

And two years later that battery is now dead with a shorted cell inside (12V lead acid batteries have six cells inside of them). Run time has come down from a few hours to a few minutes as a result. Because of the shorted cell, the other batteries suffered and never charged fully (a lead acid battery with a shorted cell pulls more voltage, which prevents other batteries from getting a full charge).

Had I checked the voltages regularly, or had something that would report voltages, this issue might have been caught before irreversible damage was done to the other batteries:

After testing the battery voltages under load with a multimeter (and discovering the dead battery), I put together a few simple wi-fi monitors using ESP8266 controllers running Tasmota connected to INA219 current/voltage sensors and recorded these readings:

The dead battery fell to ~8V with a simple 25w load.

And when charging, it pulled over 14V, preventing the other batteries from charging fully.

[HR][/HR]
[HR][/HR]
[HR][/HR]

So here in this guide, I’m rebuilding those battery monitors into a more permanent and usable version. One of the philosophies that has evolved in my DIY projects is not using any custom/bespoke PCBs/hardware, everything needs to be modular and easily available/replaceable. The need to get something working quickly again after a failure far outweighs any benefits a custom solution might have.

I chose the Wemos D1 R2 ESP8266 module since it can be powered directly from the battery that’s being measured. It also had unpopulated pinouts that I attached JST 2.5mm right angle connectors to for easier wiring. We’re interested in five lines from the module, two for I2C and two for VIN and GND and a 3.3V to power the INA219. The connectors and wires were purchased from Sunrom:

I used 10cm pre-crimped wires to connect to the INA219 module and 30cm wires to connect to the battery. There are two wires coming from each terminal of the battery to get the most accurate readings possible, without the voltage drop you might see if I were to measure the VIN voltage on the ESP8266 board instead. The INA219 modules have a 4mV resolution, which is more than what we need (100mV would’ve been enough). The INA219 modules are covered in transparent heatshrink, and there’s heatshrink on the bullet connectors as well (transparent on the positive line, black + transparent on the negative line). These are the bullet connectors:

The ESP8266 modules will be housed in a few generic 200ml food containers. Holes were marked, drilled out to 5mm and these snap fit PCB spacers were installed:

I’m not using any strain relief in this version, and the exit holes are intentionally oversized to allow for some ventilation, if it’s needed.

Four completed monitors, one for each battery. As an aside, I looked at Stuart Pittaway’s diyBMS and it uses a single ESP8266 module because his design relies on an isolated I2C bus that adds complexity and necessitates a custom PCB. The cost of each battery monitor here is around Rs 500, which is fairly reasonable despite using hobbyist modules.

These are short battery connecting wires that I made with a separate wire to connect to each battery monitor. I would have liked shorter wires, but heatshrinking them would’ve been difficult. These aren’t necessary, you can use your existing battery wires and just crimp a ring terminal for the battery monitors, like the two smaller ones here:

Before heatshrinking these larger aluminum ring terminals (they take 25 sq mm wire and have a 8mm hole), it’s a good idea to sand down the edges of the crimp since they could tear the heatshrink.

On the left, the bolts that came with the inverter, the middle is a high quality stainless steel hex head bolt and on the right is an absolutely beautiful socket head bolt. These are all M8 and the socket head one is 25mm long, purchased along with the flat washer and spring washer from indialocalshop:

https://indialocalshop.com/fasteners/sockets/ssallenm8.html

Here, the batteries are connected with the long 16 sq mm wires that came with the inverter (the fifth battery is the dead one that’s been replaced)

With the shorter cables and the battery monitors installed.

Not too bad for what is essentially a prototype, maybe shorter wires next time.

These socket head screws are so pretty.

[HR][/HR]
[HR][/HR]
[HR][/HR]

From here, it’s configuring Tasmota with your integration of choice (mine was Mikrotik’s RouterOS and Telegram, but I’ll be moving it over to MQTT/Node Red/InfluxDB/Grafana.

35 Likes

Hey This is interesting.

Can you please detail out what all information can the unit you built for each battery give as an output.
There is an LED indicator to depict some info. what are those?
Not sure if information can be transmitted to an app to set alerts?
Also how to DC input is the device taking in?

1 Like

Well timed @@rsaeon article. I am building something similar for my DIY UPS. Yours is more robust than what I am planning to build. I do not have a working prototype yet, but the idea is to use an [ESP32 board](’

Amazon.in

) and use multiple ADC inputs on it to measure the battery voltages. That works because my UPS uses 7AH batteries which are placed next to each other.

1 Like

I’d definitely want to see how you make yours! My interest in electronics peaked with TTL/CMOS in the 9th grade and at that age I couldn’t fully understand the equations associated with analogue circuits or the complexities of registers with microcontrollers — and I never grew out of that, I guess.

That particular ESP32 module that you linked, I saw it for a much better price on another shop, here:

It’s a pretty cool module that I would love to find a use for some day. I usually buy XT60 connectors from that site.

I wish I had made these battery monitors a lot sooner (I’ve been thinking about them for over a year), I did a capacity test earlier today with a 1000W load and got a run time of only 20 minutes with the replacement battery, the other batteries are just too sulphated to handle the load anymore:

The Luminous Cruze+ 3.5kVA inverter I have beeps with a low battery alarm at 45V and cuts off power at 42V.

It’ll be 15k to replace those three batteries with second hand ones, which I don’t really want to do now.

But I probably would have to.

1 Like

Awesome! You just saved me some money that I can now use to buy battery for that module. Your posts have inspired me to share my build log. I may not be able to match quality of your logs, but I will definitely will give it a try. :slight_smile:

To avoid battery deterioration you can try using the Battery Desulfator devices.I have one fitted in my inverter battery. I was able to stretch life of my previous inverter battery to ~7.5 years. I have a spare that I can send to you for testing or you can order one from the supplier I recently bought more units. See if you are able to revive your old sulfated battery.* *Had it not been my ignorance towards checking water levels for the whole of pandemic, I could have had the battery still running. The battery was literally running on empty by the time I figured that it needed a top up. I had to pour ~12 litres of DM water to top it off. :weary:

Supplier details
Pioneer Industries
Office 5, Gokul Aprt.,Kevni Pada,
Off.S.V.Road Jogeshwari(W),
Mumbai-400102.
Mob.: 981972387

, 982102387.
Website: [www.pioneerfitting.com](’

http://www.pioneerfitting.com/

)
Email: pioneerindustries@gmail.com sales@pioneerfitting.com

1 Like

Great guide. I love electronics posts. <3

1 Like

Hey, the ESP8266 modules are running Tasmota, it’s an open source firmware for existing and diy wifi projects/devices that’s geared towards home automation:

Flashing the firmware is as easy as connecting a USB cable and using their web flasher:

These modules are running the Tasmota Sensors firmware because that version has support for the I2C module we’re using here, the INA219.

The INA219 is actually a current sensor that also measures voltage, we’re just ignoring the current/power measurements and using only the voltage readings.

You can access the data through a few ways, there’s the web UI, MQTT, and web requests:

For the last five years or so, I’ve only ever used the web ui with Tasmota, it looks like this:

This is one of my earlier wifi battery monitors that’s connected to another inverter, I also added a temperature sensor and an addressable led to this one.

You can theoretically make a simple app that reads directly off the module, but it would far more useful if you added some kind of data logging server/vm. Tasmota publishes an MQTT message that’s JSON formatted and looks like this:

,"FLAG":0,"BASE":18}

All of this information may seem overwhelming but it’s really very simple concepts once you start using them.

Thanks for the suggestion, I’ve contacted the company about buying one but I haven’t gotten a reply. There’s a detailed post of someone reviving dead AGM batteries from a couple of years ago that I found:

https://powerforum.co.za/topic/8232-my-200ah-agm’s-are-kaput…got-nothing-to-loose-i-will-try-to-desulphate-them/

Their results sounds promising and their batteries exhibit the same behaviour that I’m seeing with mine. But I haven’t been able to find anything about desulphating these Amaron Quanta batteries except for this excerpt:

It’s from the last page here: [

https://www.amaronbatteryinverterchennai.com/files/amaron/Quanta

Silver Book.pdf](’

https://www.amaronbatteryinverterchennai.com/files/amaron/Quanta%20Silver%20Book.pdf

)

But there’s no more specifics given anywhere. Elsewhere online I read that desulphation only works above 15V. I guess I’ll be experimenting with this in the next few weeks.


Attachments:

Screen Shot 2023-11-22 at 12.38.57 AM.png

4 Likes

Wow. Somewhere around 2018 we (me and a friend) had developed similar stuff for making normal UPS smart with the addition of 8266 and some other circuity. I will be deploying this next year. This was part of industry 4.0 equivalent at that time.

1 Like

Thanks Mr.Rsaeon,As a newbie to this,i followed your steps for everything to build a one.But not showing anything on the homepage of tasmota.Cud u pls stepup and check?

The Mr title is for my father, not me. I’m just me, ha.

Try and share as many photos as you can, I need visual aids. Also screenshots.

Also where are you located? Maybe I can drop by and see what’s happening if you’re local to 500001.