กลับไปหน้ารวมไฟล์
simple-weather-station-8fadfe-en.md

Hello and welcome to another arduino tutorial

In this project we will learn how to build a simple weather station using DHT11 Sensor and OLED display.

This project micro controller is Arduino Uno R3.

This foundational project merges two different data-collection architectures and requires formatting the results for display.

Analog vs. Digital Sensor Protocols

You cannot analogRead() a DHT11 sensor! The components in this system use fundamentally different communication methods.

  1. The DHT11 Temperature & Humidity Sensor: This is a digital sensor with its own internal processor. It transmits a 40-bit data stream representing its readings.

    • You MUST use the <DHT.h> library to communicate with it.
    • Data is read using specific library commands: float temperature = dht.readTemperature(); and float humidity = dht.readHumidity();.
  2. The Light Dependent Resistor (LDR): This is a purely analog, physical component. Its resistance changes based on light intensity.

    • It MUST be used in a Voltage Divider circuit with a fixed resistor (e.g., 10K Ohm).
    • The Arduino reads it as a simple analog voltage: int lightValue = analogRead(A0); (Outputs a value from 0 to 1023).

Formatting Data for the Display

The microcontroller reads values like temperature = 25.0 and humidity = 60.0. A character display has limited space, so data must be organized carefully.

  • A 16x2 Character LCD (especially with an I2C backpack to simplify wiring) has exactly 32 character positions.
  • Execution: You must control the cursor position precisely to format the output:
    lcd.setCursor(0, 0); // Start at the beginning of the first line
    lcd.print("T: "); lcd.print(temperature); lcd.print("C");
    
    lcd.setCursor(0, 1); // Move to the beginning of the second line
    lcd.print("H: "); lcd.print(humidity); lcd.print("%");
    
  • To display additional data (like from the LDR) on the same small screen, you can create a simple pagination system. Use delay(3000); lcd.clear(); to wipe the screen every few seconds and cycle through different data screens.

Standard Climate Station Components

  • Arduino Uno R3 / Nano (Provides standard execution speed and I/O).
  • DHT11 Temperature & Humidity Sensor (The DHT22 is a more precise alternative, providing decimal readings).
  • Light Dependent Resistor (LDR) Photocell.
  • 16x2 LCD Character Display + I2C Backpack (The I2C interface drastically reduces the number of required connecting wires from 16 to just 4).

You can make your own adaptations since the system is versatile [Challenge for the reader: minimize the system ;) ].

Take care, Roy.

ข้อมูล Frontmatter ดั้งเดิม

apps:
  - "1x Arduino IDE"
author: "RoyB"
category: "Sensors & Environment"
components:
  - "1x Arduino UNO"
  - "1x DHT11 Temperature & Humidity Sensor (4 pins)"
  - "1x Graphic OLED, 128 x 64"
description: "Atmospheric parameter extraction! Connect precision DHT11 digital thermodynamics alongside analog LDR photoresistors, rendering multiplexed climate dashboard geometries directly onto a localized 16x2 character display."
difficulty: "Intermediate"
documentationLinks: []
downloadableFiles:
  - "https://github.com/RoyBenAvraham/Simper_weather_station.git"
encryptedPayload: "U2FsdGVkX18oUhgHKHO8//QIT0MCM41bn2ztk4PXmjNbzZKcRQ6bloJD5Dy+nZDMpEv0ZnvQDXaDIzPdhOjDjE8JgrqjLw23gTRz95nu9Z4="
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/simple-weather-station-8fadfe_cover.jpg"
lang: "en"
likes: 1
passwordHash: "247e4b9f22f9f2e3a3fde14cd7728bf612e33f4788552602b8393e4ee7b1ff51"
price: 699
seoDescription: "Build a Simple Weather Station using DHT11 sensor, OLED display, and Arduino Uno R3. Easy DIY electronics project."
tags:
  - "weather"
  - "iot"
  - "diy"
title: "Simple Weather Station"
tools: []
videoLinks:
  - "https://www.youtube.com/embed/CliqlcaTJro"
views: 5664