Temperature and humidity monitoring is a common thing in many projects.
normally we are using DHT11/22 for normal prototype building. But it has some limitations in the sense of some product building.
For DHT 11 :
For DHT 22:
But sometimes we need accuracy more than these sensors. at that time the good option is SHT85 sensor by Sensirion.
Here sensor interface using I2C. So follow below connection diagram.
For SDA and SCL pin config:
Board:I2C / TWI pins
Uno, Ethernet A4 (SDA), A5 (SCL)
Mega2560 20 (SDA), 21 (SCL)
Leonardo 2 (SDA), 3 (SCL)
Due 20 (SDA), 21 (SCL), SDA1, SCL1
Here I'm using Arduino Uno.
After connecting setup library and upload code.
To get SHT library Goto to this link Download as zip >> ADD library as a zip in Arduino IDE.
Then:
SHTSensor
class (SHTSensor sht;
)setup()
, make sure to init the Wire library with Wire.begin()
Serial.begin(9600)
sht.readSample()
in the loop()
function, which reads a temperature and humidity sample from the sensorsht.getHumidity()
and sht.getTemperature()
to get the values from the last sampleUpload Example sketch to get Temperature and Humidity :
#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.print("init(): success\n");
} else {
Serial.print("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.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);
}
Then view your result via Serial Monitor;
Credits : https://github.com/Sensirion/arduino-sht
Temperature and humidity monitoring is a common thing in many projects.
normally we are using DHT11/22 for normal prototype building. But it has some limitations in the sense of some product building.
For DHT 11 :
For DHT 22:
But sometimes we need accuracy more than these sensors. at that time the good option is SHT85 sensor by Sensirion.
Here sensor interface using I2C. So follow below connection diagram.
For SDA and SCL pin config:
Board:I2C / TWI pins
Uno, Ethernet A4 (SDA), A5 (SCL)
Mega2560 20 (SDA), 21 (SCL)
Leonardo 2 (SDA), 3 (SCL)
Due 20 (SDA), 21 (SCL), SDA1, SCL1
Here I'm using Arduino Uno.
After connecting setup library and upload code.
To get SHT library Goto to this link Download as zip >> ADD library as a zip in Arduino IDE.
Then:
SHTSensor
class (SHTSensor sht;
)setup()
, make sure to init the Wire library with Wire.begin()
Serial.begin(9600)
sht.readSample()
in the loop()
function, which reads a temperature and humidity sample from the sensorsht.getHumidity()
and sht.getTemperature()
to get the values from the last sampleUpload Example sketch to get Temperature and Humidity :
#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.print("init(): success\n");
} else {
Serial.print("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.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);
}
Then view your result via Serial Monitor;
Credits : https://github.com/Sensirion/arduino-sht