Hi Bill, I agree with you not to use floats and do the calculation in the main program. Yesterday I completed the library with all functions. I will first remove the floats and include your fix and will then send you the update. I also ordered the module so I can test all functions.
Met vriendelijke groet, Rob Jansen ________________________________ From: [email protected] <[email protected]> on behalf of Bill Beek <[email protected]> Sent: Sunday, August 17, 2025 8:32:44 PM To: jallib <[email protected]> Subject: Re: [jallib] INA3221 board 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. On Saturday, August 16, 2025 at 1:05:52 PM UTC+2 Rob CJ wrote: Hi Bill, I made a small mistake in the default IIC address 🙁. I fixed that. Some other remarks. I saw in a video that the Arduino Library you mentioned is not correct. I saw in your update that you corrected that. I saw the same fix in an Arduino Library from Adafruit. I also saw you added a function to read the register values which is handy. I added the changes to the attached library but I also added a timeout function. When the IIC communication is not working this function will return TRUE after you called it (after which it will be reset). I changed the call to the IIC routines so that it keep track of any timeout. I updated the samle program. Next to that I changed the array with shunt resistor values by floats and set them by defaul to 0.1 Ohm which seems to be the commonly used value and I saw that was also the case in your update. I think I will extend the library further and I am thinking of ordering a module to test. The library needs functions to change for example the shunt resistor value, etc. So see if you still get non-changing values and check the timeout and if so, change the IIC address. Kind regards, Rob ________________________________ Van: [email protected] <[email protected]> namens Bill Beek <[email protected]> Verzonden: zaterdag 16 augustus 2025 12:18 Aan: jallib <[email protected]> Onderwerp: Re: [jallib] INA3221 board 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. On Tuesday, August 12, 2025 at 8:33:39 PM UTC+2 Bill Beek wrote: Thank you Rob, I will look at it later, this week is very hot in the shack in my attic. thanks again, kind regards Bill. On Tuesday, August 12, 2025 at 8:16:54 PM UTC+2 Rob CJ wrote: Hi Bill, Small - but important - fix of the library. Use this version. Thanks Kind regards, Rob ________________________________ Van: [email protected] <[email protected]> namens Rob CJ <[email protected]> Verzonden: dinsdag 12 augustus 2025 19:28 Aan: jallib <[email protected]> Onderwerp: Re: [jallib] INA3221 board Hi Bill, Attached my first attempt of the library for the INA3321. I only implemented the functions you called. I might add more functions later. You find the libary and a sample program for a PIC16F1825 so you may need to swich to a PIC that you normally use. I only compiled it since I could not test it. Can you give it a try. Thanks. Kind regards, Rob ________________________________ Van: [email protected] <[email protected]> namens Bill Beek <[email protected]> Verzonden: zondag 10 augustus 2025 12:08 Aan: jallib <[email protected]> Onderwerp: Re: [jallib] INA3221 board 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. On Sunday, August 10, 2025 at 11:45:44 AM UTC+2 Bill Beek wrote: 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. On Saturday, August 9, 2025 at 8:05:05 PM UTC+2 Rob CJ wrote: Hi Bill, What I could do is only implement the functions you are using instead of porting all functions. That would save time. I do not have such a device so I cannot test it so if I have something you become the tester 🙂. Can you tell me which Arduino functions you use from this library? Kind regards, Rob ________________________________ Van: [email protected] <[email protected]> namens Bill Beek <[email protected]> Verzonden: zaterdag 9 augustus 2025 19:49 Aan: jallib <[email protected]> Onderwerp: Re: [jallib] INA3221 board Hi Rob, TNX for your replay, I looked at it and found it too complicated to implement all the functions. By the way, I only use the Volt and Amp functions. So far I use an Arduino Nano and the INA3221 in a triple output power supply . But I like JAL much more. On Saturday, August 9, 2025 at 7:01:01 PM UTC+2 Rob CJ wrote: Hi Bill, Let's hope that somebody created something for JAL that can be turned into a JAL library. I had a quick look at the Arduino library and it seems to be a number of small but readable functions and 'only' about 500 lines of source code so it seems douable to make a JAL library out of it. How far did you get porting it? Kind regards, Rob ________________________________ Van: [email protected] <[email protected]> namens Bill Beek <[email protected]> Verzonden: vrijdag 8 augustus 2025 20:21 Aan: jallib <[email protected]> Onderwerp: [jallib] INA3221 board Hi all, is there anyone who has made a library for the INA3221 Three-Channel Shunt Current and Supply Voltage Monitor module (I2C)? I've been looking at the arduino lib to convert it to a JAL lib, but it's a bit too complicated for me. Greetings, Bill -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/jallib/d1457069-00f6-4edf-9e52-2ca8078b25b5n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/d1457069-00f6-4edf-9e52-2ca8078b25b5n%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/jallib/59fb5bce-a58a-4e0b-ae12-441bb1b3e0f7n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/59fb5bce-a58a-4e0b-ae12-441bb1b3e0f7n%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/jallib/0b07cd1d-a2f2-43fb-9c05-370cdc0e13d2n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/0b07cd1d-a2f2-43fb-9c05-370cdc0e13d2n%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/jallib/AM7PR02MB6098982290F3959C06D94D30E62BA%40AM7PR02MB6098.eurprd02.prod.outlook.com<https://groups.google.com/d/msgid/jallib/AM7PR02MB6098982290F3959C06D94D30E62BA%40AM7PR02MB6098.eurprd02.prod.outlook.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/jallib/e13b96c7-e85f-45ed-846e-45c7d82b6030n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/e13b96c7-e85f-45ed-846e-45c7d82b6030n%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To view this discussion visit https://groups.google.com/d/msgid/jallib/be855725-07ee-45da-811b-777c7344c08bn%40googlegroups.com<https://groups.google.com/d/msgid/jallib/be855725-07ee-45da-811b-777c7344c08bn%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/jallib/AM7PR02MB6098D2A0F658C1114853DC8DE631A%40AM7PR02MB6098.eurprd02.prod.outlook.com.
