Go Down

Topic: Sht85 library with software i2c (Read 2413 times) previous topic - next topic

GianUNI

I'm assembling a single sht85 sensor using arduino
I wanted to ask if I should use two 10 kohm resistors between the VDD and SDA and between the VDD and SCL, as shown in the sensor datasheet. Or if these resistances are already present in the sensor

thanks

physocean

I am trying to use the nano Arduino micro-controller to interface with the sensirion sht85 sensor. My wiring is as follows:

sensor pin 1 => D5 (which is the scl) according to the arduino diagram
sensor pin 2 => 5V
sensor pin 3 => GRND
sensor pin 4=> D4 (which is the sda)

Below is my code:
===================================================================


#include <Wire.h>

#include <SHTSensor.h>


#include "SHTSensor.h"

SHTSensor sht;
// To use a specific sensor instead of probing the bus use this command:
// SHTSensor sht(SHTSensor::SHT3X);

void setup() {
  // put your setup code here, to run once:

  Wire.begin();
  Serial.begin(9600);
  delay(1000); // let serial console settle

  if (sht.init()) {
      Serial.println("init(): success\n");
  } else {
      Serial.println("init(): failed\n");
  }
}

void loop() {
  // put your main code here, to run repeatedly:

  if (sht.readSample()) {
      Serial.print("SHT:\n");
      Serial.print("  RH: ");
      Serial.print(sht.getHumidity(), 2);
      Serial.print("\n");
      Serial.print("  T:  ");
      Serial.print(sht.getTemperature(), 2);
      Serial.print("\n");
  } else {
      Serial.print("Error in readSample()\n");
  }

  delay(1000);
}

====================================================================
when I run this code I got that the initialization has failed. Can anyone help walk me through on why my sensor is failing to initialize based on the provided description?

Thanks

pylon

Quote
I wanted to ask if I should use two 10 kohm resistors between the VDD and SDA and between the VDD and SCL, as shown in the sensor datasheet. Or if these resistances are already present in the sensor
The pull-up resistors are not on the sensors board. But as the Wire library activates the internal pull-ups you can ommit the pull-ups if you use short wires (< 10cm).

Quote
I am trying to use the nano Arduino micro-controller to interface with the sensirion sht85 sensor. My wiring is as follows:

sensor pin 1 => D5 (which is the scl) according to the arduino diagram
sensor pin 2 => 5V
sensor pin 3 => GRND
sensor pin 4=> D4 (which is the sda)
On the Nano SDA/SCL is on A4/A5 and not D4/D5.

physocean

The pull-up resistors are not on the sensors board. But as the Wire library activates the internal pull-ups you can ommit the pull-ups if you use short wires (< 10cm).

On the Nano SDA/SCL is on A4/A5 and not D4/D5.
I fixed the pin placement now to SDA/SCL on A4/A5. If I add a resistor from the 5V to the SDA and SCL wire this should work?

pylon

Quote
If I add a resistor from the 5V to the SDA and SCL wire this should work?
Not "a resistor", the resistor value is relevant. Use a 4k7 resistor, that should work. Keep the wires as short as possible, more than 50cm in total probably won't work.

physocean

I have used 2 10 k.Ohm resistors attached from the 5V to the SDA and one to the SCL wire. I still get a failed to initialize for the measurements. I also know that my wires are less than 50cm in length.


this is what I still get on the com port.
init(): failed
 Error in read()


Any suggestions as what might now be the issue?

pylon

Quote
Any suggestions as what might now be the issue?
Most probably a wiring problem. Post sharp pictures of your setup where all wires are clearly visible!

physocean

#22
Jan 14, 2020, 10:33 pm Last Edit: Jan 14, 2020, 10:36 pm by physocean
I'm not sure what the issue is regarding the not initializing of the sensor. Hope the images will help with the troubleshooting of the issue.

physocean

second image to my prior post.

pylon

Post an additional picture where we can see the connections to the Nano!

Go Up