Sorry Rob I can't get the text to be organized properly.
I'll try again.
Hi Rob, thank you for your quick response.
Currently I have 1 INA3221 board left so I can still test.
I now use the library of Rob Tillaart "INA3221_RT"
#include "INA3221.h"
INA3221 INA(0x40);
And the commands for initialization and default setup.
INA.begin();
ch = 0 to 2
U = INA.getBusVoltage(ch);
I = INA.getCurrent_mA(ch);
I hope this is enough info,
Thank you very much for the effort.
kind regards, Bill.
Hello Rob,
I tested the program, but unfortunately, I didn't get good results.
The current shows 1.6447997E1 with and without current.
The voltage shows 8.223999E0 with and without voltage.
So, nothing changes.
I looked at the datasheet and the library and made some adjustments, also without success.
I also tried reading the config, ID, and manufacturer registers, all of which returned 4040h.
But I’m not sure if I dit that right.
Here is my version with a litle typo.
Hi Rob, I have the program working.
When i looked at the registers it was very clear that I make some mistakes.
I changed the last version of the lib again because the shifting of the 3 lsb's turned out to be incorrect and the multiplication in the voltages was also incorrect.
The 3 LSBs do not participate, bit 4 is 8 mV, respectively 40 uV.
So just read the registers in the main program.
I no longer use a floating point for this, only word format.
The calculations, and the display format are done in the main program.
Finally, extending the lib would be nice, especially some configurations of the functions.
The time out function is very useful.
I'll leave it up to you whether you go along with my solution, see the changed library.
kind regards, Bill.
To view this discussion visit https://groups.google.com/d/msgid/jallib/AM7PR02MB60987327EA36FE434A465EBBE631A%40AM7PR02MB6098.eurprd02.prod.outlook.com.
Hi Rob,
I tested the bus voltage, shunt_voltage and current functions, unfortunately it didn't work.
So I looked at the lib and saw that the 3 lsb's shift were still present.
The multiplication was also incorrect, the whole word value must be used.
The 3 lsb's simply don't participate, so the multiply factor for the bus_voltage is 1 mV and for the shunt_voltage 5 uV, however, the resolution is then 8 mV and 40 uV respectively.
Bits 15 to 3 contain the measured values. After the change, those functions worked properly.
Btw Vasile the common mode I chose an inverting opamp in case of negative voltages and the ADC of the PIC.
The current is measured by INA3221 on the common side.
Kind regards, Bill.
To view this discussion visit https://groups.google.com/d/msgid/jallib/AM7PR02MB609893E89A3DF5C897E7B4A0E630A%40AM7PR02MB6098.eurprd02.prod.outlook.com.
Hi Rob, during testing I ran into a problem.
If the current becomes negative, you lose the sign (bit 15).
If bit 15 becomes high, the measured value increases by 32760, (the 3 LSB's don't count).
That was also the reason that I limited myself to using int "words" in the library.
I have Adapted the library and delete some floats to test the phenomenon.
In the main program I use "swords".
I send my versions for checking.
Kind regards, Bill.To view this discussion visit https://groups.google.com/d/msgid/jallib/AM7PR02MB6098814CF9DD9DEF36E55175E607A%40AM7PR02MB6098.eurprd02.prod.outlook.com.
I also didn't understand why the bus voltage has a - sign. Perhaps because of the uniformity of the data.
The (LiPo) battery is charged or discharged, so the voltage remains positive.
The handy thing about the IC is that you can set various limits.
Met vriendelijke groet,Everything works well for me now.
You got lucky, my first board was not suitable for my application, I have to cut some PCB tracks.
I hope you can fix the problems with the compiler.
Thanks for all the effort.
Kind regards,
Bill.
Hi Rob,
Nice video of the INA3221 and well documented.
Now and I'm working on an Oled display SSD1306 with 6x8 font,
because I found the letters a bit too small, I tried larger fonts,
(12x16) or (8x12). Unfortunately this gives a mess on the screen.
Do you know if there are special settings to set larger characters?