News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

INA260 current & voltage monitor

Started by RGV250, May 04, 2025, 12:56 PM

Previous topic - Next topic

RGV250

Hi,
Here is my code for the INA260 current & voltage monitor. I have only tested it with an LED but it all seems to work as expected.

There are a couple of things I have not completed.
Alerts as I have no need for them, also seems a bit pointless as all it does is toggle a pin. If anyone need them let me know and I will have a look.
High speed I2C mode (1kHz to 2.94MHz) as I am not sure if the PIC could operate at that speed.

Link to device overview https://www.adafruit.com/product/4226

INA260.zip

Regards,
Bob

Fanie

Off topic but -
I always use components that will make life easier.  I use the ACS713-30 (30A) for my current applications.  No shunt resistors and you can just read an analog pin.  No timing or speed issues.  The ACS713 is available in various current models from 5A to 30A and there is an ACS712 model(s) that output about 50% for plus/minus currents.

I used these in various applications and they seem very robust.  Never damaged one.
Allegro makes a whole range of current sensors, including digital ones if you want to make life more difficult for yourself  ;)

shantanu@india

INA260 seems good but would have been better had it worked with A.C. I have some Allegro Hall sensors & they are no doubt convenient for the natural galvanic isolation they provide.
I am searching for a cheap true RMS chip (preferably 3-phase) which can provide voltage , current , power , power factor etc. over I2C.
Regards
Shantanu

RGV250

Hi Fanie,
How is it making my life difficult, part of the fun is actually using my brain cell to do the programming. Difficult would be doing it in asm or C.
I do not like analog inputs as you only need a little resistance in a joint and the reading will be inaccurate. All the analog current sensors I looked at did not measure voltage as well.
Looking at the devices you mention, both are 5v so totally useless on a 3.3v PIC unless I add another regulator. The 712 also states 66 to 185mV/A which doesn't seem to be accurate to me, the output varies wildly depending on temperature, at 0c there is a 500mV offset. In the UK we do see low temperature quite a lot. 

Shantanu.
https://www.analog.com/media/en/technical-documentation/data-sheets/78m6631.pdf

Regards,
Bob

Bob