Sht85 library with software i2c

Hello,
Can anybody tell me if its possible to use the arduino library for the new sht85 sensor with software i2c, too?

Can anybody tell me if its possible to use the arduino library for the new sht85 sensor

Yes, that sensor is already supported.

with software i2c, too?

No, the library does not support software I2C. You might try to modify it if you really need this feature.

@pylon: Thank you. Yes, i need to use software i2c, because i hav a custom made pcb, where i2c is already in use by an eeprom and is not accessible via pins:-( Do you think it is complicated to adopt, or is it just using the i2c software library and changing the pins?

es, i need to use software i2c, because i hav a custom made pcb, where i2c is already in use by an eeprom and is not accessible via pins:

It's absolutely no problem to use the I2C bus by several devices. I don't know how much the SHT85 make use of I2C details such as clock stretching as the software emulations I'm aware of don't support that.

Do you think it is complicated to adopt, or is it just using the i2c software library and changing the pins?

It's definitely more than this. Depending on how compatible the software I2C you're planning to use is with the Wire library (same interface) you might be fine with some defines but there is a great chance that you have to go into the library and replace every I2C call in it.

I definitely would prefer a hardware i2c solution, but in my case there sre no i2c pins accessible to connect to the sensor, because they are directly welded to an e2c eeprom chip. Instead i have a „hygrometer“-plug on my pcb with digital pins, ready made for sht75 sensor, which used a digital 2 wire interface, but not i2c. So i am looking for a plug in-replacement in order to be able to just plug in the new sht85 on the same connector of my pcb.
Because i have the same chip as the arduino due on my pcb, I thought of using this library:

What is your opinion about it? Do you think it should be possible finding a plug-in solution? Because otherwise i would have to redesign my pcb, which would be quite expensive, because its professionally made...

What is your opinion about it?

It seems to be a portable library that produces a rather slow I2C interface. It is not compatible with Wire library so you have to adapt the SHT85 library to work with it.

Do you think it should be possible finding a plug-in solution?

I'm not aware of such a solution so it might be quite hard to find one.

Because otherwise i would have to redesign my pcb, which would be quite expensive, because its professionally made...

Please excuse my honesty but it doesn't sound like a professional product with such fundamental errors in it. If you haven't already produced hundreds of it I would redesign it and adapt the hardware to allow the usage of the hardware I2C interface.

Hm, i see. Why do you think its not professional? On the pcb there are many, many connectors. one of them is the connector for the sht75, but the production is going to obsolete now. the sht85 is sold as a plug in replacement, but only the dimensions of the pinout is the same, the interface changed from "digital Sbus" to i2c.
the problem is, that the one time-costs for installing the serial production were quite expensive, so i am rather looking for a software solution than changing the hardware...

pylon:
Please excuse my honesty but it doesn't sound like a professional product with such fundamental errors in it. If you haven't already produced hundreds of it I would redesign it and adapt the hardware to allow the usage of the hardware I2C interface.

@OP

Which Arduino Board/MCU are you using for which you asking Software I2C Interface? This link offers you an example of operating UNO and NANO using soft I2C Bus. The UNO is a Master, and it uses DPin-10 and DPin-11 as SSDA and SSCL lines respectively (any digital pin-pair could be used for SI2C Bus).

Hm, i see. Why do you think its not professional? On the pcb there are many, many connectors. one of them is the connector for the sht75, but the production is going to obsolete now. the sht85 is sold as a plug in replacement, but only the dimensions of the pinout is the same, the interface changed from "digital Sbus" to i2c.

Excuse me, I got that wrong, I understood it as a custom PCB made explicitly for your project. As you're going to replace a component that soon reaches end of life it seems that your project is planned to exist for some time. In such a situation I would refactor the PCB and adapt to the new situation to get a reliable solution in the end. Software emulations may work but are never as reliable as the same in hardware. Just my two cent.

As I already wrote, I would expect the SHT85 to work with the I2C software emulation but you have to change the library to use that emulation and the interface is not identical.

Hi,

I bought a SHT85 Humidity and Temperature sensor from Sensirion, and i downloaded the library from github, but unfortunatly it doesent work.
Can u please help me fix this.

Best regards.

Please, post your connection diagram, the codes you have prepared/uploaded, and a link to the data sheets of the sensor. Don't forget to mention the Arduino (UNO/NANO/MEGA?).

Hi Mostafa,

I will use an Arduino UNO, and i need to use the three sensors in the same time. The problem is that I can't even use one. I did the same as in the datasheet but i have no results.

Here it is the link to the datasheet
https://www.mouser.com/catalog/specsheets/Sensirion_10022018_HT_DS_SHT85_V0.9_D1.pdf.

i'll send you a picture of the hardware too.

Thank you so much.

Samia

@Samia
1. Have you uploaded any sketch into UNO for the operation of your sensor? If yes, please post your codes with code tags(</>).

2. Do you know the 7-bit I2C address of your sensor? What is it? I could not find it from the data sheets. Please, connect only one sensor with the I2C Bus of UNO and upload the following sketch to know the address of the sensor. Please, report the address of the sensor.

#include <Wire.h>

void setup()
{
  Serial.begin(115200);
  Serial.println("Address search");
  Serial.println("-------------------------");

  Wire.begin();
  byte i2c = 0x00;
  for (int i = 0; i < 0x80; i++)
  {
    Serial.print("Search at [");
    Serial.print(i2c, HEX);
    Serial.print("]: ");
    Wire.beginTransmission(i2c);
    byte busStatus = Wire.endTransmission();
    if (busStatus == 0)
    {
      Serial.println("Device Found...!");
    }
    else
    {
      Serial.println("Device not found...!");
    }
    i2c++;
  }

}

void loop()
{

}

Hi Mostafa,

First of all, thank you so much for ur help.
I did upload a sketch from GitHub this morning and it actually worked i tried 10 times yesterday but it didnt.
But I have some doubts about the values of RH nd Temperature.

I really need to use the 3 sensors with the same Arduino UNO. Could u give some advice ( I'm not so sure if i can use a multiplexer, it's so complicated for me).

Here it is the code.

#include <SHTSensor.h>

#include <Wire.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");
  }
  sht.setAccuracy(SHTSensor::SHT_ACCURACY_MEDIUM); // only supported by SHT3x

}

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

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

  delay(2000);
}

It is a good news that your sensor works. I was particularly interested to know the I2C address of the sensor which you could provide me by executing the 'addressSearch' program that I posted you. Anyway, if you want to operate your 3 identical sensors simultaneously having the same address, you need suitable I2C bus expander like PCA9547.

Proposed connection among UNO, PCA9547, and SHT85s:
pca9547.png

1. I2C Bus expander address : 0b1110000
2. Codes to select SHT85-0 for data acquisition:

Wire.beginTransmission(0b1110000);
Wire.write(0b00001000);      //code for SHT85-0 sensor; see data sheets of PCA9547
Wire.endTransmission();        //now SHT85-0 is selected

3. Insert codes to communicate with SHT85-0

pca9547.png

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

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

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).

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.

pylon:
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?

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.