Intel Galileo and SHT31 humidity sensor example

In this example we take a SHT31 sensor and connect it to an Intel Galileo

The SHT3x humidity sensor is the successor of the SHT2x series it is determined to set the next industry standard in humidity sensing. The SHT3x humidity sensor series consists of a low-cost version with the SHT30 humidity sensor, a standard version with the SHT31 humidity sensor, and a high-end version with the SHT35 humidity sensor. The SHT3x humidity sensor series combines multiple functions and various interfaces (I2C, analog voltage output) with a applications-friendly, very wide operating voltage range (2.4 to 5.5 V). The SHT3x humidity sensor is available in both large and small volumes.

 

The SHT3x builds on a completely new and optimized CMOSens® chip, which allows for increased reliability and improved accuracy specifications. The SHT3x offers a range of new features, such as enhanced signal processing, two distinctive and user-selectable I2C addresses, an alert mode with programmable humidity and temperature limits, and communication speeds of up to 1 MHz.

The DFN package has a footprint of 2.5 × 2.5 mm2 with a height of 0.9 mm. This allows for integration of the SHT3x into a great variety of applications. Additionally, the wide supply voltage range of 2.4 to 5.5 V and variety of available interfaces guarantee compatibility with diverse integration requirements. All in all, the SHT3x humidity sensor series incorporates 15 years of knowledge from Sensirion, the leader in the humidity sensor industry.

 

Parts List

Label Part Type
Part1 Intel Galileo Gen2
Part2 Adafruit SHT31-D Sensirion Temperature/Humidity Sensor

 

Layout

 

Code

The following example is from the Adafruit library, there are other libraries and options available but this worked out of the box – https://github.com/adafruit/Adafruit_SHT31

[codesyntax lang=”cpp”]

#include <Arduino.h>
#include <Wire.h>
#include "Adafruit_SHT31.h"

Adafruit_SHT31 sht31 = Adafruit_SHT31();

void setup() {
  Serial.begin(9600);
  Serial.println("SHT31 test");
  if (! sht31.begin(0x44)) {   // Set to 0x45 for alternate i2c addr
    Serial.println("Couldn't find SHT31");
    while (1) delay(1);
  }
}


void loop() {
  float t = sht31.readTemperature();
  float h = sht31.readHumidity();

  if (! isnan(t)) {  // check if 'is not a number'
    Serial.print("Temp *C = "); Serial.println(t);
  } else { 
    Serial.println("Failed to read temperature");
  }
  
  if (! isnan(h)) {  // check if 'is not a number'
    Serial.print("Hum. % = "); Serial.println(h);
  } else { 
    Serial.println("Failed to read humidity");
  }
  Serial.println();
  delay(1000);
}

[/codesyntax]

 

Testing

Open the serial monitor and you should something like this

Temp *C = 22.30
Hum. % = 37.98

Temp *C = 22.32
Hum. % = 37.95

Temp *C = 22.31
Hum. % = 37.95

Temp *C = 22.32
Hum. % = 37.86

Temp *C = 23.30
Hum. % = 39.19

 

Links

1PCS/LOT SHT31 Temperature & SHT31-D Humidity Sensor module Breakout Weather for Arduino

This div height required for enabling the sticky sidebar
Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views :