Can't figure out how to code Multiple SHT10 temp/humid sensors

I'm trying to add two SHT10 sensors to a much larger project but cannot figure out how to read from 2 sensors independently. I'm using the sensirion library found at Sensirion Github .

I'm fairly new to this and every attempt to change this code for 2 sensors does not work. Any help would be appreciated.

This is the code:

#include <Sensirion.h>

const uint8_t dataPin  =  5;
const uint8_t clockPin =  6;

float temperature;
float humidity;
float dewpoint;

Sensirion tempSensor = Sensirion(dataPin, clockPin);

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  tempSensor.measure(&temperature, &humidity, &dewpoint);

  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.print(" C, Humidity: ");
  Serial.print(humidity);
  Serial.print(" %, Dewpoint: ");
  Serial.print(dewpoint);
  Serial.println(" C");
  
  delay(5000);  
}

I looked on your schematic and could not find the second data pin. With both connected as the software indicates you will get garbage.

1 Like

Does it work for one sensor?

Schematic?

Where do you have the second sensor attached?

Your code looks almost exactly like https://github.com/spease/Sensirion/blob/master/examples/SimpleSensirion/SimpleSensirion.pde

I think the main change you need is near this line:

...you need to instantiate another sensor with a different name on different pins with a line like this completely untested line:

Sensirion tempSensor2 = Sensirion(dataPin2, clockPin2);

What have you tried? And how has it failed?

2 Likes

Yes it does

Pins 6 and 7

It is. I'm trying to get the simple code working with 2 sensors.
My problem is

How do i distinguish the 2 sensors from each other?

See post #3.

1 Like

I will give try in the AM. Thank You

Completely forgot to update this but thank you.

I did not notice the 2 after each at first. It was easy as that. I'm learning a lot.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.