In this article we connect a SHT20 sensor to a LinkIt one and the example is written in the Arduino IDE
The SHT2x series consists of a low-cost version with the SHT20 humidity sensor. the SHT2x provides calibrated, linearized sensor signals in digital, I2C format. The SHT2x humidity sensor series contains a capacitive-type humidity sensor, a band-gap temperature sensor, and specialized analog and digital integrated circuits – all on a single CMOSens® chip. This yields superior sensor performance in terms of accuracy and stability as well as minimal power consumption.
Every sensor is individually calibrated and tested. Furthermore, the resolution of the SHT2x humidity sensor can be changed on command (8/12 bit up to 12/14 bit for RH/T) and a checksum helps to improve communication reliability.
Parts List
Amount | Part Type | |
---|---|---|
1 | Temperature and humidity detection sensor module SHT20 | |
1 | LinkIt ONE MT2502A wireless 2503 development board |
Schematics/Layout
I couldn’t find an SH20 for fritzing but its an I2C device and it requires 3.3v and gnd as well
Test Code
Again we use a library – https://github.com/DFRobot/DFRobot_SHT20
[codesyntax lang=”cpp”]
#include <Wire.h> #include "DFRobot_SHT20.h" DFRobot_SHT20 sht20; void setup() { Serial.begin(9600); Serial.println("SHT20 Example!"); sht20.initSHT20(); // Init SHT20 Sensor delay(100); sht20.checkSHT20(); // Check SHT20 Sensor } void loop() { float humd = sht20.readHumidity(); // Read Humidity float temp = sht20.readTemperature(); // Read Temperature Serial.print("Time:"); Serial.print(millis()); Serial.print(" Temperature:"); Serial.print(temp, 1); Serial.print("C"); Serial.print(" Humidity:"); Serial.print(humd, 1); Serial.print("%"); Serial.println(); delay(1000); }
[/codesyntax]
Test Output
Open the serial monitor – this is what I saw
SHT20 Example!
End of battery: no
Heater enabled: no
Disable OTP reload: yes
Temperature:30.4C Humidity:999.0%
Temperature:30.6C Humidity:49.0%
Temperature:30.8C Humidity:49.1%
Temperature:30.8C Humidity:49.3%
Temperature:30.8C Humidity:49.3%
Temperature:30.8C Humidity:49.3%
Temperature:30.8C Humidity:49.3%
Links
Sensirion_Humidity_Sensors_SHT20_Datasheet.pdf