Arduino - DHT11 - OLED
In this tutorial, we are going to learn how to read the temperature and humidity from DHT11 module and display it on an OLED.
Hardware Required
Or you can buy the following kits:
| 1 | × | DIYables STEM V3 Starter Kit (Arduino included) | |
| 1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some links direct to products from our own brand, DIYables .
About OLED display, DHT11 Temperature Humidity Sensor
If you do not know about OLED display, and DHT11 temperature humidity sensor (pinout, how it works, how to program ...), learn about them in the following tutorials:
- Arduino - OLED tutorial
- Arduino - DHT11 tutorial
Wiring Diagram

This image is created using Fritzing. Click to enlarge image
Want a stronger connection than jumper wires? In this case, use a Proto Screw Terminal Block Shield or a Screw Shield V2. It plugs into the Arduino and gives each pin a screw terminal. The diagram below shows the same wiring with the Screw Shield V2.

This image is created using Fritzing. Click to enlarge image
Arduino Code - DHT11 Sensor - OLED
Quick Steps
- Open Arduino IDE on your PC.
- Navigate to the Libraries icon on the left bar of the Arduino IDE.
- Search “SSD1306”, then find the SSD1306 library by Adafruit
- Click Install button to install the library.

- You will be asked for intalling some other library dependencies
- Click Install All button to install all library dependencies.

- Search “DHT”, then find the DHT sensor library by Adafruit
- Click Install button to install the library.

- You will be asked for intalling some other library dependencies
- Click Install All button all library dependencies.

- Copy the above code and open with Arduino IDE
- Click Upload button on Arduino IDE to upload code to Arduino
- Put the sensor on hot and cold water, or grasp the sensor by your hand
- See the result on OLED and Serial Monitor
※ NOTE THAT:
The about code automatically horizontal and vertical center aligns the text on OLED display
Video Tutorial
We are considering to make the video tutorials. If you think the video tutorials are essential, please subscribe to our YouTube channel to give us motivation for making the videos.