2

I have recently purchased an Arduino Nano 33 IOT together with two sensors:

However, so far I have not succeeded in reaching any of these two sensors. For example I connect the SHT31 sensor like this:

  • +3.3V to Vin
  • GND to GND
  • A4 to SDA
  • A5 to SCL

I have tried the default Adafruit SHT31-D example without success, the program appears to hang. I have tried a standard I2C scanner but it does not find any devices with the sensor connected. When the sensor is disconnected, it does find two devices (the IMU and something else I guess).

I believe there is something funky going on with the I2C connection of the internal sensors and the external ones but I have no idea how to troubleshoot this issue. I read some stuff about TwoWire (extern TwoWire Wire1; after the #include) but I am having a hard time figuring out if this is what I need and how to implement it.

I found these topics myself:

https://forum.arduino.cc/index.php?topic=639188.0

https://forum.arduino.cc/index.php?topic=658967.0

edit: I haven't had success dealing with these issues so far and I am still looking for some help with my problems!

3 Answers3

2

one can code an I2C sensor (I'm using a SHT31) using custom GPIO ports like so:

    //I2C Bus Pins
    #define SDA 8
    #define SCL 9
#include "Adafruit_SHT31.h"
TwoWire I2Cbus = TwoWire(0);
Adafruit_SHT31 sht31 = Adafruit_SHT31(&I2Cbus);

void setup(){
  Serial.begin(115200);            // USB communication with Serial Monitor
  Serial.print("Starting serial...");

  Serial.print("Starting SHT31...");
  startSHT(); 
}

 // ********************************************************
 void startSHT(){
  I2Cbus.begin(SDA, SCL, 100000ul); 
  if (! sht31.begin(0x44)) { // Set to 0x45 for alternate i2c addr
     Serial.println("Couldn't find SHT31");
     while (1) 
     delay(1);
  }
}

Miguel Tomás
  • 219
  • 1
  • 9
2

I had a similar problem, but the fix turned out to be simple. All the tutorials for SHT3x sensors say to connect the VIN to the 3.3V GPIO. I checked using a test meter, the SHT3x was getting voltage but numerous SH3x libraries didn't seem to work, and a couple of I2C sketches also found nothing. So I tried moving the VIN lead to the 5V GPIO pin - it works perfectly. Perhaps my USB connection lacks enough power, or perhaps my SHT3x needs 5V. Either way it works - happy now !

Hillclimb
  • 21
  • 2
0

Without a schematic I will take a SWAG" For I2C to work it needs a pull up resistor for SCL another for SDA. Both are open drain/collector outputs neither of which can drive a + (logic 1) on the bus.

Gil
  • 1,863
  • 9
  • 17