0

Adafruit INA260 Example Doesn't Work
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adafruit INA260 Example Doesn't Work

by wb1234 on Fri May 14, 2021 7:21 pm

Spent days trying to get this example to work with INA260 and Adafruit ItsyBitsy M0.

https://learn.adafruit.com/adafruit-ina ... ut/arduino

There is no error and library doesn't get past ina260.begin(), it doesn't even get to the next line println().

Serial.println("Adafruit INA260 Test");

if (!ina260.begin()) {
Serial.println("Couldn't find INA260 chip");

Seems to be the library ina260.cpp isn't correct and just hangs.. but when I use the same hardware and use the example for INA219, that example works.. shows results, but the numbers are wrong so the conversion isn't right.

https://learn.adafruit.com/adafruit-ina ... duino-code

Could you update the example? as maybe something was left out of the arduino code example or the library needs to be updated.

wb1234
 
Posts: 6
Joined: Fri May 14, 2021 7:09 pm

Re: Adafruit INA260 Example Doesn't Work

by adafruit_support_bill on Fri May 14, 2021 7:29 pm

Please post some photos showing all your soldering and connections.

adafruit_support_bill
 
Posts: 81544
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit INA260 Example Doesn't Work

by wb1234 on Fri May 14, 2021 7:53 pm

Did same as the example below and used multimeter to check for continuity.

example.png
example.png (117.2 KiB) Viewed 266 times


Only got further after read this post and used INA219 arduino example.

viewtopic.php?t=116537

wb1234
 
Posts: 6
Joined: Fri May 14, 2021 7:09 pm

Re: Adafruit INA260 Example Doesn't Work

by adafruit_support_bill on Sat May 15, 2021 5:50 am

Please post some photos showing all your soldering and connections.
We need to see the soldering.

adafruit_support_bill
 
Posts: 81544
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit INA260 Example Doesn't Work

by natebc on Sat May 15, 2021 9:53 am

Seems to be the library ina260.cpp isn't correct and just hangs.. but when I use the same hardware and use the example for INA219, that example works.. shows results, but the numbers are wrong so the conversion isn't right.

So you took the example, modified it, and now it doesn't work. But the unmodified example works but gives you the wrong values? What values are you expecting and what does it give you?

natebc
 
Posts: 8
Joined: Wed May 12, 2021 2:21 pm

Re: Adafruit INA260 Example Doesn't Work

by wb1234 on Sat May 15, 2021 3:57 pm

"So you took the example, modified it, and now it doesn't work. But the unmodified example works but gives you the wrong values? What values are you expecting and what does it give you?"

So I took the INA260 code example and couldn't get it to work with INA260 hardware. Tried many times.. it wouldn't get past the setup function begin() call in example. Just sat there.

Then tried leaving hardware the same, uploading the INA219 code example and it got past the setup function into the loop function, but the values that don't have right conversions from the library class as it thinks it's INA219 hardware, but really it's INA260 hardware.

16:55:48.246 -> Measuring voltage and current with INA219 ...
16:55:48.246 -> Bus Voltage: 0.00 V
16:55:48.246 -> Shunt Voltage: 0.00 mV
16:55:48.246 -> Load Voltage: 0.00 V
16:55:48.246 -> Current: 0.00 mA
16:55:48.246 -> Power: 0.00 mW

So using the INA219 code example with INA260 hardware gets further along.

So think it's more likely the INA260 .h class or code example that has error?

wb1234
 
Posts: 6
Joined: Fri May 14, 2021 7:09 pm

Re: Adafruit INA260 Example Doesn't Work

by adafruit_support_bill on Sun May 16, 2021 6:15 am

The INA260 driver is known to work. If you post photos as requested so we can try to diagnose the problem.

adafruit_support_bill
 
Posts: 81544
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit INA260 Example Doesn't Work

by wb1234 on Sun May 16, 2021 1:14 pm

image.jpg
Adafruit INA260
image.jpg (724.92 KiB) Viewed 234 times


Any difference in Arduino IDE to have selected board be "Adafruit ItsyBitsy M0" when the board is "Adafruit ItsyBitsy M0 Express" ?

wb1234
 
Posts: 6
Joined: Fri May 14, 2021 7:09 pm

Re: Adafruit INA260 Example Doesn't Work

by adafruit_support_bill on Sun May 16, 2021 1:45 pm

Your photos don't show the soldering. And it looks like your headers on both boards are installed from the wrong side.

Any difference in Arduino IDE to have selected board be "Adafruit ItsyBitsy M0" when the board is "Adafruit ItsyBitsy M0 Express" ?

No. Both are based on the M0 processor so the code compiles the same way.

adafruit_support_bill
 
Posts: 81544
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit INA260 Example Doesn't Work

by wb1234 on Sun May 16, 2021 2:40 pm

Good idea, so removed the headers and wires and went to just jumpers and same problem. INA260 didn't work, and INA219 code example got further along.

So then added print statements in the (libraries/Adafruit_INA260_Library/Adafruit_INA260.cpp) file to see how far it was getting.. and here is output.

Maybe missing a library that is needed for INA260 to mfg_register->read() or device_id->read() ?

Adafruit_I2CRegisterBits *device_id =
new Adafruit_I2CRegisterBits(die_register, 12, 4);
Serial.println("Test 7");
// make sure we're talking to the right chip
if ((mfg_register->read() != 0x5449) || (device_id->read() != 0x227)) {
return false;
Serial.println("Test 8");
}
Serial.println("Test 9");


11:17:26.770 -> Adafruit INA260 Test
11:17:26.770 -> Test 1
11:17:26.770 -> Test 2
11:17:26.770 -> Test 4
11:17:26.770 -> Test 5
11:17:26.770 -> Test 6
11:17:26.770 -> Test 7
11:17:26.770 -> Couldn't find INA260 chip

wb1234
 
Posts: 6
Joined: Fri May 14, 2021 7:09 pm

Re: Adafruit INA260 Example Doesn't Work

by adafruit_support_bill on Sun May 16, 2021 2:58 pm

Good idea, so removed the headers and wires and went to just jumpers and same problem.

Please post photos showing your soldering to the jumpers.

adafruit_support_bill
 
Posts: 81544
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit INA260 Example Doesn't Work

by wb1234 on Sun May 16, 2021 4:31 pm

Okay, so tried again, while using ItsyBitsy M0 Express board, to see in INA260.cpp if I could find an error.

Found that mfg_register->read() is equal to 4294967295, and this is not equal to 0x5449.

In hexadecimal 4294967295 is FFFFFFFF which means that the device is always reading ones which suggests that you haven't got it wired up correctly.

However, didn't try soldering, because the INA219 code example kinda worked, and the INA219 library cpp file doesn't do any registering with Bus IO, etc. that the INA260 library cpp file does.

So I then removed the (Adafruit ItsyBitsy M0 Express board) and tried with (Adafruit ESP32 Feather board) and the INA260 code example worked! shows accurate results.

Maybe the ItsyBitsy board is bad? or look into the Adafruit ItsyBitsy M0 Express board being able to use the INA260?

Got it to work with ESP32 Feather, so will use that for now.

wb1234
 
Posts: 6
Joined: Fri May 14, 2021 7:09 pm

Re: Adafruit INA260 Example Doesn't Work

by adafruit_support_bill on Sun May 16, 2021 5:12 pm

However, didn't try soldering

That is most likely your problem.

adafruit_support_bill
 
Posts: 81544
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.