Skip to content

ESP8266 Driver for Measurement Specialties HTU21D i2c Temperature and Relative Humidity Sensor

Notifications You must be signed in to change notification settings

MetalPhreak/ESP8266_HTU21D

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ESP8266 HTU21D Driver

Driver Library for the Measurement Specialties HTU21D temperature & humidity sensor.

The HTU21D is an i2c device with a temperature sensing element (capable of 14bit resolution or 0.01 degC) and a relative humidity sensing element (capable of 12bit resolution or 0.04%RH).

Sensirion SHT21 appears to be code compatible, but is currently untested.

Usage

In user_init call:

i2c_init();

To read temperature run HTU21D_temperature(&temperature); where temperature is an existing float variable.

To read humidity run HTU21D_humidity(&humidity); where humidity is an existing float variable.

Both functions return integer 1 on success, or integer 0 on failure.

See Example_user_main.c for typical usage. Actual usage is shown within IdleTask function.

Note: ftos() function is provided to convert a float into a text string for use with os_printf

See i2c.h to set the GPIO pins for i2c. Default is SCK = GPIO0, SDA = GPIO2. (you may need to change this depending on your board configuration)

About

ESP8266 Driver for Measurement Specialties HTU21D i2c Temperature and Relative Humidity Sensor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published