SHT20 temperature and humidity sensor and micro:bit

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 BBC micro:bit bulk micro-controller with motion detection, compass, LED display and Bluetooth

 

Schematics/Layout

I couldnt find an exact part in fritzing

microbit and SHT20
microbit and SHT20

Code

Again we use a library – https://github.com/DFRobot/DFRobot_SHT20

#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);
}

 

Output

Open the serial monitor – this is what I saw

Time:136805 Temperature:22.2C Humidity:46.7%
Time:137953 Temperature:23.1C Humidity:46.8%
Time:139101 Temperature:24.5C Humidity:51.7%
Time:140249 Temperature:25.2C Humidity:58.0%
Time:141397 Temperature:25.5C Humidity:62.6%
Time:142545 Temperature:25.8C Humidity:65.6%
Time:143693 Temperature:26.0C Humidity:67.6%
Time:144841 Temperature:26.1C Humidity:69.0%

 

Links

Sensirion_Humidity_Sensors_SHT20_Datasheet.pdf