Hi all! I'm a new Moteino user, and I was wondering if anyone had any ideas about a problem I'm encountering.
I'm trying to use a Moteino 8MHz to read from and SHT 30-D, an I2C-based temperature/humidity sensor. (This one from Adafruit
https://www.adafruit.com/product/5064, to be specific.) However, whenever I try to access the SHT30 over I2C using the Moteino, nothing happens. I don't have anything else connected to the Moteino's I2C bus.
More specifically, I've tried several different SHT-3X libraries, and all of them give me an error saying the SHT 30 was not found.
Things I've tried to debug this:
- I tested the SHT30 by connecting it to my Raspberry Pi Zero's I2C interface, and it worked fine.
- To figure out if the Moteino has a faulty I2C interface, I hooked the Moteino up to my Pi Zero and ran a slave sender/receiver program. The Pi correctly wrote and read bytes from the Moteino (which correctly received/sent them).
- I tried using the simple I2C scanner sketch below to see if the SHT30 would even show up on the I2C bus. Whenever I run the sketch with the SHT30 connected, it hangs at the indicated line. If I disconnect the SHT-30, the sketch runs correctly and reports no devices.
#include <Wire.h>
void setup() {
Wire.begin();
Serial.begin(9600);
while (!Serial); // Leonardo: wait for serial monitor
Serial.println("\nI2C Scanner");
}
void loop() {
int nDevices = 0;
Serial.println("Scanning...");
for (byte 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.
Wire.beginTransmission(address);
byte error = Wire.endTransmission(); // With SHT-30 connected, sketch hangs here on the very first iteration of the loop
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
}
Does anyone have any ideas on what might be preventing the I2C bus/SHT-30 from working correctly on the Moteino 8MHz? Thanks in advance!
P.S. I'm cross-posting this on the Adafruit forums and a couple of other places, just in case somebody elsewhere has encountered a similar problem.