HTU21D - Temperature and Humidity Sensor

/media/uploads/alipford3/temp._and_hum._sensor.png

The HTU21D is a highly accurate, digital humidity and temperature sensor with an I2C interface. The breakout board includes built in 4.7k pull up resistors. Under references, you can find links to the sensor’s schematic, data sheet and where to purchase it.

/media/uploads/alipford3/temp._and_hum._wire_chart.png

/media/uploads/alipford3/img_20141019_145322253.jpg

Hello World!

Import programHTU21D_HELLOWORLD

A sample program to read the temperature and humidity from the HTU21D sensor.

/media/uploads/alipford3/temp_and_humid.png

Library

Import libraryHTU21D

An updated, basic library to interface with the HTU21D digital temperature and humidity sensor

API

HTU21D(PinName sda, PinName scl)

Constructor function, declares sensor

int sample_ctemp(void)

Samples the temperature, inputs void, outputs an int in Celsius

int sample_ftemp(void)

Samples the temperature, inputs void, outputs an int in Fahrenheit

int sample_ktemp(void)

Samples the temperature, inputs void, outputs an int in Kelvin

int sample_humid(void)

Samples the temperature, inputs void, outputs an int

Reference

Link to the HTU21D schematic: http://dlnmh9ip6v2uc.cloudfront.net/datasheets/BreakoutBoards/HTU21D%20Breakout.pdf

Link to the HTU21D Data Sheet: http://dlnmh9ip6v2uc.cloudfront.net/datasheets/BreakoutBoards/HTU21D.pdf

Link to purchase the sensor: https://www.sparkfun.com/products/12064


Please log in to post comments.