Grove/Pin Headers INA3221 Breakout Board
Note: Comments are now locked. Please ask technical support on the product support forums
[include-page id=”buy-include-file”]
The dual Grove/Pin Header INA3221 Breakout Board is a three-channel, high-side current and bus voltage monitor with an I2C interface and a dual Grove Connector / Pin Header interface. You can use it both with a Grove I2C Connector and standard pin headers.
Sometimes, you want to measure lots of things in your system. A great example is when you have a solar powered system. To figure out what is going on in your solar system dynamically, you need to measure the current and voltage for the Solar Cells, Batteries and the Load (computer) all at the same time. The conventional way to do
this is to use three $10 INA219 (same function, but only one channel) for a cost of $30 and much more wiring / space. This INA3221 breakout board will do the same job as three INA219’s but for about half the cost and about 50% of the space.
Specification
The full specification for the Dual Grove/Pin Header INA3221 Breakout Board is available here (updated on March 26, 2016).
The Version 1 specification for the INA3221 Breakout Board (without the Grove Connector) is available here.
How to Use
To use the INA3221, you connect the I2C bus up to an Arduino or Raspberry Pi (using the Grove connector or the Pin headers) and then connect the loads that you want to measure as shown in the block diagram below. See the wiring lists for the Arduino and Raspberry Pi in the specification above.
Software
SwitchDoc Labs developed this pure Python INA3221 Raspberry Pi library as part of the SunAirPlus product development and for this INA3221 Breakout Board.
Here are several articles about these drivers:
Raspberry Pi and Arduino Power Consumption – INA3221
INA3221 Arduino Library Released
INA3221 Python Raspberry Pi Library Released
It is similar to using three INA219 High Side Current Monitors, but not quite. There are significant differences in the chip itself and especially in the software needed. In SunAirPlus, we want to measure the current and voltage for all three major subsystems: The LiPo Battery, Solar Panels and the Computer.
The software is located on the SwitchDoc Labs github under https://github.com/switchdoclabs/SDL_Pi_INA3221.
Arduino drivers are also located on github under https://github.com/switchdoclabs/SDL_Arduino_INA3221.
The first test on the Raspberry Pi should always be “i2cdetect -y 1” which should show you the INA3221 at the default address of 0x40. A similar test can be run on the Arduino.
Running the test results from the INA3221 Breakout board are below:
Test SDL_Pi_INA3221 Version 1.0 - SwitchDoc Labs
Sample uses 0x40 and SunAirPlus board INA3221
Will work with the INA3221 SwitchDoc Labs Breakout Board
------------------------------ LIPO_Battery Bus Voltage: 4.15 V LIPO_Battery Shunt Voltage: -9.12 mV LIPO_Battery Load Voltage: 4.14 V LIPO_Battery Current 1: 91.20 mA
Solar Cell Bus Voltage 2: 5.19 V Solar Cell Shunt Voltage 2: -73.52 mV Solar Cell Load Voltage 2: 5.12 V Solar Cell Current 2: 735.20 mA
Output Bus Voltage 3: 4.88 V Output Shunt Voltage 3: 48.68 mV Output Load Voltage 3: 4.93 V Output Current 3: 486.80 mA
Hi
Its not clear to me, how to connect, passing through INA3221 each V+ (solar panel, battery and Arduino Vin) and sharing all the gnd?
Thank you in advance
Marcelo
Marcelo,
All share the same ground. You need to put the INA1+ and INA1- inline with the device. In other words, for example, run the place where you are connecting the battery to (the + terminal) to INA1+ and then from INA1- to positive terminal of the battery. The INA3221 is INLINE with the current flow. Ditto for the solar panel and Arduino power in.
By the way, SunAirPlus does all this wiring for your and is a charge controller to boot.
SDL
How much current/voltage can I measure with this? I am all but signed up to buy a couple to prototype with, but I need to know the limits of voltage and current. Hopefully, it’s in the 12vdc 30a range, but if not, hopefully at least 12vdc / 4 amps. Awesome creation! Thank you!
The INA3221 supports 0-26 V common mode , -26 to 26V differential modes
2A maximum!
Thanks!
SDL
Hi I’d like to use one of these with a 60v solar system, just wondering what sort of resistor divider would be appropriate? I’d like to use a 150k in series with a 100k for 24v across the 100k into the INA3221 but the chip datasheet (graph 14, page 9) shows input bias currents of 8uA for IN+ & 27uA for IN- & I’m concerned this will compromise the accuracy.
I thought about powering the card from an isolated DC-DC & referencing ground to mid battery pack terminal for + or -30v on the inputs as the sampling registers are good to 32.76v (page 11), but the datasheet warns it.
Has anyone got any experience with voltage dividers for >26v or inputs >26v on this card?
Which version of the Arduino IDE used to compile the INA3221 code? The INA3221 library wasn’t visible in the Arduino 1.6.0 and higher versions.
Hi Chip,
Which INA3221 Library are you talking about?
If it doesn’t show up, then it is probably not in the correct library directory.
SDL
I have put many libraries into the correct folder and used them.i moved your inna3221 library along with your quad power library into the same folder and the quad power folder example worked correctly.
Chip,
Try moving the INA3221 library my itself into the libraries directory. Not under the Quad power folder.
SDL
The Arduino INA3221 library is not in the Quad Power Library, it is in the libraries folder next to the Quad Power folder because they both begin with SDL. Send me an email and I will send you a screen shot.
I suggest that you download the Arduino IDE 1.60 or higher, put the Arduino INA3221 library in the libraries folder. Close the folder and start the IDE. You won’t see the INA3221 library listed when you go to the Examples pull down menu.
I have Arduino 1.67 with SDL_Arduino_INA3221 in the libraries folder. If I go to sketch->include library it is listed under “contributed libraries”
Have you quit Arduino and restarted it since putting the library in the directory?
SDL
Just realized what the problem is, in your library there is an examples folder. In the examples folder, you put the example sketch. The problem is that in order for the example script to be found in the example pull down folder, the sketch has to be in a folder with the name of the script (and that is missing).
So it should be: SDL_Arduino_INA3221 library –> examples –> SDL_Arduino_INA3221_Test folder –> SDL_Arduino_INA3221_Test.ino
and it is: SDL_Arduino_INA3221 library –> examples –> SDL_Arduino_INA3221_Test.ino
When I inserted the folder with the script name (with the script inside), then the script was visible from the examples pull down menu.
Chip,
Excellent sleuthing. That explains why I could see the library!
SDL
Will this measure current bidirectionally for a given load? If one of the loads is a battery, depending on whether it is charging or discharging the current will change direction. It seems like this should be fine with this circuit, correct?
Thanks,
Eric
Eric,
Correct. You will get a negative value if it is charging and positive if it supplying current.
Best regards,
SDL
Thanks for the fast answer to my previous question! I ordered one of these instead of a couple of AdaFruit INA219 breakout boards for monitoring my solar project. I had a few questions about the 2A limit listed in the specs. Is this based on where the ADC saturates or limited by trace sizes and such on the breakout board?
My solar project uses about a 60watt 12V panel connected to a lead acid battery with regulator. My application uses fairly intermittent power and so my panel usually is only trickle charging at a max of 0.5A. Even if the battery is low, the panel has enough tree coverage that I’ve never seen over 1A. My load is 1.5A or less when on. I do not care about measuring any intermittent spikes (if they were to occur—-maybe when the load is turned on) above 2A with this current setup, but I’d like to know that it won’t damage anything. The 219 boards seemed to have a 3A range and an easy modification to put a different shunt resistor in.
Any ideas on how what I can do?
Thanks!
Eric
My INA3221 breakout board arrived so I tried to run the test program
root@harbinger:/home/pi/client# python 3221test.py
Test SDL_Pi_INA3221 Version 1.0 – SwitchDoc Labs
Sample uses 0x40 and SunAirPlus board INA3221
Will work with the INA3221 SwitchDoc Labs Breakout Board
Program Started at:2016-01-06 17:32:35
Traceback (most recent call last):
File “3221test.py”, line 30, in
ina3221 = SDL_Pi_INA3221.SDL_Pi_INA3221(addr=0x40)
File “/home/pi/client/SDL_Pi_INA3221.py”, line 78, in __init__
self._bus = smbus.SMBus(twi)
IOError: [Errno 2] No such file or directory
looks like a bus is missing or something? Any thoughts?
I tried changing twi from 1 to 0 but that didn’t help
All good, apparently I have to run sudo modprobe i2c-dev first
Where can I find the spec document referenced by this line from SDL_Pi_INA3221.py please
INA3221_CONFIG_AVG2 = (0x0800) # AVG Samples Bit 2 – See table 3 spec
Hi Kris,
Here is a link to the full INA3221 Specification:
https://www.ti.com/product/INA3221/technicaldocuments
Best regards,
SDL
I just received some INA3221 breakout boards to work with but I can’t find any documentation on how to wire them up. I am using Adafruit’s INA219 board now and I am very familiar with I2C (SDA/SCL), but what are the “TC” “PV” “WRN” and “CRT’ pins used for? Is there any documentation available?
Michael,
Check and download the full specification on the product page: https://www.switchdoc.com/ina3221-breakout-board/
Best regards,
SDL
I found the datasheet directly from Texas Instruments. I see that you linked it in a previous comment but for anyone who is looking for data on the extra pins.
CRT: Digital output Conversion-triggered critical alert; open-drain output.
PV: Digital output Power valid alert; open-drain output.
TC: Digital output Timing control alert; open-drain output.
WRN: Digital output Averaged measurement warning alert; open-drain output.
Hello,
I’m trying to get my INA3221 board to work with NodeMCU V1 (using Arduino IDE). I’ve copied the library across and can compile/upload the example sketch. Ive wired the first channel in series with a 3.7V battery for testing purposes but i cant seem to get any data. SDA and SCL are wired to D1 and D2 respectively.
Im just wondering if i need to change any of the code in the .h or .cpp file due to pin mapping differences…? Im out of ideas.
Rusty
Hi Rusty,
Find and run an I2C scanner program. It’s not the INA3221 board, it is probably the I2C is not working/set up correctly. That’s the key to getting it to work. You probably aren’t setting the Wire.begin() up correctly is my guess.
Once you can detect the INA3221 on the I2C bus, things should work fine.
Best,
SDL