กลับไปหน้ารวมไฟล์
simple-temperature-and-humidity-sensor-dd1b3a.md

เซนเซอร์วัดอุณหภูมิและความชื้นแบบง่ายๆ ฉบับวัยรุ่นสร้างตัว!

พี่กำลังลองหัดเล่น [Arduino](https://s.shopee.co.th/7fUgFAWSki) อยู่พอดี เลยจัดโปรเจกต์ทำเครื่องวัดอุณหภูมิแบบง่ายๆ มาให้ดู ตัวนี้ใช้ Seven-segment display โชว์เลขเฟี้ยวๆ แถมมีปุ่มกดสลับดูได้ทั้งอุณหภูมิและความชื้นด้วยนะเออ

ว่าด้วยเรื่อง 4-digit 7-segment display ที่พี่ใช้เนี่ย มันมี 12 Pins (มี Pin A ถึง G, Pin DP แล้วก็พวก Digit Pins) ดู Schematic ตามนี้เลยน้อง อย่าเสียบมั่วล่ะ เดี๋ยวควันขึ้น!

แถวบน เรียงจากซ้ายไปขวา: DG1, A, F, DG2, DG3, B

แถวล่าง เรียงจากซ้ายไปขวา: E, D, DP, C, G, DG4

รายละเอียดทางเทคนิคแบบจัดเต็ม

การตรวจวัดสภาพแวดล้อมระดับมาตรฐาน

นี่คือโปรเจกต์พื้นฐานที่น้องต้องผ่าน ถ้าอยากจะเข้าใจเรื่องการเก็บข้อมูลสภาพอากาศให้แจ่มแจ้ง

  • การเชื่อมต่อ DHT11/DHT22: เราจะใช้ One-Wire protocol มาตรฐานเพื่อดึงข้อมูลแบบ 40-bit มาใช้งาน งานนี้พี่แนะนำให้ใช้ DHT22 นะน้อง เพราะมันแม่นยำกว่าเยอะ (+/- 0.5°C) แถมช่วงการวัดก็กว้างกว่าด้วย สู้งานแน่นอนตัวนี้
  • การจัดการข้อมูล (Data Parsing): ไม่ต้องห่วง เรื่องการจัดการ Pulse ที่ต้องเป๊ะเรื่องเวลา เดี๋ยว Library ของ Arduino จะจัดการแยกส่วนเลขจำนวนเต็มของ Humidity กับทศนิยมของ Temperature ให้เราเอง สบายบรื๋อ!

การแสดงผลหน้าจอ (UI Presentation)

  • I2C LCD Display: เราจะโชว์ค่าแบบ Real-time บนจอ 16x2 character display พื้นหลังสีน้ำเงินสุดหล่อ
  • การแปลงหน่วย: พี่จัด Code ไว้ให้แล้ว น้องสามารถกดสลับหน่วย Celsius กับ Fahrenheit ได้ง่ายๆ แค่กดปุ่ม Tactile switch ที่ต่ออยู่กับ Digital input จัดไปวัยรุ่น หล่อเท่เลยงานนี้!

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

title: "Simple Temperature and Humidity Sensor!"
description: "Find how hot or cold is your room with this simple temperature and humidity sensor with a DHT11!"
author: "sgongo"
category: ""
tags:
  - "monitoring"
views: 5367
likes: 2
price: 699
difficulty: "Easy"
components:
  - "1x Pushbutton"
  - "1x Breadboard (generic)"
  - "1x DHT11 Temperature & Humidity Sensor (4 pins)"
  - "1x 4 digit 7 segment display"
  - "1x Arduino Mega 2560"
  - "1x Resistor 220 ohm"
  - "1x Jumper wires (generic)"
tools: []
apps:
  - "1x Arduino IDE"
downloadableFiles:
  - "https://projects.arduinocontent.cc/c0f64a2c-fa74-423a-a0d6-8fb629eaaaa4.ino"
documentationLinks: []
passwordHash: "f4d20c1373465171c6e370eb0043a5a74a82027abfd6354741b178d4c10b1866"
encryptedPayload: "U2FsdGVkX19weHZrHment6KpS98xi8o5669OxF5XszycGsQ3CW3rDXyAErIUIym3pDad/sOyjjwsyRq4dI9bJT0+vtC8UXHhJA0vwOUAXgc="
seoDescription: "Build a simple Temperature and Humidity Sensor using DHT11 and Arduino to monitor your room's climate easily."
videoLinks: []
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/simple-temperature-and-humidity-sensor-dd1b3a_cover.jpg"
lang: "th"