This is Sensiron high reliable tested and proven stable temperature and humidity sensor. The SHT is fully calibrated and provide a digital and analog output with an advance series of digital humidity and temperature sensor design for long term stability and high end applications such as mobile, navigation system, environmental, automotive, industrial and home automations.
The SHT3X
The SHT3X is a newly launch next generation of temperature and humidity sensor from Sensirions, designed in a new CMOSense core. The SHT3X has added a new intelligence platform for reliability and improved the sensing accuracy specification compared to its predecessor. The functionality includes enhance signal processing, 2 distinctive and user selectable i2C address with the communication speed of up to 1 MHz. This device driven on 2.4v to 5.5v guarantees compatibility on a assembly situations. For more reading and address selection please refer to the datasheet below.
The SHTCX
The SHTC1 is designed to overcome the limit of size, power consumption, and performance. The Sensirions’s CMOSense technology offers a complete sensor system on a single chip consisting of a capacitive humidity sensor, a bandgap temperature sensor, analog and digital signal processing A/D converter, calibration data memory and a digital communication interface that communicate with fast mode i2C protocol. This sensor convers humidity measurement range of 0 to 100% RH and a temperature measurement’s range of -30 degree Celsius to 100 degree Celsius with accuracy of +- 0.3 degree Celsius. This device is runs on 1.8v and energy budget below 1 μJ per measurement make that make this device suitable for mobile or wireless applications running on a tightest power consumption. . For more reading please refer to the datasheet below.
The SHWTX
This device is flip chip package digital humidity and temperature sensor. This type of package is ultra-small sensor which are suitable for application with the tightest space constraints with impressive pure simplicity. This sensor is based on Sensirion’s CMOSense technology that offers a complete system on a single chip consisting a capacitive humidity sensor, bandgap temperature sensor, analog and digital signal processing, Analog to Digital converter, calibration data memory and i2c data communication protocol interface at fast mode. For more reading please refer to the datasheet below.
Required Components
- Arduino IDE | Atmel Studio | STM32CubeMX | Energia
- Microcontroller – Arduino, NodeMCU, Teensy Board, TeensyDuino, ESP8266 12, 12E, ESP32, LinkItOne, ESP8266 NodeMCU, ESPDuino, ATMEGA328 16/12, ATMEGA32u4 16/8/ MHz, ESP8266, MSP430 ,ATMEGA250 16 MHz, ATSAM3x8E, ATSAM21D, ATTINY85 16/8 MHz, STM32 Nucleo, Discovery kits and Evaluation boards Note: The Diagram below is using NANO. (please refer to each MCU’s respective pin-outs & bus configurations)
- Sensirion SHW, SHT-X, SHT3X Chip / Module
- Capacitors (See below required values)
- Resistors (See below required values)
- Jumper Wire (Optional)
- Prototyping Board
- HTSSOP / WQFN Sockets /
- PCB board (Circuit simulation to PCB Layout)
SHT3X Wiring Guide
SHTC Wiring Guide
SHWT2 Wiring Guide
Source Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
#include <Wire.h> #include <SHTSensor.h> <span class="crayon-p">//This Library can be found below</span> SHTSensor SHTSENSE; void setup() { Serial.begin(9600); Serial.println("14CORE | Temperature & Humidity Test Code"); delay(1000); Serial.println("Initializing.............."); Delay(4000); Wire.begin(); delay(100); SHTSENSE.init(); } void loop() { SHTSENSE.readSample(); Serial.print("SHT:\n"); Serial.print(" RH: "); Serial.print(SHTSENSE.getHumidity(), 2); Serial.print("\n"); Serial.print(" T: "); Serial.print(SHTSENSE.getTemperature(), 2); Serial.print("\n"); delay(1000); } |
Analog SHT3X
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#include <Arduino.h> #include <Wire.h> #include "SHTSensor.h" SHT3xAnalogSensor SHTANALOG(A0, A1); void setup() { Serial.begin(9600); Serial.println("14CORE | Temperature & Humidity Test Code"); delay(1000); Serial.println("Initializing.............."); Delay(4000); Wire.begin(); } void loop() { Serial.print("SHT3X Running Analog:\n"); Serial.print(" RH: "); Serial.print(SHTANALOG.readHumidity(), 2); Serial.print("\n"); Serial.print(" T: "); Serial.print(SHTANALOG.readTemperature(), 2); Serial.print("\n"); delay(1000); } |
STM32 C Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
#include "system.h" #include "sht3.h" //This library can be downloaded below static void EvalBoardPower_Init(void); static void Led_Init(void); static void UserButton_Init(void); static void LedBlueOn (void); static void LedBlueOff(void); static void LedGreenOn(void); static void LedGreenOff(void); static u8t ReadUserButton(void); int main(void){ etError error; u32t serialNumber; regStatus status; ft temperature; ft humidity; bt heater; SystemInit(); Led_Init(); UserButton_Init(); EvalBoardPower_Init(); SHT3X_Init(0x45) // i2C Address DelayMicroSeconds(50000); error = SHT3x_ReadSerialNumber(&serialNumber); if (error != NO_ERROR){} //Error Handling error = SHT3X_GetTempAndHumi(&temperature, &humidity, REPEATAB_HIGH, MODE_CLKSTRETCH, 50); error = SHT3X_GetTempAndHumi(&temperature, &humidity, REPEATAB_HIGH, MODE_POLLING, 50); if (error != NO_ERROR){} //set to error Handling while (1) { error = NO_ERROR; while(error == NO_ERROR) { error |=SHT3X_ReadStatus(&status.u16); if (error != NO_ERROR) break; if (status.bit.ResetDetected) { error = SHT3X_SetAlertLimits(70.0f, 50.0f, 68.0f, 48.0f, 32.0f, -2.0f, 30.0f, -4.0f); if (error != NO_ERROR) break; error = SHT3X_ClearAllAlertFlags(); if (error != NO_ERROR) break; error = SHT3X_StartPeriodicMeasurement(REPEATAB_HIGH, FREQUENCY_1HZ); if (error != NO_ERROR) break; LedGreenOn(); } error = SHT3X_ReadMeasurementBuffer(&temperature, &humidity); if (error == NO_ERROR) { LedBlueOn(); DelayMicroSeconds(10000); LedBlueOff(); } else if (error == ACK_ERROR){ error = NO_ERROR; } else break; heater = status.bit.HeaterStatus ? TRUE : FALSE; if (ReadUserButton() == 0){ if (heater) { error |= SHT3X_DisableHeater(); if (error != NO_ERROR) break; } } else { if (!heater){ error |= SHT3X_EnableHeater(); if (error != NO_ERROR0) break; } } DelayMicroSeconds(10000); } LedGreenOff(); LedBlueOff(); error = SHT3X_SoftReset(); if (error != NO_ERROR){ SHT3X_HardReset(); } LedGreenOn(); DelayMicroSeconds(10000); LedGreenOff(); } } static void EvalBoardPower_Init (void){ RCC->APB2ENR |= 0x00000008; // IO Port B Clock Enable GPIOB->CRH &= 0x0FFF0FFF; //Set push pull output for VDD and GND pins GPIOB->CRH |= 0x10001000; // GPIOB->BSRR = 0x08008000; //Set VCC to HIGH and Set GND to LOW } static void Led_Init(void){ RCC-> APB2ENR |= 0x00000010; //IO port C clock enable GPIOC->CHR &= 0xFFFFFF00; //set GPIO mode for LEDS GPIOC->CHR |= 0x00000011; GPIOC->BSRR = 0x03000000; //Set LEDS Leds off } static void UserButton_Init(void){ RCC->APB2ENR |= 0x00000004; //IO port A clock enable GPIOA->CHR &= 0xfffffff0; //Set GPIO mode for User Button GPIOA->CHR |= 0x00000004; // } static void LedBlueOn (void){ GPIOC-> BSRR = 0x00000100; } static void LedBlueOff(void){ GPIOC-> BSRR = 0x10000000; } static void LedGreenOn(void){ GPIOC-> BSRR = 0x00000200; } static void LedGreenOff(void){ GPIOC-> BSRR = 0x02000000; } static u8t ReadUserButton(void){ return (GPIOA->IDR & 0x00000001); } |
Downloads
- Download SHT Arduino Code Library
- Download SHT STM32 C Code Library
- Download SHWT Datasheet
- Download SHTX Datasheet
- Download SHT3X Datasheet