Monitoring temperature and humidity is important for many DIY electronics and IoT projects. Whether you're building a smart greenhouse, weather station, or room climate monitor, the DHT11 sensor is a simple and affordable solution. In this article, we’ll show you how to use the DHT11 sensor with an SSD1306 OLED display and an Arduino to visually display real-time environmental data.
What is the DHT11 Sensor?The DHT11 is a basic, low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air and provides the data via a digital signal. While it's not the most accurate sensor available, it is sufficient for small hobby projects.
Features of DHT11:
Temperature range: 0–50°C
- Temperature range: 0–50°C
Humidity range: 20–90% RH
- Humidity range: 20–90% RH
Accuracy: ±2°C and ±5% RH
- Accuracy: ±2°C and ±5% RH
Operating voltage: 3.3V to 5V
- Operating voltage: 3.3V to 5V
The SSD1306 is a monochrome OLED display module with a resolution of 128x64 pixels. It communicates via I²C, which requires only two pins (SDA and SCL), making it perfect for small Arduino projects with limited I/O pins.
Features of SSD1306 OLED:
0.96-inch screen
- 0.96-inch screen
I²C interface (SDA, SCL)
- I²C interface (SDA, SCL)
Low power consumption
- Low power consumption
Clear, sharp text and graphics display
- Clear, sharp text and graphics display
To complete this project, you’ll need:
Arduino UNO (or compatible board)
- Arduino UNO (or compatible board)
DHT11 temperature & humidity sensor
- DHT11 temperature & humidity sensor
SSD1306 OLED display (0.96", I²C)
- SSD1306 OLED display (0.96", I²C)
Jumper wires
- Jumper wires
Breadboard
- Breadboard
USB cable for programming
- USB cable for programming
Connect the components as follows:
DHT11 Sensor:
VCC → 5V
- VCC → 5V
GND → GND
- GND → GND
DATA → Digital Pin 2
- DATA → Digital Pin 2
- DHT11 Sensor:VCC → 5VGND → GNDDATA → Digital Pin 2
SSD1306 OLED:
VCC → 3.3V or 5V (depending on module)
- VCC → 3.3V or 5V (depending on module)
GND → GND
- GND → GND
SDA → A4 (on UNO)
- SDA → A4 (on UNO)
SCL → A5 (on UNO)
- SCL → A5 (on UNO)
- SSD1306 OLED:VCC → 3.3V or 5V (depending on module)GND → GNDSDA → A4 (on UNO)SCL → A5 (on UNO)
To make the project work, you’ll need to install two Arduino libraries:
Adafruit_SSD1306 (for OLED display)
- Adafruit_SSD1306 (for OLED display)
DHT sensor library by Adafruit (for DHT11)
- DHT sensor library by Adafruit (for DHT11)
The code initializes both the sensor and the display, continuously reads the temperature and humidity, and displays the values on the OLED screen. The data updates every second, providing real-time environmental readings.
The OLED screen is divided into sections to clearly show:
Temperature (in °C)
- Temperature (in °C)
Humidity (in %)
- Humidity (in %)
This project is ideal for:
Home climate monitoring
- Home climate monitoring
Smart agriculture
- Smart agriculture
Indoor air quality systems
- Indoor air quality systems
DIY weather stations
- DIY weather stations
IoT-based monitoring systems
- IoT-based monitoring systems
Using a DHT11 sensor with an SSD1306 OLED and Arduino is an excellent way to start building simple and useful environment monitoring devices. The sensor offers basic accuracy, while the OLED gives your project a polished, user-friendly look. This setup is easy to build, affordable, and flexible enough to be expanded into more advanced IoT applications.
Comments