In this project, you will make a compact digital device that:
Measures room temperature (Β°C)
- Measures room temperature (Β°C)
Measures humidity (%)
- Measures humidity (%)
Displays values clearly on an OLED screen
- Displays values clearly on an OLED screen
Updates readings automatically every few seconds
- Updates readings automatically every few seconds
This project is ideal for:
Home room monitoring
- Home room monitoring
Electronics beginners
- Electronics beginners
School & college projects
- School & college projects
DIY & STEM learning
- DIY & STEM learning
Arduino Uno / Nano
- Arduino Uno / Nano
DHT11 Temperature & Humidity Sensor
- DHT11 Temperature & Humidity Sensor
0.96" OLED Display (SSD1306, I2C)
- 0.96" OLED Display (SSD1306, I2C)
Jumper wires
- Jumper wires
Breadboard
- Breadboard
USB cable
- USB cable
Computer with Arduino IDE
- Computer with Arduino IDE
USB cable
- USB cable
Discover Easy, Affordable, and Reliable PCB manufacturing with JLCPCB!Register to get $70 New customer coupons:https://jlcpcb.com/?from=EST Special Deal: Get a $30 coupon for JLCPCB premium 6-layer PCBs: https://jlcpcb.com/6-layer-pcb?from=getcoupon
π Power ConnectionsArduino provides 5V power to both OLED and DHT sensor
- Arduino provides 5V power to both OLED and DHT sensor
All GND pins must be connected together
- All GND pins must be connected together
The OLED display shows temperature and humidity data.
Connections:
VCC β 5V
- VCC β 5V
GND β GND
- GND β GND
SDA β SDA (A4 on Uno/Nano)
- SDA β SDA (A4 on Uno/Nano)
SCL β SCL (A5 on Uno/Nano)
- SCL β SCL (A5 on Uno/Nano)
Why I2C OLED?
Uses only 2 data wires
- Uses only 2 data wires
Saves Arduino pins
- Saves Arduino pins
Fast communication
- Fast communication
The DHT sensor measures temperature and humidity digitally.
Connections:
VCC β 5V
- VCC β 5V
GND β GND
- GND β GND
DATA β Digital Pin D2
- DATA β Digital Pin D2
The sensor internally sends calibrated digital data, so no ADC conversion is needed.
Step 5: Install Required LibrariesOpen Arduino IDE β Library Manager and install:
Adafruit GFX Library
- Adafruit GFX Library
Adafruit SSD1306 Library
- Adafruit SSD1306 Library
Adafruit Unified Sensor
- Adafruit Unified Sensor
DHT Sensor Library
- DHT Sensor Library
These libraries simplify OLED graphics and DHT sensor communication.
Step 6: Upload the Arduino CodeConnect Arduino to PC
- Connect Arduino to PC
Select correct Board and COM Port
- Select correct Board and COM Port
Upload the provided code
- Upload the provided code
OLED screen should turn ON after upload
- OLED screen should turn ON after upload
The code starts by including required libraries for I2C, OLED graphics, and the DHT sensor.
Wire.h β I2C communication
Wire.hβ I2C communication
Adafruit_GFX.h β Graphics functions
Adafruit_GFX.hβ Graphics functions
Adafruit_SSD1306.h β OLED driver
Adafruit_SSD1306.hβ OLED driver
Adafruit_Sensor.h β Unified sensor support
Adafruit_Sensor.hβ Unified sensor support
DHT.h β DHT sensor handling
DHT.hβ DHT sensor handling
The OLED resolution is defined as 128Γ64 pixels. An OLED object is created using I2C communication with address 0x3C.
π‘οΈ DHT Sensor SetupDHT sensor data pin is connected to digital pin 2
- DHT sensor data pin is connected to digital pin 2
Sensor type is defined as DHT11
- Sensor type is defined as DHT11
dht.begin() initializes the sensor
dht.begin()initializes the sensor
Inside setup():
Serial communication starts for debugging
- Serial communication starts for debugging
DHT sensor initializes
- DHT sensor initializes
OLED display initializes
- OLED display initializes
Display is cleared and text color set to WHITE
- Display is cleared and text color set to WHITE
If OLED initialization fails, the program stops to prevent errors.
π loop() Function LogicProgram waits 5 seconds between readings
- Program waits 5 seconds between readings
Reads temperature and humidity values
- Reads temperature and humidity values
Checks for sensor reading errors
- Checks for sensor reading errors
Clears the OLED display
- Clears the OLED display
Prints temperature in Β°C
- Prints temperature in Β°C
Prints humidity in percentage (%)
- Prints humidity in percentage (%)
Refreshes the OLED display
- Refreshes the OLED display
This loop runs continuously, updating data in real time.
π₯ Video ReferenceDiscover Easy, Affordable, and Reliable PCB manufacturing with JLCPCB!Register to get $70 New customer coupons:https://jlcpcb.com/?from=EST Special Deal: Get a $30 coupon for JLCPCB premium 6-layer PCBs: https://jlcpcb.com/6-layer-pcb?from=getcoupon
Step 8: Testing the DeviceOnce powered:
OLED shows Temperature and Humidity values
- OLED shows Temperature and Humidity values
Values change based on room conditions
- Values change based on room conditions
Readings update every 5 seconds
- Readings update every 5 seconds
If values show NaN:
Check DHT wiring
- Check DHT wiring
Check correct DHT type selected in code
- Check correct DHT type selected in code
You now have a working Room Temperature & Humidity Monitor π
Clear OLED display
- Clear OLED display
Accurate readings
- Accurate readings
Compact design
- Compact design
π‘οΈ Use DHT22 for better accuracy
- π‘οΈ Use DHT22 for better accuracy
π Add min/max temperature memory
- π Add min/max temperature memory
π Add buzzer for alert
- π Add buzzer for alert
π Add battery power
- π Add battery power
πΆ Add WiFi (ESP8266 / ESP32)
- πΆ Add WiFi (ESP8266 / ESP32)
This project demonstrates how to combine sensors and displays with Arduino to create a practical monitoring device. Itβs simple, educational, and easily expandable.
Perfect for beginners and makers who want to learn real-world Arduino applications.








Comments