Skip to main content

Measuring Temperature with an Arduino

·2 mins

At home, I need a way to measure temperature and humidity over a long time, say 3 to 4 weeks and display the measurements in a graph. Let’s start with measuring the temperature only and displaying it in the serial monitor of the Arduino.

This post is going to be a quick one. There are already so many tutorials on this topic out there that are more detailed, it does not really require yet another one. Just documenting it for my own reference.

Since I have an Arduino with a bunch of sensors around there was not much to think about. Just needed to do some research on what sensor to use.

I have the Allnet Sensor Kit that has a couple of different temperature sensors.

In the end I have used the DHT11 because it is so easy to use. No calibration necessary, just plug it in and read the final values from it. There are more elaborate versions, like the DHT22 for example. Here is a brief comparison.

So, here is the breadboard view. This time I have used the Arduino Nano.

Fritzing

The real setup.

Real Setup

The sensor that I have comes with the pull-up resistor already, therefore wiring is a bit different. From left to right: Data, Voltage, Ground.

DHT11

Let’s do the software part now. There is not much to code to do a first test of the sensor. The code even comes with the Arduino IDE as far as I remember. Open the code File -> Examples -> DHT sensor library -> DHTtester and only provide the right PIN of our Arduino that receives the data (line 6) and the right DHT model (lines 9-11).

Screenshot Arduino IDE

Finally the output. Every second another measurement will be taken and displayed.

Screenshot Serial Monitor

Now, I want to transmit the data wirelessly to a web service. Not sure if I am using a WiFi module or the 433 MHz sender and receiver [I have blogged about earlier]({% post_url 2015-12-08-hello-world-on-433mhz %}).

UPDATE 2016-04-21: Use a ESP8266 as described in [this post]({% post_url 2016-04-21-measuring-temperature-with-an-esp8266 %}).

Done for today!