Author Topic: Hello New Here and Off grid battery monitor using INA240  (Read 660 times)

0 Members and 1 Guest are viewing this topic.

Offline Robert Smith Eco Warrior

  • Regular Contributor
  • *
  • Posts: 72
  • Country: gb
Hello New Here and Off grid battery monitor using INA240
« on: April 12, 2021, 12:20:58 pm »
Hello All.
I am new here and not great with electronics. I have tinkered around with 555 timers, comparators, voltage regulators, counters, LED display drivers, mosfets, transistors etc but that is about my limit.
My Son has a project to do, with my help.
We live completely off grid and have about 4kw(peak) solar array with panels in series pairs so have feeds into our battery shed at near battery voltage. About 70v open circuit but the batteries pull that down to between 48v (flat) and 60v (equalisation charge). Charge is controlled by a fairly simple PWM charge controller. The lead acid battery bank is nominally 48v. This feeds three Victron inverters to provide our 230v AC supply to our temporary caravan home, until I build the house.

My Son, Toby, wants to use an Arduino to show the charging current, battery voltage and inverter draw current. He wants to do this numerically and graphically.
Ideally he wants the display panel in our caravan but the current measurement shunts will need to be in our battery shed about 30 metres away.
The rough plan is to run something like cat5 network cable between the shed and the caravan carrying the signals and the high current shunts in an enclosure in the shed and then another box in the caravan with the arduino and displays.

We have just started this project so I have scrawled a quick sketch and a bit of information. Hopefully you guys can help steer us towards the most suitable components and methods. I have searched the internet and an INA240A3 device with an amplification of 100 V/V seems like a posible contender to bring the shunt mV signals upto a level that could be sent along the long cat5 cable without too much of a problem.

Power comes in at the left from our solar charge controller to the batteries at the bottom. There is a lot of PWM noise from the charge controller which the INA240 device might be able to deal with. I don't know how much noise but know that hwen the sun is shining and the charge controller is doing its pwm switching, at an audible frequency, the inverter buzzes at the same frequency. I have added a smoothing capacitor and switch and the smoothing capacitor quietens the inverter down so there is a good bit of ripple on the dc but I don't know how much.
The Victron inverters I have have their negative battery feed connected, or connected with some resistance, to the earth/ground side on the AC output. This would then be connected to my PC and then the Arduino ground via the USB cable so I am wanting my shunts and circuits on the negative side of the battery so I don't create a 50 odd volt path and zap some electronics or PC.
I do have a couple of 70v to 5v voltage regulators. I can't remember the number but will have to dig those out. I shall get the Arduino to send a signal to 'wake up' the voltage regulator and sensing circuits. I don't want to be dropping 45v over a device continuously so will get it to have a few seconds running every 15 minutes or so.
I did think there may be a bit of an error in which side of the shunts my grounding and Arduino are located but if my output signals are amplified into the 0v-5v range then the odd few mV error lost across the shunts might not be much of an issue and I could maybe write out the error in the arduino programming.
It is early in thinking about this project so nothing is fixed yet.
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1032
  • Country: us
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #1 on: April 12, 2021, 12:42:58 pm »
I do that kind of stuff with a INA226, but I'm dealing with 12 V.
I would suggest that you use a digital interface not analog.
Take a look at https://www.ti.com/product/INA238
This has 85 V max.

Definitely don't ship analog over the 30 meters.
I'm a fan of RS-485 Modbus and that's how I do it myself.
You could have a Raspberry Pi in your shed sampling and logging.
You could access it over WiFi.

Hmm, yesterday was bright with a lot of wispy clouds.

Edit: Besides, if you do ADC in an Arduino (ATmeg328p/ATmega32u4) you only get 10 bits resolution vs. 16 bits with INA226/INA238.
« Last Edit: April 12, 2021, 01:03:51 pm by Renate »
 

Offline Robert Smith Eco Warrior

  • Regular Contributor
  • *
  • Posts: 72
  • Country: gb
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #2 on: April 12, 2021, 12:55:51 pm »
Hi. That INA238 looks like it is now my main contender.
The Arduino can comunicate via I2C so that may be relatively simple to implement.

Wifi is not an option though. We try to avoid radio signals as much as possible when there is a wired option.

Edit: I forgot to say that we must use an Arduino in this somewhere as my Son is doing a course and using an arduino was a specific requirement of this project.
« Last Edit: April 12, 2021, 01:13:42 pm by Robert Smith Eco Warrior »
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1032
  • Country: us
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #3 on: April 12, 2021, 01:22:31 pm »
One solution is a RPi in your caravan with a USB/RS485 (or simply a logic/RS485 running off TX/RX)
A single pair out of a CAT5 running to your shed.
An Arduino with an RS485 shield.
Two INA238 (you can use up to 4 (actually 16) on the same bus without getting fancy).

You can CAT5 the RPi to your laptop for full access.
You could interface a panel with LEDs/LCD/OLEDs/analog meters to your RPi for a status display.
You could connect an old ereader to your RPi for a status display. >:D

Don't ignore the fact that the Victron inverters probably have a lot of information themselves.
The EPEver stuff uses Modbus which is why some people end up standardizing on that.
« Last Edit: April 19, 2021, 11:24:32 am by Renate »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 9994
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #4 on: April 12, 2021, 01:58:49 pm »
With 30m between your battery/power shed and caravan, you really need an isolated interface to avoid the risk of nearby lightning strikes inducing large enough transient ground potential differences or EMI induced transient currents in the signal cable to blow the s--t out of your monitoring and control devices.  Although its possible to use isolated RS485, I'd recommend a CAT5 or better Ethernet cable with surge protectors directly tied to local ground and  an Ethernet shield for the Arduino in the shed, as Ethernet inherently has >1KV isolation at each end, provided you do *NOT* use STP patch-leads between the surge protectors and the devices they are connected to (so you aren't creating ground loop by linking the device chassis to the ground to the surge protector).  Once you've got Ethernet, any extra monitoring, command and control you need in the power/battery shed is easy to add over the same cable.  What you then use to display the data in the caravan (or later on in your house) is up to you - e.g. web browser or program on the PC, app on your phone or tablet, a hacked ebook reader or a dedicated custom built ethernet connected display.

Whether you use high side or low side current shunts is irrelevant so long as the instrumentation amplifiers, or other types of readout circuit can handle the maximum possible common mode voltage that may be present during fault conditions without damage.  This could easily reach double the solar panel string's maximum open circuit voltage due to cable inductance ringing with power input decoupling capacitance of various modules in your system when breakers are initially closed.  Your proposed INA240A3 only has an 90V abs. max. common mode voltage rating, (and the INA238 Renate suggested only 85V) which even for a low side shunt is inadequate if a bad connection develops between the ground side shunt load terminal and DC system ground.   Depending on *exactly* where in the circuit the low side shunt is used, and what's loading the panel, its sense terminals could get driven negative by as much as the panel open circuit voltage, + whatever transient spikes may occur.  See mitigation suggestions below.

Your alternative of an ADS1115 doesn't offer any common mode input voltage range outside its supply rails so it and any Arduino its connected to are unlikely to survive any open ground faults if its directly connected to the shunts without extra input protection.  One way to mitigate that would be to minimize the risk of an open ground fault between the two shunts, and the ADS1115 and Arduino by bolting the shunts to a heavy copper ground busbar with separate bolted connections for the battery negative cable and the Arduino + ADS1115 ground to minimize the risk of the Arduino and shunt common connection being disturbed if the battery negative cable is moved or disconnected.   Use a telecom* rated nom. 48V input, 9V output DC-DC converter to power the Arduino via its Vin pin or one with a precision regulated 5V output to power it via its +5V pin.  During development, using an USB isolator is *STRONGLY* recommended so you don't blow your PC's USB port.

* Telecom applications historically had large nom. 48V lead acid battery banks, positive terminal grounded to provide an approx -55V (float voltage) supply for exchange equipment and individual subscriber loops, and that power voltage remained an industry standard when the industry went digital, so rugged power conversion solutions for it are readily available.
« Last Edit: April 12, 2021, 03:02:20 pm by Ian.M »
 

Offline Robert Smith Eco Warrior

  • Regular Contributor
  • *
  • Posts: 72
  • Country: gb
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #5 on: April 12, 2021, 02:28:27 pm »
Thanks for that. I shall look into a USB isolator.
I am not too worried about lighning destroying this project. If it has destroyed this project it has probably destroyed £1000's worth of inverters and other equipment in the battery shed. This little project would be the least of my worries.
I am not sure any isolation, except a 50ft gap, would save things. Maybe that is another discussion that I should start as I have wondered the best way to protect our equipment is.
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1032
  • Country: us
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #6 on: April 12, 2021, 03:06:05 pm »
Well, you could run plastic 1mm fiber optic cable.
I've never seen half duplex transducers, but that would be optimal.
You could build your own beam splitters for each end. >:D
It would save you from running twin cable.
 

Offline Robert Smith Eco Warrior

  • Regular Contributor
  • *
  • Posts: 72
  • Country: gb
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #7 on: April 12, 2021, 03:12:29 pm »
The signal cable for this project would be following, or in a separate duct in the same trench as the power cables for the caravan / house.
I shall not get too carried away with trying to isolate just this project when there is a big lump of lightning conducting copper parrallel to it.
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1032
  • Country: us
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #8 on: April 12, 2021, 03:32:02 pm »
Just curious, what is the model solar controller and the model inverters.
Have you looked at their data interfaces?
 

Offline Robert Smith Eco Warrior

  • Regular Contributor
  • *
  • Posts: 72
  • Country: gb
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #9 on: April 12, 2021, 03:58:00 pm »
Hi.
The Charge controller is a Morningstar Tristar TS60
The Inverters are Victron Phoenix 48/3000 units.

The charge controller has an RS232 port for setting some configuration but I think it works entirely from voltages and has no current sensing function.
The Victron inverters have ethernet communication going to an inline interface box to usb cable. I am sure these inverters have current sensing but I am not sure I want to try and interogate them. Victron has been spectacularly unhelpful too so if these inverters ever stop working I may well opt for another make, so tying my project to one inverter type might make the project unuseable if the inverter broke.
 

Offline Robert Smith Eco Warrior

  • Regular Contributor
  • *
  • Posts: 72
  • Country: gb
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #10 on: April 12, 2021, 03:59:25 pm »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 9994
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #11 on: April 12, 2021, 04:13:18 pm »
You do however need to consider the transient potential difference between the two cables, as a power cable with a ground conductor and a ground rod at each end (needed for safety) can have a large transient current induced in it causing a significant voltage difference, due to events like faults to ground or nearby lightning strikes.

The data cable wont (and cant) carry the same transient current so during a surge will carry a significant common mode voltage transient relative to local ground even if its buried right on top of the power cable. That's why isolating the data cable at both ends and connecting it through surge protectors is advisable to protect your equipment.   
Ethernet already has inherent isolation and Ethernet surge protectors are affordable and readily available as off-the-shelf modules, and will keep the common mode voltage transients clamped to less than the Ethernet adapter's isolation rating if properly installed, for surges up to their energy rating. 

The ISO3080 isolated RS485 transceiver on the shield you linked is rated for 2.5KV isolation, but the clearances and creepage distance look a bit iffy, and it also depends on the isolation rating of its DC-DC converter, so it probably effectively significantly lower.   A well grounded RS485 specific surge protector at each end of the data cable would be advisable.

N.B. a direct lightning hit on the caravan or power/battery shed or on the ground between them along the cable route will almost certainly overwhelm *ANY* surge protection that you can afford to fit.   If you are in a high risk location (e.g. hilltops, ridges and cliff edges or flat open plains)  you may need to consider lightning protection that will cover the structures in question and the area between them.
« Last Edit: April 12, 2021, 04:16:13 pm by Ian.M »
 

Offline Robert Smith Eco Warrior

  • Regular Contributor
  • *
  • Posts: 72
  • Country: gb
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #12 on: April 12, 2021, 04:18:35 pm »
"A well grounded RS485 specific surge protector at each end of the data cable would be advisable."
Is this something I can find easily and, with my fairly limited electronics knowledge, include in this project?
Edit: I had a search and it seems like they are fairly easy to build in but the price puts me off, especially as we presumably need two.

« Last Edit: April 12, 2021, 04:30:58 pm by Robert Smith Eco Warrior »
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1032
  • Country: us
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #13 on: April 12, 2021, 04:54:32 pm »
I am just looking at this as I like your idea of using RS485
https://cdn.shopify.com/s/files/1/0176/3274/files/Datasheet_RS485_shield_Rev_B_EN.pdf?v=1596214028
That will certainly work. It's a fancy one.
Thanks, you cued me into the TI ISO14XX series (an improvement on the ISO3080). I wasn't familiar with that.

The Morningstar claims to "speak Modbus", but it has a DB9 RS-232 connector.
It might work with a simple adapter.

I'm more picky, I prefer an actual MPPT buck converter.
(I have a EPEver Tracer B 40 Amp).

The Victron uses a proprietary VE.bus
They do have ways to connect that to stuff but it requires an adapter or the "Color Control GX".

Will the Victron Phoenix arise from its own ashes? :-DD
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 9994
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #14 on: April 12, 2021, 04:57:01 pm »
"A well grounded RS485 specific surge protector at each end of the data cable would be advisable."
Is this something I can find easily and, with my fairly limited electronics knowledge, include in this project?
Edit: I had a search and it seems like they are fairly easy to build in but the price puts me off, especially as we presumably need two.


That's the problem with using an industrial / large building automation interface like RS485.  Off-the-shelf surge protection for it from a reputable supplier is significantly more expensive than consumer market Ethernet surge protection.  You can find cheap RS485 surge protectors from many less reputable suppliers, but short of buying one and doing a teardown, you'll have no idea if its likely to be effective.
 

Offline Robert Smith Eco Warrior

  • Regular Contributor
  • *
  • Posts: 72
  • Country: gb
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #15 on: April 12, 2021, 05:11:19 pm »
Hi Ian,
That is what I thought from a quick search. RS had a suitable thing that was about £108 plus Vat each.
Amazon had one at £7 from something like whunzunjunk that I guess might be an empty box.
 

Offline Robert Smith Eco Warrior

  • Regular Contributor
  • *
  • Posts: 72
  • Country: gb
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #16 on: April 12, 2021, 05:18:23 pm »
Now I have gone around in a circle back to the start again.

The INA238 is I2C output.

Then I have been looking at RS485 communication, which seems to be the way to go.

I have found an Arduino isolated shield for RS485 which should do the job, maybe not the full isolation I could really do with but with budget constrains that may have to do.

Other options for the INA238?
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 9994
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #17 on: April 12, 2021, 05:24:05 pm »
What other options do you need?  The Arduino UART is on separate pins to its I2C port, so you'd simply use an Arduino to collect the data from all the INA238 modules and transmit it over RS485.
 

Offline Robert Smith Eco Warrior

  • Regular Contributor
  • *
  • Posts: 72
  • Country: gb
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #18 on: April 12, 2021, 05:29:40 pm »
I was thinking the arduino would be at the recieving end.
I suppose I could use two
 

Offline Robert Smith Eco Warrior

  • Regular Contributor
  • *
  • Posts: 72
  • Country: gb
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #19 on: April 12, 2021, 06:03:16 pm »
Hi Ian,
I just found this little thing on RS that looks promising.
https://docs.rs-online.com/640f/0900766b816d3259.pdf
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 9994
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #20 on: April 12, 2021, 07:15:55 pm »
Yes that does look promising and its reasonably affordable.   Mounting it may be a bit of a PITA as it looks to be rather small with no mounting holes.  The TBU-DF085-300-WH on it is 5.5x6.5 mm so its about 29x21 mm.  You *NEED* to get a good short connection from the four ground terminal pads to something you can bolt the ground wire to.
 

Offline Robert Smith Eco Warrior

  • Regular Contributor
  • *
  • Posts: 72
  • Country: gb
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #21 on: April 12, 2021, 07:44:25 pm »
Yep, I worked out from the large ground tracks that it should be attached to something heafty and well grounded.

I am just wondering about doing a far simpler optical arangement... ie not having the long RS485 connection, just make the display big enough that we can see it from outside the battery shed.

I wonder if I can stretch the I2C maximum reach to about 2m?
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 9994
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #22 on: April 12, 2021, 07:53:17 pm »
That depends on your requirements.  A display big and bright enough to read from 30m away at night is going to be rather power-hungry.  There are solutions for extending I2C, but its pretty much a last resort to do so especially in an electrically noisy environment.
 

Offline Robert Smith Eco Warrior

  • Regular Contributor
  • *
  • Posts: 72
  • Country: gb
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #23 on: April 12, 2021, 08:06:48 pm »
Yes. I think I shall persevere with the RS485 wired idea
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1032
  • Country: us
Re: Hello New Here and Off grid battery monitor using INA240
« Reply #24 on: April 12, 2021, 08:41:06 pm »
I wonder if I can stretch the I2C maximum reach to about 2m?
Well, the two shunts are close, aren't they?
Yes, you could stretch a bit without a problem.
Still, I generally run very short.
If not, you can do this with an Arduino/RS485 for each INA238.
A bit more parts, but not more software or complexity actually.

That RS485 board you showed already has a ton of TVS/MOVs/Zeners on it.

If you're thinking plotting/historical data you want something smarter than an Arduino in the caravan.
That's why I said RPi.
Having good data allows you to notice degradation in performance.
It allows you to live within your energy budget.
I'm sure there's a ton of people who wouldn't even notice if half their panels got disconnected.
And treating your batteries nicely will make them last longer.

No matter how much capacity you have there will be gray weeks in winter when it's not sufficient.
No matter how little capacity you have there will be weeks in summer when you have electrons coming out your ears!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf