medium
สร้างสถานีวัดอากาศด้วย ESP32
Admin
2 ชั่วโมง
Feb 01, 2026
Scan to view full project online
Instructions
7 Steps1
Step 1: ต่อวงจร
ต่อขา Data ของ DHT11 เข้ากับขา D4 ของ ESP32, VCC เข้า 3.3V และ GND เข้า GND
2
Step 2: Preparation and Safety
Before starting, ensure you have a clean workspace and all safety gear is worn. Check all tools are in good working condition.
3
Step 3: ติดตั้ง Library
ใน Arduino IDE ไปที่ Sketch > Include Library > Manage Libraries... ค้นหา "DHT sensor library" แล้วติดตั้ง
4
Step 4: Main Assembly - Phase 1
Begin by assembling the base structure. Follow the diagram carefully. Ensure all connections are tight and secure.
5
Step 5: เขียนโค้ดอ่านค่า
ก๊อปปี้โค้ดสำหรับอ่านค่าอุณหภูมิและความชื้น
cpp
#include "DHT.h"
#define DHTPIN 4
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
float h = dht.readHumidity();
float t = dht.readTemperature();
Serial.print("Hum: ");
Serial.print(h);
Serial.print(" Temp: ");
Serial.println(t);
delay(2000);
}
6
Step 6: Main Assembly - Phase 2
Continue with the secondary components. Attach them to the base structure created in step 1. Double check measurements.
7
Step 7: Final Polish and Testing
Sand down any rough edges (if applicable) or tidy up wiring. Test the functionality of your project to ensure everything works as intended.