News:

;) This forum is the property of Proton software developers

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

shantanu@india

Regards
Shantanu

Fanie

I can only offer from my experience.

On all my future boards I place a 5V regulator followed by an inexpensive 3V3 1117 regulator and with an optional 0R bypass for the 3V3.  While the micro's tend to go to the lower voltage, there are a lot of peripherals that do want 5V, like LCD displays and sensors.  Each get a 0R resistor selecting between either 5V and 3V3.  On one of my projects we used the 5V displays (with a 3V3 micro) instead of the 3V3 ones because the 3V3 ones had contrast problems.  Also, what is available.  Maybe supplies by you is stable, here everything is a disaster, seems that since Sick Africa is deteriorating to 4th world, the world is dumping their rejects here.

On all inputs that does not give a calibrated output (ie 18B20 temp sens) I use my old auto calibration method and it always comes out spot on.  Especially resistors (for reading voltage) can vary a lot in value and it is easy to compensate for that. 

I get good results with the ACS713 which can sit anywhere in the high or low side of (DC) power and it is robust, and we have wide swinging weather conditions too...

If you switch 20 instruments on and all 20 of them give the same correct readout you know you did something right.