Home CodeArduino Due Arduino Due and SHT20 sensor

Arduino Due and SHT20 sensor

by shedboy71

In this article we connect an SHT20 sensor to an Arduino Due

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.

Performance

  • Size: 3 x 3 x 1.1mm
  • Output: I²C digital, PWM, SDM
  • Supply voltage range: 2.1 to 3.6V
  • Energy consumption:  3.2µW (at 8 bit, 1 measurement/s)
  • RH operating range: 0 – 100%RH
  • T operating range:  -40°C to +125°C (-40°F to +257°F)
  • RH response time: 8 sec (tau63%)

Parts List

 

Amount Part Type
1 Temperature and humidity detection sensor module SHT20
1 Compatible DUE R3 Board SAM3X8E 32-bit ARM Cortex-M3

 

Schematics/Layout

 

arduino due and SHT20 layout

arduino due and SHT20 layout

 

Code

We use the following 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]

 

Output

Open the serial monitor – this is what I saw

SHT20 Example!
End of battery: no
Heater enabled: no
Disable OTP reload: yes
Time:202 Temperature:18.8C Humidity:64.3%
Time:1302 Temperature:18.8C Humidity:64.3%
Time:2402 Temperature:18.8C Humidity:64.2%
Time:3502 Temperature:20.2C Humidity:64.4%
Time:4602 Temperature:23.3C Humidity:67.4%
Time:5702 Temperature:24.7C Humidity:72.2%
Time:6802 Temperature:25.5C Humidity:75.0%
Time:7902 Temperature:26.1C Humidity:76.2%
Time:9002 Temperature:26.7C Humidity:76.7%

 

Links

Sensirion_Humidity_Sensors_SHT20_Datasheet.pdf

 

Share

You may also like