Objective:

HTU21D is a temperature/humidity sensor with IIC port, voltage 3.3V. In this project, we will use Arduino to get temperature/humidity data from this sensor and display the values to serial terminal.

Parts and Devices:

Arduino UNO R3 x 1

USB cable x 1

Breadboard and jumper wires

HTU21D sensor module

10k ohm Resistor x 1

Circuit Graph:

HTU21D_bb

Sample code:

#include

#define HTDU21D_ADDRESS 0x40  //Unshifted 7-bit I2C address for the sensor

#define TRIGGER_TEMP_MEASURE_HOLD  0xE3
#define TRIGGER_HUMD_MEASURE_HOLD  0xE5
#define TRIGGER_TEMP_MEASURE_NOHOLD  0xF3
#define TRIGGER_HUMD_MEASURE_NOHOLD  0xF5
#define WRITE_USER_REG  0xE6
#define READ_USER_REG  0xE7
#define SOFT_RESET  0xFE

byte sensorStatus;

void setup()
{
Serial.begin(9600);
Serial.print