Home » SHT40 Sensor and Arduino Uno

SHT40 Sensor and Arduino Uno

by arduinoguy71

In this article we look at the SHT40 humidity sensor from Sensirion.

Parts Required

You can connect to the sensor using dupont style jumper wire.

This should work with other Arduino boards – I have tried a Mega and Nano for example

Name   Link
Arduino Uno
Connecting cables



I used 3.3v from the Arduino Uno – 5v should be ok if the module has an onboard regulator. You will need to check.

Code Example

This example uses a couple of libraries, both of which can be installed using the library manager

You need the Adafruit library for the SHT40 – https://github.com/adafruit/Adafruit_SHT4X

You also need an I2C support library from the same folks for the library above to work and that is available from – https://github.com/adafruit/Adafruit_BusIO


include "Adafruit_SHT4x.h"

Adafruit_SHT4x sht4 = Adafruit_SHT4x();

void setup() 

  while (!Serial)
    delay(10);     // will pause Zero, Leonardo, etc until serial console opens

  Serial.println("Adafruit SHT4x test");
  if (! sht4.begin()) 
    Serial.println("Couldn't find SHT4x");
    while (1) delay(1);
  Serial.println("Found SHT4x sensor");
  Serial.print("Serial number 0x");
  Serial.println(sht4.readSerial(), HEX);

  // You can have 3 different precisions, higher precision takes longer

  // You can have 6 different heater settings

void loop() 
  sensors_event_t humidity, temp;
  uint32_t timestamp = millis();
  sht4.getEvent(&humidity, &temp);// populate temp and humidity objects with fresh data
  timestamp = millis() - timestamp;

  Serial.print("Temperature: "); 
  Serial.println(" degrees C");
  Serial.print("Humidity: "); 
  Serial.println("% rH");

  Serial.print("Read duration (ms): ");



Serial Monitor Output

Adafruit SHT4x test
Found SHT4x sensor
Serial number 0x1044FA2B
Temperature: 18.84 degrees C
Humidity: 39.21% rH
Read duration (ms): 11






You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.