In this article we look at another digital humidity sensor – this time its the SHTC1 and we will connect it to our ESP32 board
We will have the usual information on the sensor, parts required, connection and code example
This is the sensor purchased for this project
SHTC1 Information
The SHTC1 is a digital humidity sensor designed especially for high-volume consumer electronics applications. This humidity sensor is strictly designed to overcome conventional limits for size, power consumption, and price-performance ratio, in order to fulfill the current and future requirements of the consumer electronics market.
Sensirion’s CMOSens® technology offers a complete sensor system on a single chip, consisting of a capacitive humidity sensor, a band-gap temperature sensor, analog and digital signal processing, A/D converter, calibration data memory, and a digital communication interface supporting I2C fast mode.
The ultra-small, 2 × 2 × 0.75 mm3 DFN package enables applications to be placed in even the most limited of spaces. The sensor covers a humidity measurement range of 0 to 100 %RH and a temperature measurement range of –30°C to 100°C with a typical accuracy of ±3 %RH and ±0.3°C.
The operating voltage of 1.8 V and an energy budget below 1 µJ per measurement make the SHTC1 suitable for mobile or wireless applications running on the lowest power budgets.
With the industry-proven quality and reliability of Sensirion’s humidity sensors and constant accuracy over a large measurement range, the SHTC1 humidity sensor offers an unprecedented price-performance ratio.
Tape and reel packaging together with suitability for standard SMD assembly processes make the SHTC1 predestined for high-volume applications.
SHTC1 Features
Interface | I²C |
Supply voltage | 1.8 V |
Power consumption | 2µW (at 1 reading per second in low power mode) |
Measuring range (RH) | 0 – 100% relative humidity |
Measuring range (T) | -30 to +100°C (-22 to +212°F) |
Response time (RH) | 8s (tau63%) |
Parts Required
Name | Link | |
ESP32 | ||
SHTC1 | ||
Connecting cables |
Schematic/Connection
ESP32 | Sensor |
3v3 | Vcc |
Gnd | Gnd |
SDA | SDA |
SCL | SCL |
Code Example
This uses the library from https://github.com/Sensirion/arduino-sht
#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); }
Output
Open the serial monitor and you should see something like this
Links