مراقبة درجة الحرارة والرطوبة باستخدام DHT11 🌡️
مراقبة درجة الحرارة والرطوبة أمر مهم في العديد من التطبيقات، بما في ذلك المعدات الطبية وأنظمة تكييف الهواء.
في هذا الدرس، سنستخدم الاردوينو لعرض قيم درجة الحرارة والرطوبة على جهاز الكمبيوتر الخاص بك باستخدام مستشعر مناسب يسمى DHT11.
مقدمة

حساس DHT11 هو مستشعر يسمح لك بقياس درجة الحرارة بالدرجات المئوية أو الفهرنهايت والرطوبة بالنسبة المئوية باستخدام الاردوينو.
يستخدم في مجموعة واسعة من التطبيقات، بما في ذلك التنبؤات الجوية، والمعدات الطبية التي تتطلب قياس نسبة الرطوبة، والعديد من التطبيقات الزراعية.
إنه بسيط ومباشر للاستخدام مع مكتبات الاردوينو المناسبة. يوفر نتيجة يمكنك عرضها واستخدامها في مختلف المشاريع والتطبيقات.
لنكتشف المزيد معًا!
الحصول على القطع
ستحتاج إلى المكونات التالية لهذا المشروع، يمكنك شراؤها من متجر ڤولتات.
التوصيل
توضح الصورة التالية كيفية توصيل الأسلاك بين مستشعر DHT11 والاردوينو. بمجرد توصيل مستشعر DHT11 والاردوينو ببعضهما البعض، قم بتوصيل الاردوينو بجهاز الكمبيوتر الخاص بك باستخدام وصلة USB.

التوصيلات من الاردوينو الى DHT11:
• DHT11 GND pin (- pin) ← Arduino GND pin
• DHT11 VCC pin (+ pin) ← Arduino 5V pin
• DHT11 out pin ← Arduino pin 3
برمجة الاردوينو
تتمثل وظيفة نص البرمجة هذا في الحصول على قيم درجة الحرارة بالدرجات المئوية بالإضافة إلى رطوبة الهواء بالنسبة المئوية من مستشعر DHT11 وعرضها على جهاز الكمبيوتر الخاص بك.
لكي يعمل نص البرمجة بشكل صحيح، تحتاج إلى تنزيل مكتبة المستشعر.
المكتبات عبارة عن ملفات يمكنك تنزيلها ونسخها إلى ملفات برنامج Arduino IDE حتى يتمكن الاردوينو من التعرف على أجهزة استشعار مختلفة. يمكنك تنزيل ملفات المكتبة من قسم المصادر ثم تثبيتها باتباع هذا الدرس.
/*
Voltaat learn (http://learn.voltaat.com)
Link for full tutorial: https://bit.ly/3Vo8aCu
Link for libraries: https://bit.ly/3FeXMYL
Tutorial: Monitor temperature and humidity using DHT11
This is an Arduino sketch that monitor temperature in Celsius degrees and humidity
in percentage by using the DHT11 sensor with Arduino
Connections from the Arduino to the DHT11:
• Arduino GND pin → DHT11 GND pin (- pin)
• Arduino 5V pin → DHT11 VCC pin (+ pin)
• Arduino pin 3 → DHT11 out pin
*/
//include the DHT sensor Library#include
//Define Parameters to DHT function, 3 Refers to digital pin 3 in arduino which you can change with any other digital pin, DHT11 is the sensor type.DHT dht(3, DHT11);
//define two variables for Temperature and Humidity.float Temperature, Humidity;
// Commands inside void setup run once.void setup(){ //Initialize the DHT sensor with the begin() method. dht.begin();
//Start the serial monitor at 9600 baud rate (9600 bits per second) Serial.begin(9600);}
//Commands inside void loop run forevervoid loop(){ //wait for 1 sec to get a stable reading from the sensor delay(1000);
//Read the Temperature value from the sensor //You can use Temperature = dht.readTemperature(True); to print the temperature value in Fahrenheit. Temperature = dht.readTemperature();
//Read the Humidity value from the sensor Humidity = dht.readHumidity();
//print "The Temperature = " to the serial monitor Serial.print("The Temperature = ");
//print temperature value at the same line Serial.print(Temperature);
//print " Celsius" to the serial monitor at the same line Serial.print(" Celsius");
//print " The Humidity = " to the serial monitor at the same line Serial.print(" The Humidity = ");
//print The Humidity value to the serial monitor at the same line Serial.print(Humidity);
//print "%" sign to the serial monitor then add new line Serial.println("%");
}
قم باختباره

بعد ان قمت بتوصيل مستشعر DHT11 بشكل صحيح إلى الاردوينو كما أوضحنا في قسم التوصيل، بالإضافة إلى تحميل نص البرمجة على لوحة الاردوينو الخاصة بك.
يمكنك الآن الوصول إلى شاشة التواصل وعرض البيانات في Arduino IDE عن طريق النقر فوق رمز العدسة المكبرة في الزاوية اليمنى العليا.

نافذة التواصل وعرض البيانات هي أداه رائعة في Arduino IDE تمكنك من إجراء اتصال بين جهاز الكمبيوتر الخاص بك والاردوينو. تسمح بإرسال أوامر واستقبال البينات المختلفة وتكون مفيدة في عرض البيانات مثل القراءات من الحساسات المختلفة.
الآن كما نرى في الصورة التالية، تعرض شاشة التواصل وعرض البيانات قيم درجة الحرارة والرطوبة. يتم تحديث القيمة وطباعتها كل ثانية بسبب التأخير الذي أضفناه في نص البرمجة الخاص بنا.
يجب عليك أيضًا التأكد من اختيارك لمعدل baud الصحيح (9600) كما هو محدد في البرنامج.

دروس أخري
LCDs are used in a range of everyday applications, including the automobile radio and the house air conditioning remote. They display data and let you control it through menus.
A soil moisture sensor is a device that measures the amount of water in the soil. The sensor consists of two metal probes that can be inserted into the soil to measure the moisture levels.
Most of us are familiar with the switches used in household devices. A relay is a type of switch that can be connected to an Arduino or any other microcontroller.