Sensirion SHTxx Application Note Sample Code

This is an application note for SHTxx humidity and temperature sensors. It provides C code examples for reading humidity or temperature, calculating relative humidity linearization and temperature compensation, accessing status register, calculating dew point temperature, etc.


Sensirion SHTxx Application Note Sample Code - cover page
Brand
SHTxx
Category
Other Electronics
Document type
Application Note
Language
English
Pages
4
File format
PDF
File size
173 KB
Published
11 April, 2012
Updated
01 October, 2023
MD5 checksum
A38237DCDD1E0F52BB20E6594BA406A8

About this manual

The document presents an example application note that includes C source code for interfacing the SHTxx humidity and temperature sensor. It covers basic readout, linearization, temperature compensation, status register access, and dew‑point calculation, along with UART handling for data output.

The sample program demonstrates a full measurement cycle: resetting the sensor, acquiring raw humidity and temperature ticks, converting them to physical units, computing compensated humidity and dew point, and printing the results. The code is written for the 80C51 family using the Keil compiler.

What's inside

  • Introduction
  • Sample Code
  • Processor
  • Sensor Reset
  • Status Register Access
  • Humidity Measurement
  • Temperature Measurement
  • Dew Point Calculation
  • UART Output

Specifications

Humidity measurement resolution12‑bit
Temperature measurement resolution14‑bit

Frequently asked questions

How do you reset the SHTxx sensor in the sample code?

Call the function s_connectionreset(), which sends a reset command to the sensor.

How is dew point calculated from humidity and temperature?

Use the function calc_dewpoint(h, t) which applies the formula shown in the code to compute dew point in °C.

Which microcontroller family is used for the example program?

The code targets the 80C51 family of microcontrollers.

Download PDF (173 KB)