Hi, I know others have had similar problems but I think I checked everything over and can't see what the problem is. Actually I'm trying to help my 8 year old son with this, but I have rewired everything from scratch twice, tried a different UNO in case the first one had the SDA/SCL fried, checked with a meter that he is using 10k ohm resistors, and added print statements to the scanner code.
We only have the one I2C device (which cost $30) so I am thinking maybe it is no good?
The sensor is a melexis MLX90614ESF-ACF-000-SP. (We've built a little "robot" and he wants to make it heat-seeking -- hey, he's 8 yr old, he wants it to follow people around.)
So, I am trying to attach halfway-decent pics of our set-up, and our board info. I have stared at this quite a bit and believe we are following Overview | Using Melexis MLX90614 Non-Contact Sensors | Adafruit Learning System (which is for a wide-angle sensor whereas ours is a 10-degree FOV which we had to get from Mouser).
Here is the code:
#include <Wire.h>
void setup() {
Wire.begin();
Serial.begin(9600);
while (!Serial); // Leonardo: wait for serial monitor
Serial.println("\nI2C Scanner");
}
void loop() {
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for (address = 1; address < 127; address++ ) {
// The i2c_scanner uses the return value of the Write.endTransmisstion to see if
// a device did acknowledge to the address.
Serial.print(address);
Wire.beginTransmission(address);
Serial.println(": After beginTransmission");
error = Wire.endTransmission();
Serial.print("After endTransmission, error=");
Serial.println(error);
if (error == 0) {
Serial.print("I2C device found at address 0x");
if (address<16) {
Serial.print("0");
}
Serial.print(address,HEX);
Serial.println(" !");
nDevices++;
} else if (error==4) {
Serial.print("Unknown error at address 0x");
if (address<16)
Serial.print("0");
Serial.println(address,HEX);
}
}
if (nDevices == 0) {
Serial.println("No I2C devices found\n");
} else {
Serial.println("done\n");
}
delay(5000); // wait 5 seconds for next scan
}
And this results in only the following monitor output:
I2C Scanner
Scanning...
1: After beginTransmission
After which it hangs.
If I unplug the yellow wire, it rolls right along (and says no devices found):
I2C Scanner
Scanning...
1: After beginTransmission
After endTransmission, error=2
2: After beginTransmission
After endTransmission, error=2
3: After beginTransmission
After endTransmission, error=2
4: After beginTransmission
After endTransmission, error=2
5: After beginTransmission
. . .
123: After beginTransmission
After endTransmission, error=2
124: After beginTransmission
After endTransmission, error=2
125: After beginTransmission
After endTransmission, error=2
126: After beginTransmission
After endTransmission, error=2
No I2C devices found
I'm an old programmer but fairly new to electronics, so I may be doing something stupid... would at this point be glad to be proven stupid if it means we can move forward.
Thanks.
I added the pinout from the Melexis datasheet, which is available in its entirety at Error - Melexis





