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!

1
  • Did you try to use Arduino Uno (or similar) with these sensors? Nano 33 IOT is a little bit different compare to Uno (and similar) boards. That will verify if your sensors are fine or not.
    – Fahad
    Mar 31, 2020 at 21:21

1 Answer 1

1

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);
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.