Electronics > Beginners
INA219, multiple sensors, Zanshin library
(1/1)
octavio:
Apologies in advance if this is posted in the wrong forum or if too rudimentary a question.

I'm working on a DAQ system for an off-grid PV solar system w/ battery.  I'm using an Arduino Micro to manage the data, SD card writer, DS3231 RTC, and seven INA219 sensors to measure various power flow at various points in the system.  I'm using these INA219 kits, basically an Adafruit clone.  I've soldered the A0/A1 address inputs to create 7 unique addresses for the INA219.  I've removed the included 100mOhm 2512 SMD resistor and replaced it with these 20mOhm and 30mOhm metal foil 1% resistors.  I can hook up all 7 INA219 simultaneously and read address, voltages, currents, power from all 7 using Zanshin's excellent library. - so far so good.

I've run each INA219 individually thru a constant current PSU to measure in-situ resistance and have milliohm readings to match.  I'd like to use the program registers in the INA219s to set the correct current range and resistance values so the output is accurate.  Mind you I have 2 different nominal shunt resistor values in the 7 units; actually 7 unique shunt resistor values to be programmed.  When the registers are set right, the accuracy and stability of these INA219 are really impressive.  I think me and INA219 will become good friends.

But here's where I have a problem, with I'm sure a simple solution.  How do I instantiate unique classes of these 7 sensors so I can address them individually, and set their respective registers?  I know, this is a code question more than an EE one, but I figured if anyone around the world would know, my fellow EEVbloggers would. 

Thanks in advance for any hints you might offer.  I'd be happy to provide additional details or answer any questions you might have.
Zanshin:
Hi octavio,

the INA-Library allows you to set each device's shunt value separately - see the documentation for the "begin()" function at https://github.com/SV-Zanshin/INA/wiki/begin()
Navigation
Message Index
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod