Interfacing G-Sense SHT45 High Accuracy Humidity & Temperature Sensor with Arduino, ESP32, and GLYPH-C3. Includes pinout, circuit diagram, and example code.
The Gsense-SHT45 is a highly accurate temperature and humidity sensor from Sensirion, designed for precise environmental monitoring in a wide range of applications. It is an upgrade over previous models such as SHT31, offering even better accuracy and lower power consumption.
HVAC Systems: HVAC systems to monitor and control temperature and humidity, ensuring comfortable indoor environments.
Weather Stations: These sensors are used in weather stations to measure temperature and humidity for weather forecasting.
Industrial Monitoring: The SHT35 is used in various industrial settings to monitor temperature and humidity, which can affect production processes and equipment performance.
Smart Agriculture:The SHT35 can be used in agriculture to monitor soil and air temperature and humidity, optimizing irrigation and crop management.
This guide will help you interface an SHT45 Temperature and Humidity sensor GLYPH-C6(but any GLYPH development board from the ESP32 Series should work)
#include <Wire.h>#include "Adafruit_SHT4x.h"#define SDA_PIN 4 // Define the SDA pin#define SCL_PIN 5 // Define the SCL pinAdafruit_SHT4x sht4 = Adafruit_SHT4x(); // Initialize the sensor objectvoid setup() { Serial.begin(115200); while (!Serial) { delay(10); // Wait for the serial connection } Serial.println("SHT45 Sensor Test"); // Initialize I2C with the custom SDA and SCL pins Wire.begin(SDA_PIN, SCL_PIN); // Initialize I2C on custom pins Wire.setClock(100000); // Set I2C clock to 100kHz for communication // Initialize the SHT45 sensor if (!sht4.begin()) { Serial.println("Couldn't find SHT45 sensor!"); while (1); // Halt here if the sensor isn't found } Serial.println("SHT45 sensor found");}void loop() { sensors_event_t humidity, temp; sht4.getEvent(&humidity, &temp); // Get temperature and humidity data // Check if the sensor is returning valid data if (isnan(temp.temperature) || isnan(humidity.relative_humidity)) { Serial.println("Failed to read sensor data!"); } else { // Print temperature and humidity with extra details Serial.print("Temperature: "); Serial.print(temp.temperature); Serial.println(" *C"); Serial.print("Humidity: "); Serial.print(humidity.relative_humidity); Serial.println(" %"); } delay(2000); // Wait for 2 seconds before next reading}
Select the Board and PortDo the following settings in your Arduino IDE,
Do the following settings in your Arduino IDE,
Tools > Board > esp32 > Pcbcupid GLYPH C6
For the Pcbcupid GLYPH C6 to appear under Tools > Board > esp32, the esp32 board version installed in the Arduino IDE should be greater than or equal to 3.1.0.
Tools > Port and select the port connected to your GLYPH.
Tools > USB CDC on Boot >Enabled
If USB CDC on BOOT not enabled, you won’t be seeing any serial data on Arduino IDE.
Upload the Code
Click the upload button (➡️ icon) or use the shortcut CTRL + U in Arduino IDE to upload the code to the board.