Temperature & Humidity Monitor Using Arduino Nano, DHT11 & 0.9" OLED Display

by Anshuman_41 in Circuits > Arduino

36 Views, 1 Favorites, 0 Comments

Temperature & Humidity Monitor Using Arduino Nano, DHT11 & 0.9" OLED Display

WhatsApp Image 2025-08-13 at 18.45.06_8b3ce90f.jpg
WhatsApp Image 2025-08-13 at 18.45.07_c61bab29.jpg
WhatsApp Image 2025-08-13 at 18.45.07_287eb91e.jpg

In this project, we will build a simple and accurate Temperature & Humidity Monitor using an Arduino Nano, a DHT11 temperature & humidity sensor, and a 0.9-inch GM009605v4.2 OLED display.

The DHT11 sensor will measure the ambient temperature and humidity, and the OLED will display the readings in real-time.

This project is perfect for beginners and can be used in weather stations, greenhouses, or home automation systems.

Supplies

WhatsApp Image 2025-08-13 at 18.45.13_5cd60eaa.jpg
WhatsApp Image 2025-08-13 at 18.45.13_0a1d59db.jpg
Screenshot 2025-08-13 190823.png

Materials Required

Arduino Nano

DHT11 Sensor

GM009605v4.2 OLED Display (0.9")

SSD1306-based I2C OLED

Breadboard

For easy connections Jumper Wires

Male-to-male

USB Cable

CIRCUIT DIAGRAM

Screenshot 2025-08-13 192736.png
Screenshot 2025-08-13 192720.png
Screenshot 2025-08-13 190845.png
Screenshot 2025-08-13 190900.png

CIRCUIT DIAGRAM

OLED Display Arduino Nano

VCC ---------- 5V

GND --------- GND

SCL ---------- A5

SDA --------- A4


DHT11 SensorArduino Nano

VCC --------- 5V

GND -------- GND

DATA -------- D2

Install Arduino IDE & Libraries


  1. Download and install Arduino IDE from arduino.cc.
  2. Open Arduino IDE, go to Sketch → Include Library → Manage Libraries.
  3. Install these libraries:
  4. Adafruit SSD1306
  5. Adafruit GFX Library
  6. DHT sensor library by Adafruit

Arduino Code


#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <DHT.h>

// --- Display setup ---
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

// --- DHT Sensor setup ---
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);

void setup() {
Serial.begin(9600);
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;);
}
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.setCursor(0, 0);
display.println(F("Initializing..."));
display.display();
dht.begin();
delay(2000);
}

void loop() {
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
if (isnan(humidity) || isnan(temperature)) {
Serial.println(F("Sensor error"));
display.clearDisplay();
display.setCursor(0, 0);
display.println(F("Sensor Error"));
display.display();
delay(2000);
return;
}

Serial.print(F("Humidity: "));
Serial.print(humidity, 1);
Serial.print(F("% Temp: "));
Serial.print(temperature, 1);
Serial.println(F("C"));

display.clearDisplay();
display.setTextSize(2);
display.setCursor(0, 0);
display.print(temperature, 1);
display.print((char)247);
display.println("C");

display.setCursor(0, 20);
display.print(humidity, 1);
display.println(" %");

display.display();
delay(2000);
}


Wiring & Upload, Test

WhatsApp Image 2025-08-13 at 18.45.07_caa34359.jpg
WhatsApp Image 2025-08-13 at 18.45.10_1e20daf5.jpg
WhatsApp Image 2025-08-13 at 18.45.11_4564cf70.jpg
WhatsApp Image 2025-08-13 at 18.45.11_b3212b22.jpg
WhatsApp Image 2025-08-13 at 18.45.12_b9032f6c.jpg

Wiring


  1. Connect the DHT11 to Arduino Nano: VCC → 5V, GND → GND, DATA → D2.
  2. Connect OLED: VCC → 5V, GND → GND, SCL → A5, SDA → A4.
  3. Double-check wiring before powering up.

Upload & Test


  1. Select Tools → Board → Arduino Nano.
  2. Choose the correct COM port.
  3. Click Upload.
  4. After upload, the OLED should display Temperature in °C and Humidity in %.
  5. Open Serial Monitor (9600 baud) to see live readings for debugging.


Troubleshooting

Troubleshooting


  1. No display output: Check I2C address (0x3C is default for SSD1306).
  2. Nan values: Ensure DHT11 is wired correctly and has a pull-up resistor (if using a bare sensor).
  3. Flickering display: Increase delay in loop() to 2-3 seconds.