INA3221 v INA219

tmp19F7Voltage and current monitoring

The INA3221 or rather one of the boards based around it, allows for a single power input and up to 3 power outputs –each monitoring voltage and current and all done via I2c.

You can (almost) think of this as a triple INA219 – the bidirectional current power monitor. If you recall, a little while ago, I added the INA219 to my ESP8266 software. I thought the INA3221 board might be better than three of the INA219 boards – but read on…

The difference here is a saving in cost – saving in number of devices you need to address and saving in size. I bought this one from AliExpress but you can get them on Ebay etc.  I paid £2.15 – which seems reasonable.

Meanwhile over here I discovered some software to test the board with…  it gets better, the software also worked first time – without even as much as a pair of I2c pull-ups.

And from there, for a while it all started to go downhill. From my stabilised power supply I put out 5.2 volts set to put out a maximum of 3 amps, just to be safe. Here is the output with no load:

tmp84AB

Pretty much as you’d expect, 5.25v is near enough as my power supply only has one digit after the decimal point (got a much better one on the way).

The three outputs showing pretty similar results – I’d have preferred if they’d shown 0 amps but that’ll do.  I took a large 2 ohm resistor – which you might reasonably expect to take 2.5 amps when faced with 5v. I put it across my supply – and sure enough – 2.32 amps. That is well within the likely 10% tolerance of my test resistors.

The voltage out of my power supply didn’t budge – and stayed rock steady.

After I recovered from burning my thumb and allowing the resistors time to cool off, I repeated the experiment more briefly and nothing had changed.

I picked one of the outputs and put the load across that instead of my power supply.

tmp57D2

The input voltage was down to 4.98v which is fine because I will have lost power along the lead to the little monitor unit..  I had attached the load to output 3 which was showing an output voltage of 4.73 at 1.638 amps.

Something very wrong there… my power supply was saying 2.1 amps was being used… the software was saying 1.638 amps voltage drop. I checked the library header – sure enough – it said that the default resistor was 0.1R – I checked the board, sure enough R100….

And then reader NEIL wrote in to point out the mistake – I had ASSUMED these chips were similar to the INA219 – but they are not – there’s a maximum input voltage to the chip of 1.163.8 mV – put that through the default 0.1r resistor and you’re looking at 1.1 amps or so MAX.  So – if you’re happy with that, fine – if like me you’d rather have over 2 amps AND a lower voltage loss, it is out with the fine soldering iron and replace those three 0.1r resistors with 0.05r resistors (remember to ensure you get high accuracy resistors or you’ll have to mess with calibration).   The advert didn’t actually state the maximum voltage reading of the chip – I just made assumptions.

So rather than sit about, I tested the INA219 with the same kit, using software from here  – and sure enough – 2.2 amps – absolutely correct.

New Beginnings

So then I started thinking about making a little voltage/current meter using one or more of the INA219 boards – and as I had one hooked up anyway…. I looked at graphics – but then I figured I’d always be at a PC screen – and noticed an article on the PROCESSING system – available for Windows and Linux….  the first attempt was a partly modified USB Arduino voltmeter.   Well, GUTTED more like it – here’s what it looked like after an hour or so – ignore the last reading.

Arduino meter

I'm not sure why the origial author displayed voltages as points - it really didn't look good - but that was easy enouhg to fix and so my first working version is shown above. Do remember though that any such system involving a 0.1r resistor to detect voltage drop – and hence measure current  - is always going to produce that voltage drop and lack of stability in the output – beats me why they don’t use a much lower voltage.  There is no way around this…

So consider 0.1r… you feed it with, say, for simplicity 10 volts and draw 1 amp. So that is 1 amp going through the 0.1r resistor – you are GOING to lose 0.1v. Off load you lose nothing… so your super stable supply, assuming a variable load, how has a 0.1v ripple on it. Decide if that is important or not before using these boards. At 2 amps it gets worse, 0.2v.

It may be that the INA3221 is better (given that you are able to replace the 0.1r with a 0.05r resistor – or solder another 0.1r on top) even if you only use one channel.

Of course the above was just a starting point. several hours later having pulled out most of the original code to get just exactly what I need…  a single working area with the three graphs in one.  This is currently like a car before they put the decals on it… I’ve much more to add but it’s taking shape and is already useful. Here's the latest version...

Voltage and Current Monitor

And here’s a short video to give you a better feel for where I’m up to..

Facebooktwittergoogle_pluspinterestlinkedin

3 thoughts on “INA3221 v INA219

  1. hi Pete,

    looking at the data sheet for the INA3221 the max shunt voltage is
    Full-scale range = 163.8 mV so your sums add up but the 0.1R resistor is too big to measure anything over 1.6A as you will hit Full-scale on the input.

    change them to 0.01R or a value to give just less then 163.8mV 20% or so above the largest current you want to measure.

    regards
    Neil

    1. AHAH... I ASSUMED that like the 219 this had a maximum current of 3 amps or so.... but looking at the advert - they don't actually specify current. My fault for not looking more carefully and thank you so much, Neil for that information. As it happens I've ordered some 0.05r resistors - so that will give 3.2 - which means I can measure 3 amps - AND get lower drop.... that's marvellous - thank you. I'll amend the blog (so if anyone reads this and cannot understand why Neil wrote this - I was assuming 3+ amps capabillity due to not reading the advert correctly).

  2. The video should give an idea of how far this has gone. I envisage putting a couple of up/down buttons on the Arduino clone to alter the speed of sampling - and sending that back to the PC program to display monitor rate.... then I need to fit the whole lot into the smallest feasible box with air vents.

Leave a Reply

Your email address will not be published. Required fields are marked *