You are on page 1of 6

technology workshop craft home food play outside costumes

Arduino OLED Thermometer And Hygrometer With DHT11 For Beginners


by Konstantin Dimitrov on December 9, 2015

Table of Contents

Arduino OLED Thermometer And Hygrometer With DHT11 For Beginners . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Intro: Arduino OLED Thermometer And Hygrometer With DHT11 For Beginners . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Step 1: Info about the OLED display and tech . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Step 2: Info about DHT11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Step 3: Gathering materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Step 4: Connecting the sensor and the OLED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Step 5: Upload the code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Step 6: Congrats !!! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

http://www.instructables.com/id/Arduino-OLED-Thermometer-and-Hygrometer-With-DHT11/
Author:Konstantin Dimitrov My facebook !
A dreamer who hasn't given up from the bright future.

Intro: Arduino OLED Thermometer And Hygrometer With DHT11 For Beginners
Hello ! I'm going to show you how to make an Arduino OLED thermometer and hygrometer* with DHT11.

The OLED we will use today is 1.3? inch in size, features 128×64 pixels and uses the SPI Bus. On the next step you will find more useful information about the OLED
tech and this display.

We will use the u8glib library to communicate with our display. This library has many available parameters with it you can display numbers, letters, bitmaps and other
symbols on OLEDs and graphic LCDs also it works for E-ink displays.

---------------------------

* A hygrometer /ha???r?m?t?r/ is an instrument used for measuring the moisture content in the atmosphere. - Wikipedia

Image Notes Image Notes


1. Displaying info in dark. 1. In Fahrenheit
2. Displaying info in dark
3. Displaying info in dark

Step 1: Info about the OLED display and tech


An organic light-emitting diode (OLED) is a light-emitting diode (LED) in which the emissive electroluminescent layer is a film of organic compound that emits light in
response to an electric current. This layer of organic semiconductor is situated between two electrodes; typically, at least one of these electrodes is transparent. -
Wikipedia

The one I use is produced by Waveshare. Its 1.3? inch in size, features 128×64 pixels and uses the 4-wire Serial Peripheral Interface Bus. It is monochrome blue in color
also it consumes 0.04 W of energy which is one tenth that is required to run traditional 16x2 LCD display.

The OLED could be modified (soldering required) to communicate with different Bus, like a I2C or a 3-wire SPI, by moving one of the two resistors which can be found
on the back of the display board. They are marked with 0s, check the pic above.

Changing the Bus from a 4-wire SPI to a I2C or a 3-wire SPI:

I2C - move BS1 resistor on 1 but keep BS0 on 0 as it is.

3-wire SPI - BS1 must be 0 and BS0 on 1

http://www.instructables.com/id/Arduino-OLED-Thermometer-and-Hygrometer-With-DHT11/
Image Notes
1. Move on of these to change the Bus config to I2C or 3-wire SPI.

Step 2: Info about DHT11


The DHT11 is a basic, ultra low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air,
and spits out a digital signal on the data pin (no analog input pins needed). Its fairly simple to use, but requires careful timing to grab data. The only real downside of this
sensor is you can only get new data from it once every 2 seconds, sensor readings can be up to 2 seconds old.

Features:

Small size, low cost


Easy to use 3 to 5V power and I/O
2.5mA max current use during conversion (while requesting data)
Good for 20-80% humidity readings with 5% accuracy
Good for 0-50°C temperature readings ±2°C accuracy
No more than 1 Hz sampling rate (once every second)

http://www.instructables.com/id/Arduino-OLED-Thermometer-and-Hygrometer-With-DHT11/
Step 3: Gathering materials
To make it we gonna need the following stuff:

1. Arduino UNO board or similar


2. OLED display (1.3inch; 128x64) or similar
3. DHT11 - temperature and humidity sensor
4. Breadboard
5. Jumpers x 12 - to connect everything

http://www.instructables.com/id/Arduino-OLED-Thermometer-and-Hygrometer-With-DHT11/
Step 4: Connecting the sensor and the OLED
Now take a look on the schematic above, plug in the display and the sensor into the breadboard. Then connect the negative and positive voltage pins of both DHT11
and the OLED to the ground and +5v pins of the Arduino UNO board with jumpers.

Then take one jumper and connect the output pin of the sensor to A0 of the Arduino board.

Connect the OLED pins: DIN to pin 13; CLK to pin 11; CS to pin 10; D/C to pin 9 and RES to pin 8 with the rest of the jumpers. 13, 11, 10, 9 and 8 are the SPI Bus of
Arduino UNO they are also the ICSP connector under the microcontroller.

Once you connect them you can upload the code to the board (you can do that before connecting the sensor and the display).

Step 5: Upload the code


This step is easy, just download one of the two .INO files, named Fahrenheit (measures in F) and Celsius (measures in C), and open it with the Arduino IDE then upload
the code to the Arduino board.

If you don't like the current font you can change it simply by editing the code. You can find all supported fonts here.

If you don't have Arduino IDE click here to download it. Then install it.

Libraries you will need: DHT and u8glib download the libraries and then unzip them at /Program Files(x86)/Arduino/Libraries (default).

UPDATE: NOW WITH SUPPORT FOR SSD1306 128X32 AND 128X64 WITH SPI BUS. CODE FOR DUAL COLOR OLED (1/4 YELLOW, 3/4 BLUE, SSD1306) -
DHT_DC_OLED_V1.26.16

File Downloads

http://www.instructables.com/id/Arduino-OLED-Thermometer-and-Hygrometer-With-DHT11/
DHT_OLED_Celsius_v1.3.2016.ino (1 KB)
[NOTE: When saving, if you see .tmp as the file ext, rename it to 'DHT_OLED_Celsius_v1.3.2016.ino']

DHT_OLED_Fahrenheit_v1.3.2016.ino (1 KB)
[NOTE: When saving, if you see .tmp as the file ext, rename it to 'DHT_OLED_Fahrenheit_v1.3.2016.ino']

DHT_DC_OLED_V1.26.16.ino (1 KB)
[NOTE: When saving, if you see .tmp as the file ext, rename it to 'DHT_DC_OLED_V1.26.16.ino']
Step 6: Congrats !!!
Now you have an Arduino OLED thermometer and hygrometer and you can measure the temperature in Fahrenheit or in Celsius and the moisture content of the air
anywhere you want.

Please don't forget to vote for at least one of the contests I have joined ! :) (the top right corner !)

Featured comments:

"It's a nice beginners project to get started with OLEDs and temperature sensors". - MaterialBall

"Thanks for the share, very easy to follow instructions!" - Akin Yildiz

"Outstanding!!" - kath65

Advertisements

http://www.instructables.com/id/Arduino-OLED-Thermometer-and-Hygrometer-With-DHT11/

You might also like