INA219 module and ...
Rsadeika
Posts: 3,837
I was looking for something that could read current and voltage, and came across this module. Wondering if anybody has used this with, maybe a Propeller, using C code.
It seems like there is example code and a wiring diagram for a Raspberry Pi, but I wonder if this could be workable with the new P2, and of course the P1.
Thanks
Ray
It seems like there is example code and a wiring diagram for a Raspberry Pi, but I wonder if this could be workable with the new P2, and of course the P1.
Thanks
Ray
Comments
I used the one from Adafruit.
Wrote C code to drive it nicely.
Mike
I also looked at Jon's jm_ina219.spin program, I wonder how that would work with the flexGUI IDE. The last time I used the spintoc part of flexGUI, to convert some Spin code to PropGCC, I was not able to make the PropGCC code work correctly.
I will probably be collecting the INA260 data, continuously, and feeding it to an SQLite database, for further analysis. These are just a few things that I have in mind.
My object will work if you write your code in Spin or in FlexC.
I've attached a demo program that uses four of my Spin objects without modification/conversion -- one that launches a PASM cog (serial io). Interesting, the C binary image was a little bigger than the identical program written in Spin; this may have to do with overhead dealing with Spin objects in C. Still it works, so I can write C code without walking away from all of my existing objects. Spin is my favorite Propeller language, but it's nice to have C as an option.
Mike
What I don't see how to do so far: Including/using bytecode Spin in FastSpin LMM code and the other way round. But I dont expect much demand for this. :-)
Mike
Thanks iseries, for a pointer to your libina260 driver. I will also take a closer look at your SimpleIDE implementation for using the INA260.
Now, I have to get a better understanding of the code that has been presented so far before I make a decision as to what I will be using. Will it be SimpleIDE, flexC, flexBASIC, micropython, or, …
Another choice P2 Eval or FLiP module or ...
In the INA260 folder you have the file, libina260.c, this is really not a lib file, since it contains the main() function. The file, ina260.c, is the lib file, since it does not contain a main(), correct.
The actual lib file, would that be placed in the Simple Library folder, and then added while in SimpleIDE?
If, you were so kind, could you add a brief description as to what pins would be used, for instance, a FLiP module -> INA260 unit.
I am going to replacing some of my voltage divider breakouts, using ADC, with the INA260 to get some more detailed information that the ADC method lacks.
Thanks
Ray
Since all my code is put in a folder called "Custom" that would be where you put the zipped file into. So in the Learn/Simple Libraries you would add a folder call "Custom" and unzip the folder there.
You can then use the SimpleIDE to open the project folder that has test code in it and will show a sample of how to use it. In addition there is an HTML folder with a file index.html that documents all the functions of this library.
To use the library simple add it to your projects under project add simple library.
Mike
I just downloaded your latest zip. In the html folder you have a file doc.png, I assume it is a photograph? For some reason my Win 10 Pro does not show the picture. I assume that is where you show what pins are connected to what pins.
Once I get this to work with SimpleIDE I will probably try to get it to work with FlexGUI. I have not used FlexGUI in quite awhile, hopefully it will be able to handle the INA260 program.
Ray