# DIY - Temperature and Humidity

So that we can see the weather report daily on the Internet, on television, in the newspaper or in apps, not only satellite data are evaluated. Also data from weather stations on the ground play an important role in the prediction. But how does the measurement and display of temperature and humidity values work?

## Destinations of the Station

In this station we are dealing with the temperature and humidity sensor of the senseBox, the HDC1080.

## Materials

• combined temperature and humidity sensor HDC1080

## Basics

HDC1080 Sensor

The HDC1080, from the Texas Instruments HDX10XX series, is a combined temperature and humidity sensor. The sensor can measure the humidity from 0% to 100%, as well as the temperature from -40 ° C to 125 ° C with an accuracy of ± 2% or ± 0.2 ° C.

I²C Bus

The communication of the sensor with the microcontroller runs over the I²C Bus. Unlike simple digital or analog inputs, multiple I²C devices (such as sensors or displays) can be connected in parallel to the data bus. Each device has a unique identifier so that the data bus can assign each one of them and address them separately.

## Construction

Plug in the circuit as you see it in the graphic below.

## Programming

Make sure you have the latest board support package installed because you need the correct software libraries. How to do that was explained to you in step 2 !

First, an instance of the sensor must be created.

#include "SenseBoxMCU.h"
HDC1080 hdc;


setup()-function

In the setup()-function the sensor should now be started:

void setup(){
hdc.begin();
}


loop()-function

After initializing the sensor as described above, you can use two commands in the loop ()-function to output a temperature or humidity

void loop(){
hdc.getHumidity();
hdc.getTemperature();
}

When storing the measured values, the variables should have the same data type as the return values of the measuring functions. In our case these are both float values.!