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.
Adafruit INA260 Example Doesn't Work
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit INA260 Example Doesn't Work
Please post some photos showing all your soldering and connections.
- wb1234
- Posts: 6
- Joined: Fri May 14, 2021 7:09 pm
Re: Adafruit INA260 Example Doesn't Work
Did same as the example below and used multimeter to check for continuity.
Only got further after read this post and used INA219 arduino example.
viewtopic.php?t=116537
Only got further after read this post and used INA219 arduino example.
viewtopic.php?t=116537
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit INA260 Example Doesn't Work
Please post some photos showing all your soldering and connections.
We need to see the soldering.
We need to see the soldering.
- natebc
- Posts: 8
- Joined: Wed May 12, 2021 2:21 pm
Re: Adafruit INA260 Example Doesn't Work
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?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.
- wb1234
- Posts: 6
- Joined: Fri May 14, 2021 7:09 pm
Re: Adafruit INA260 Example Doesn't Work
"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?
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?
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit INA260 Example Doesn't Work
The INA260 driver is known to work. If you post photos as requested so we can try to diagnose the problem.
- wb1234
- Posts: 6
- Joined: Fri May 14, 2021 7:09 pm
Re: Adafruit INA260 Example Doesn't Work
Any difference in Arduino IDE to have selected board be "Adafruit ItsyBitsy M0" when the board is "Adafruit ItsyBitsy M0 Express" ?
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit INA260 Example Doesn't Work
Your photos don't show the soldering. And it looks like your headers on both boards are installed from the wrong side.
No. Both are based on the M0 processor so the code compiles the same way.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
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
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
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit INA260 Example Doesn't Work
Please post photos showing your soldering to the jumpers.Good idea, so removed the headers and wires and went to just jumpers and same problem.
- wb1234
- Posts: 6
- Joined: Fri May 14, 2021 7:09 pm
Re: Adafruit INA260 Example Doesn't Work
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.
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.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit INA260 Example Doesn't Work
That is most likely your problem.However, didn't try soldering
Please be positive and constructive with your questions and comments.