[EN] Using the DHT22/DHT11 Temperature and Humidity Sensor Module with ESP8266

This article uses the DHT22 and DHT11 temperature and humidity measurer modules with Python. They are sensor modules that operate using a single signal cable which will save the microcontroller’s port connection. In addition, MicroPython has a library prepared for DHT22 and DHT11 implementation, making it convenient, time-saving and reduce errors that may be caused by manual programming.

There are 3 examples in this article: code17-1 is a normal reading of values, but code17-2 is a loop to read again. By finding the highest and lowest values and display on the LCD module as shown in Figure 8 and example code17-3 showing the average value of temperature and humidity.

Figure 1 Result from code17-1
Read More

[EN] The dCore-espWST

This article recommends using the esp8266 to read temperature and humidity from the DHT11 sensor, the voltage from the LDR sensor, received from the switch, and display via OLED with MicroPython’s Python language, this feature is the dCore-espWST board we are using (Which in the previous article we used the dCore-esp32WST with the same design, but using esp32, but the program code can still be used with the model board) and is a board for use in teaching IoT subjects. The prototype structure of the board is as shown in Figure 1, which is normally used with a battery power supply unit with a solar panel charging circuit.

(Figure. 1 dCore-espWSTprototype)
Read More

[EN] Client/Server Programming for Weather Stations via Wireless Networking

This article is a client/server programming example for a wireless network weather station (Client/Server Programming for Weather Stations via Wireless Networking) using two esp32 microcontrollers communicate over a wireless network. By setting the DHT22 and LDR sensor installed as a server working in AP mode and another esp32 microcontroller board working as a client and media via a custom port to read the temperature, humidity and digital values ​​obtained from the LDR sensor as shown in Figure 1.

(Figure. 1 Our board)
Read More

[EN] Temperature and humidity indicator bar

This article is an example program for cases where you want to display the temperature and humidity bar as shown in Figure 1 with MicroPython and esp32 board with OLED. How to write? The equipment in this experiment used DHT22 as a humidity and temperature measurement device. The board is connected to the I2C bus to communicate with the OLED via pins GPIO4 and GPIO5 for SCL and SDA respectively. At the same time, the signal pin of DHT22 is connected to pin GPIO15 for communication between the sensor and the microcontroller.

(Figure. 1 Example output of temperature and humidity bar display)
Read More

[EN] Arduino : DHT Sensor

This article describes how Adafruit’s DHT Sensor library is compatible with all Arduino-compatible architectures, making it easier to deploy DHT sensors for humidity and temperature readings across multiple platforms. This article has tested with ESP32, ESP8266, Arduino UNO and stm32f103c and found that it can be used without modifying the code in the working part or having to modify the source code to make it compatible with the platform.

(Figure. 1 dht22 and BluePill)
Read More

[TH] The dCore-espWST

บทความนี้แนะนำการใช้ esp8266 เพื่ออ่านอุณหภูมิความชื้นจากเซ็นเซอร์ DHT11 ค่าแรงดันจากเซ็นเซอร์ LDR รับค่าจากสวิตช์ และแสดงผลผ่านทาง OLED ด้วยภาษาไพธอนของ MicroPython โดยคุณสมบัตินี้เป็นบอร์ด dCore-espWST ที่พวกเราใช้งาน (ซึ่งบทความก่อนหน้านี้เราก็ใช้ตัว dCore-esp32WST ที่มีการออกแบบเหมือนกันแต่ใช้ esp32 แต่โค้ดโปรแกรมยังคงใช้กับบอร์ดรุ่นได้ด้วยเช่นกัน) และเป็นบอร์ดสำหรับใช้ในการเรียนการสอนวิชา IoT โดยโครงสร้างต้นแบบของบอร์ดเป็นดังภาพที่ 1 ซึ่งปกติจะใช้กับชุดจ่ายไฟจากระบบแบตเตอรีพร้อมวงจรชาร์จจากแผงโซลาเซลล์

ภาพที่ 1 ต้นแบบของบอร์ด dCore-espWST
Read More

[TH] การเขียนโปรแกรมไคลเอนต์/เซิร์ฟเวอร์สำหรับสถานีอากาศผ่านระบบเครือข่ายไร้สาย

บทความนี้เป็นตัวอย่างการเขียนโปรแกรมไคลเอนต์/เซิร์ฟเวอร์สำหรับสถานีอากาศผ่านระบบเครือข่ายไร้สาย (Client/Server Programming for Weather Stations via Wireless Networking) โดยใช้ไมโครคอนโทรลเลอร์ esp32 จำนวน 2 ตัวสื่อสารกันผ่านเครือข่ายไร้สาย โดยกำหนดให้ตัวที่ติดตั้งเซ็นเซอร์ DHT22 และ LDR เป็นเครื่องให้บริการ (Server) ทำงานในโหมด AP และบอร์ดไมโครคอนโทรลเลอร์ esp32 อีกบอร์ดหนึ่งทำงานเป็นลูกข่าย และสื่อผ่านทางพอร์ตที่กำหนดขึ้นมาเอง เพื่ออ่านค่าอุณหภูมิ ความชื้นและค่าดิจิทัลที่ได้จากเซ็นเซอร์ LDR ดังภาพที่ 1

ภาพที่ 1 บอร์ดและอุปกรณ์สำหรับการทดลองครั้งนี้
Read More

[TH] แถบแสดงค่าอุณหภูมิและความชื้น

บทความนี้เป็นตัวอย่างโปรแกรมสำหรับกรณีที่ต้องการแสดงแถบแสดงค่าอุณหภูมิและความชื้นดังภาพที่ 1 ด้วย MicroPython กับบอร์ด esp32 ที่ติดตั้ง OLED จะเขียนอย่างไร โดยอุปกรณ์ในการทดลองครั้งนี้ใช้ DHT22 เป็นอุปกรณ์วัดความชื้นและอุณหภูมิ โดยบอร์ดเชื่อมต่อกับบัส I2C เพื่อสื่อสารกับ OLED ผ่านทางขา GPIO4 และ GPIO5 สำหรับทำหน้าที่ SCL และ SDA ตามลำดับ พร้อมกันนี้ได้ต่อขาสัญญาณของ DHT22 เข้ากับขา GPIO15 เพื่อใช้สื่อสารกันระหว่างเซ็นเซอร์กับไมโครคอนโทรเลอร์

ภาพที่ 1 ตัวอย่างผลัพธ์ของการแสดงแถบแสดงค่าอุณหภูมิและความชื้น
Read More

[TH] Arduino : DHT Sensor

บทความนี้เป็นการอธิบายการใช้งานไลบรารี DHT Sensor ของ Adafruit ที่รองรับกับทุกสถาปัตยกรรมที่ใช้กับ Arduino ได้ ทำให้สามารถประยุกต์การใช้งานเซ็นเซอร์ DHT ซึ่งใช้สำหรับอ่านค่าความชื้นและอุณหภูมิได้สะดวกและกับหลายแพลตฟอร์มได้ง่ายขึ้น โดยบทความนี้ได้ทดสอบกับ ESP32, ESP8266, Arduino UNO และ stm32f103c แล้วพบว่าสามารถใช้งานได้โดยไม่ต้องปรับแก้ไขโค้ดในส่วนของการทำงานหรือต้องเข้าไปแก้ไขรหัสต้นฉบับเพื่อให้ใช้งานได้กับแพลตฟอร์มที่ใช้งาน

ภาพที่ 1 dht22 Sensor กับ BluePill
Read More

[TH] Using the DHT22/DHT11 Temperature and Humidity Sensor Module with ESP8266

บทความครั้งนี้เป็นการใช้งานโมดูลวัดค่าอุณหภูมิและความชื้น DHT22 และ DHT11 ด้วยภาษาไพธอน ซึ่งเป็นโมดูลเซ็นเซอร์ที่ทำงานด้วยการใช้สายสัญญาณเพียงเส้นเดียว ทำให้ประหยัดพอร์ตของไมโครคอนโทรลเลอร์ในการเชื่อมต่อกับโมดูลเซ็นเซอร์ นอกจากนี้ MicroPython มีไลบรารีเตรียมไว้สำหรับการใช้งาน DHT22 และ DHT11 จึงสะดวกและประหยัดเวลา ลดความผิดพลาดที่อาจจะเกิดจากการเขียนโปรแกรมด้วยตนเอง

ตัวอย่างในบทความนี้มี 3 ตัวอย่าง code17-1 เป็นการอ่านค่ามาแสดงผลแบปกติ แต่ code17-2 เป็นการวนรอบเพื่ออ่านซ้ำ โดยนำค่าที่อ่านมาหาค่าน้อยสุดและต่ำสุด พร้อมทั้งแสดงออกทางโมดูลแอลซีดีดังภาพที่ 8 และตัวอย่าง code17-3 เป็นการแสดงค่าเฉลี่ยของอุณหภูมิและความชื้น

ภาพที่ 1 ผลลัพธ์จาก code17-1
Read More