I2C & Legacy Sensibus (LSS)

Hi there,

I'm currently attempting to read data form a Davis Instruments temperature and relative humidity sensor. This instrument is powered by the Sensiron SHT31-LSS, which is a digital sensor that communicates using the Legacy Sensibus protocol. Sensiron provides an Arduino library on GitHub, which has allowed me to successfully read the temperature and humidity when connecting the SHT31-LSS by itself to an Adafruit Feather M0.

The problem I'm encountering is that when I add a DS3231 RTC to the I2C bus, the Arduino will crash after reading the Sensibus device. From what I've read, Senisbus and I2C devices should be able to coexist on the same bus, but I'm wondering if this isn't actually the case.

The code I'm using to read both devices is included below and I've noted at which point the code fails.

I hadn't heard of Legacy Sensibus before today, so I'd appreciate if anyone has some insight as to what could be going wrong. Should these two devices be able to play nicely? From what I can tell, the Sensibus protocol appears to be rendering I2C inoperable.

Cheers,
Adam

#include <DS3232RTC.h>    // https://github.com/JChristensen/DS3232RTC
#include <sensirion.h>    // https://github.com/HydroSense/sensirion

// Specify data and clock connections and instantiate sensirion object
#define dataPin   20
#define clockPin  21
#define ledPin    13

DS3232RTC       myRTC(false);             // Tell constructor not to initialize the I2C bus
sensirion       sht(dataPin, clockPin);
time_t          t;
tmElements_t    tm;

void setup()
{
  Serial.begin(9600); // Open serial connection to report values to host
  while (!Serial);

  pinMode(ledPin, OUTPUT);

  myRTC.begin(); // Initialize the I2C bus

  // Print current date and time
  printDateTime(myRTC.get());
}

void loop()
{
  readSht31();
  Serial.println("readSHT31() complete");   // This print statement is seen in the serial console
  printDateTime(myRTC.get()); 
  Serial.println("printDateTime() complete");  // This print statement is never seen. Program crashes.
  delay(2000);
}

void readSht31() {

  // Blink
  digitalWrite(ledPin, (digitalRead(ledPin) == HIGH) ^ 1);

  // Read sensor
  uint16_t status = sht.readStatus();
  float temp_c = sht.readTemperatureC();
  float temp_f = sht.readTemperatureF();
  float humidity = sht.readHumidity();

  // Print data to serial
  Serial.print("Status: 0x"); Serial.println(status, HEX);
  Serial.print("Temperature: "); Serial.print(temp_c, DEC); Serial.println(" C");
  Serial.print("Temperature: "); Serial.print(temp_f, DEC); Serial.println(" F");
  Serial.print("Humidity: "); Serial.print(humidity); Serial.println("%");
}

// Print current time and date
void printDateTime(time_t t)
{
  Serial.print((day(t) < 10) ? "0" : ""); Serial.print(day(t), DEC); Serial.print('/');
  Serial.print((month(t) < 10) ? "0" : ""); Serial.print(month(t), DEC); Serial.print('/');
  Serial.print(year(t), DEC); Serial.print(' ');
  Serial.print((hour(t) < 10) ? "0" : ""); Serial.print(hour(t), DEC); Serial.print(':');
  Serial.print((minute(t) < 10) ? "0" : ""); Serial.print(minute(t), DEC); Serial.print(':');
  Serial.print((second(t) < 10) ? "0" : ""); Serial.println(second(t), DEC);
}

Using Google on Sensibus leads me to some kind of food company. Are You sure about the Spelling?

Railroader:
Using Google on Sensibus leads me to some kind of food company. Are You sure about the Spelling?

The folks over at WXForum.net refer to it as Legacy Digital or Legacy Sensibus single shot (LSS). The Sensiron SHT3x-LSS datasheet calls it "Sensibus Communication" or "Sensibus protocol".

I also did a search on Google and there really wasn't a lot out there! From what I've read, it seems that Davis Instruments chose this weird sensor/protocol combination as it could be used as a drop-in replacement for their older sensors. Of course when you contact their technical support they either have no clue what you're talking about or refuse to tell you anything because it's "proprietary information".

Cheers,
Adam

Hmm!

It appears that I've solved my own problem. It looks like you need to reinitialize the I2C bus after each reading of the SHT31-LSS sensor. I haven't looked too closely at Sensiron's library, but my guess is whatever state the 2-wire communication protocol is left in after a reading is causing havoc with all other I2C devices on the bus. I just added a "Wire.begin()" at the end of the readSht31() function and everything's working fine!

Cheers,
Adam

Could it work to use 2 I2C buses, using 2 Soft Serial channels using 2 * 2 I/O pins? Then You can use one I2C channel for the Sensibus and one channel for the "normal" I2C.