ESP32 SHT40 Temperature and Humidity Sensor

SHT40 Temperature and Humidity Sensor image

SHT40

Protocol: I2C

Overview

The SHT40 is a high-accuracy digital temperature and humidity sensor with a compact design and low power consumption. Its I²C interface and wide operating voltage range make it ideal for various environmental monitoring applications.

About SHT40 Temperature and Humidity Sensor

The SHT40, part of Sensirion’s 4th-generation sensor platform, delivers high-accuracy temperature and humidity measurements with exceptional stability. Its compact design and low operating voltage make it ideal for HVAC systems, data loggers, and environmental monitoring.

Key Features

  • Superior Accuracy – ±1.8% RH (humidity) and ±0.2°C (temperature).
  • Low Power & Wide Voltage Range – Operates from 1.08V to 3.6V, ideal for battery-powered devices.
  • I²C Communication – Simple integration with ESP32, Arduino, and embedded systems.
  • Compact & Reliable – Designed for long-term environmental sensing applications.

With its high precision and energy efficiency, the SHT40 is an excellent choice for next-generation climate monitoring solutions. 🚀

Technical Specifications

Interface I²C
Operating Voltage 1.08V to 3.6V
Temperature Range -40°C to +125°C
Temperature Accuracy ±0.2°C
Humidity Range 0% to 100% RH
Humidity Accuracy ±1.8% RH
Resolution 16-bit
Power Consumption 0.4 µA (at 1 Hz measurement rate)
Response Time Temperature: 2s (τ63%); Humidity: 4s (τ63%)
Dimensions 1.5mm x 1.5mm x 0.5mm

Pinout Configuration

The VCC pin is used to supply power to the sensor, and it typically requires 3.3V or 5V (refer to the datasheet for specific voltage requirements). The GND pin is the ground connection and must be connected to the ground of your ESP32.

The SHT40 sensor has the following pins: VDD: Power supply (1.08V to 3.6V). GND: Ground. SDA: Serial Data line for I²C communication. SCL: Serial Clock line for I²C communication.

Wiring with ESP32

To connect the SHT40 sensor to an ESP32: VDD: Connect to 3.3V on the ESP32. GND: Connect to GND on the ESP32. SDA: Connect to GPIO21 (default SDA). SCL: Connect to GPIO22 (default SCL). Note: Ensure that appropriate pull-up resistors (typically 10kΩ) are present on the SDA and SCL lines if not already included on the sensor module.

Troubleshooting Guide

Common Issues

❌ Sensor Initialization Failure

⚠️ Incorrect Temperature or Humidity Readings

🔄 Intermittent I²C Communication

Debugging Tips

🔍 Serial Monitor

⚡ Voltage Checks

Code Examples

Arduino Example

C++
🔧

ESP-IDF Example

C++
🏠

ESPHome Example

YAML
🛠️

PlatformIO Example

C++

Conclusion

The ESP32 SHT40 Temperature and Humidity Sensor is a powerful environment sensor that offers excellent performance and reliability. With support for multiple development platforms including Arduino, ESP-IDF, ESPHome, PlatformIO, and MicroPython, it's a versatile choice for your IoT projects.

For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.

Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.