INA219 module and ...

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

Comments

  • It should work with P1 and P2. I have used 3 of them with P1 to monitor a 3 output power supply, and am planning to use it with P2 when my P2D2 board arrives.
  • I used that device in a commercial product (laser-tag controller). My code is, of course, Spin. That said, it's very simple and you should have no trouble converting it to C.
  • I passed on this module and instead went with INA260 which seems to be better at measuring current and voltage.

    I used the one from Adafruit.

    Wrote C code to drive it nicely.

    Mike
  • iseries mentioned the INA260 module, which I think will be more useful for my purposes. Still have not decided how I will code the program. And, at a minimal I will probably need, to start with, at least four of theses modules, which brings up the question of, how do I make the modules available on the I2C buss.

    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.
  • JonnyMacJonnyMac Posts: 6,383
    edited 2019-11-11 - 20:32:39
    how do I make the modules available on the I2C buss.
    Both device types have A0 and A1 (address) inputs which allow up to for devices on the bus.
    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.
    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.
  • yes, the multi-language feature of fastspin is a wonderful thing.

    Mike
  • yetiyeti Posts: 622
    edited 2019-11-12 - 05:05:18
    msrobots wrote: »
    yes, the multi-language feature of fastspin is a wonderful thing.
    https://forums.parallax.com/discussion/169141 has several examples of mixing FastSpin's languages and even one using FastSpin compiled cog PASM output in OpenWrt which turned out to be purely straight forward.
    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. :-)
  • I put my INA260 driver in the OBEX if you are interested in a C version of the driver.

    Mike
  • Thanks Jon, for the excellent examples. I will look into the code to see how your Spin objects work within a C or flexBASIC confine.

    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 ...
Sign In or Register to comment.