{"id":2973,"date":"2019-02-03T08:33:05","date_gmt":"2019-02-03T01:33:05","guid":{"rendered":"http:\/\/ton.packetlove.com\/blog\/?p=2973"},"modified":"2022-06-18T18:02:20","modified_gmt":"2022-06-18T11:02:20","slug":"esp32-node32-lite-pm25-temperature-humidity-sensors-node","status":"publish","type":"post","link":"https:\/\/ton.packetlove.com\/blog\/iot\/esp32-node32-lite-pm25-temperature-humidity-sensors-node.html","title":{"rendered":"ESP32 (NODE32 LITE) PM2.5+Temperature+Humidity Sensors Node"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2983\" src=\"http:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PM25_sensors_node-640x640.jpg\" alt=\"\" width=\"640\" height=\"640\" srcset=\"https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PM25_sensors_node-640x640.jpg 640w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PM25_sensors_node-150x150.jpg 150w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PM25_sensors_node-768x768.jpg 768w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PM25_sensors_node-100x100.jpg 100w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PM25_sensors_node-70x70.jpg 70w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PM25_sensors_node.jpg 960w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>\u0e40\u0e19\u0e37\u0e48\u0e2d\u0e07\u0e43\u0e19\u0e27\u0e31\u0e19 <strong>ESP32 Day<\/strong> (03\/02\/2019) \u0e1c\u0e21\u0e40\u0e2d\u0e07\u0e44\u0e21\u0e48\u0e44\u0e14\u0e49\u0e44\u0e1b\u0e23\u0e48\u0e27\u0e21\u0e07\u0e32\u0e19\u0e17\u0e35\u0e48\u0e08\u0e31\u0e14\u0e01\u0e31\u0e19 \u0e40\u0e1e\u0e23\u0e32\u0e30\u0e15\u0e34\u0e14\u0e07\u0e32\u0e19\u0e2d\u0e37\u0e48\u0e19 \u0e41\u0e25\u0e30\u0e44\u0e14\u0e49 sensors \u0e27\u0e31\u0e14 PM2.5 \u0e21\u0e32\u0e1e\u0e2d\u0e14\u0e35 \u0e01\u0e47\u0e40\u0e25\u0e22\u0e21\u0e32\u0e17\u0e33 Sensers Node \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e27\u0e31\u0e14\u0e04\u0e48\u0e32 PM2.5 \u0e43\u0e19\u0e1a\u0e23\u0e34\u0e40\u0e27\u0e13\u0e17\u0e35\u0e48\u0e2d\u0e22\u0e39\u0e48\u0e2d\u0e32\u0e28\u0e31\u0e22 \u0e41\u0e25\u0e49\u0e27\u0e2a\u0e48\u0e07\u0e02\u0e36\u0e49\u0e19 thingspeak.com \u0e41\u0e25\u0e30 netpie.io freeboard \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e17\u0e33 Dashboard \u0e2a\u0e27\u0e22\u0e46 \u0e07\u0e32\u0e21\u0e46 \u0e41\u0e25\u0e30\u0e40\u0e1b\u0e47\u0e19\u0e1b\u0e23\u0e30\u0e42\u0e22\u0e0a\u0e19\u0e4c\u0e43\u0e19\u0e01\u0e32\u0e23\u0e23\u0e32\u0e22\u0e07\u0e32\u0e19\u0e04\u0e48\u0e32 PM2.5 \u0e17\u0e35\u0e48\u0e21\u0e35\u0e1b\u0e31\u0e0d\u0e2b\u0e32\u0e01\u0e31\u0e19\u0e2d\u0e22\u0e39\u0e48\u0e43\u0e19\u0e1b\u0e23\u0e30\u0e40\u0e17\u0e28\u0e44\u0e17\u0e22 \u0e15\u0e2d\u0e19\u0e19\u0e35\u0e49 \u0e43\u0e2b\u0e49\u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e19\u0e46 \u0e1e\u0e35\u0e48\u0e46 \u0e19\u0e49\u0e2d\u0e07\u0e46 \u0e44\u0e14\u0e49\u0e23\u0e31\u0e1a\u0e17\u0e23\u0e32\u0e1a\u0e01\u0e31\u0e19\u0e04\u0e23\u0e31\u0e1a &#8230;<\/p>\n<h2>1. \u0e2d\u0e38\u0e1b\u0e01\u0e23\u0e13\u0e4c \u0e41\u0e25\u0e30 stack \u0e17\u0e35\u0e48\u0e43\u0e0a\u0e49\u0e21\u0e35\u0e14\u0e31\u0e07\u0e19\u0e35\u0e49<\/h2>\n<p>&#8211; <strong>ESP32 (NODE32 LITE)<\/strong> 275 \u0e1a\u0e32\u0e17 [<a href=\"https:\/\/gravitechthai.com\/product_detail.php?d=3318\">https:\/\/gravitechthai.com\/product_detail.php?d=3318<\/a>]<br \/>\n&#8211; <strong>SHARP GP2Y1010AU0F<\/strong> (PM2.5 Sensor) 137 \u0e1a\u0e32\u0e17 [<a href=\"https:\/\/shopee.co.th\/product\/59553004\/1361931900?fbclid=IwAR36Yg2AVgfW7HUWfPxHZ4uV8SatBm9Mx31AF0VELn39QfUXOnN_gvFSgpY\">https:\/\/shopee.co.th\/product\/59553004\/1361931900<\/a>]<br \/>\n&#8211; <strong>AM2302<\/strong> (Temperature+Humidity Sensor) 180 \u0e1a\u0e32\u0e17 [<a href=\"https:\/\/www.myarduino.net\/product\/725\/dht22-am2302-%E0%B9%80%E0%B8%8B%E0%B8%99%E0%B9%80%E0%B8%8B%E0%B8%AD%E0%B8%A3%E0%B9%8C%E0%B8%A7%E0%B8%B1%E0%B8%94-%E0%B8%AD%E0%B8%B8%E0%B8%93%E0%B8%AB%E0%B8%A0%E0%B8%B9%E0%B8%A1%E0%B8%B4%E0%B8%84%E0%B8%A7%E0%B8%B2%E0%B8%A1%E0%B8%8A%E0%B8%B7%E0%B9%89%E0%B8%99-%E0%B8%AD%E0%B8%A2%E0%B9%88%E0%B8%B2%E0%B8%87%E0%B8%94%E0%B8%B5%E0%B8%AA%E0%B8%B3%E0%B8%AB%E0%B8%A3%E0%B8%B1%E0%B8%9A-arduino-%E0%B8%9E%E0%B8%A3%E0%B9%89%E0%B8%AD%E0%B8%A1%E0%B9%80%E0%B8%84%E0%B8%AA\">https:\/\/www.myarduino.net\/product\/725\/<\/a>]<br \/>\n&#8211; <a href=\"https:\/\/thingspeak.com\/\">thingspeak.com<\/a><br \/>\n&#8211; <a href=\"https:\/\/netpie.io\/\">netpie.io<\/a><\/p>\n<p><strong>\u0e23\u0e27\u0e21\u0e23\u0e32\u0e04\u0e32<\/strong> \u0e2d\u0e38\u0e1b\u0e01\u0e23\u0e13\u0e4c \u0e17\u0e35\u0e48\u0e43\u0e0a\u0e49 \u0e1b\u0e23\u0e30\u0e21\u0e32\u0e13 <strong>600<\/strong> \u0e1a\u0e32\u0e17 \u0e04\u0e23\u0e31\u0e1a \ud83d\ude42<\/p>\n<h2>2. \u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14 \u0e02\u0e2d\u0e07\u00a0SHARP GP2Y1010AU0F Sensor<\/h2>\n<p>\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14 \u0e02\u0e2d\u0e07\u0e41\u0e15\u0e48\u0e25\u0e30 PIN \u0e02\u0e2d\u0e07 SHARP GP2Y1010AU0F \u0e40\u0e1b\u0e47\u0e19\u0e14\u0e31\u0e07\u0e19\u0e35\u0e49\u0e04\u0e23\u0e31\u0e1a<br \/>\n\u0e42\u0e14\u0e22\u0e08\u0e30\u0e15\u0e49\u0e2d\u0e07\u0e21\u0e35 C 220 uF \u0e41\u0e25\u0e30 R 150 ohm \u0e15\u0e48\u0e2d\u0e14\u0e49\u0e27\u0e22 (\u0e15\u0e31\u0e27\u0e17\u0e35\u0e48\u0e1c\u0e21\u0e0b\u0e37\u0e49\u0e2d\u0e21\u0e32 \u0e1e\u0e35\u0e48\u0e08\u0e35\u0e19 \u0e25\u0e37\u0e21\u0e41\u0e16\u0e21\u0e21\u0e32\u0e43\u0e2b\u0e49 +__+)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2980\" src=\"http:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/SHARP_GP2Y1010AU0F_6PIN.jpg\" alt=\"\" width=\"452\" height=\"300\" srcset=\"https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/SHARP_GP2Y1010AU0F_6PIN.jpg 452w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/SHARP_GP2Y1010AU0F_6PIN-100x66.jpg 100w\" sizes=\"auto, (max-width: 452px) 100vw, 452px\" \/><br \/>\nSensor \u0e17\u0e35\u0e48\u0e1c\u0e21\u0e44\u0e14\u0e49\u0e21\u0e32 \u0e08\u0e30\u0e41\u0e16\u0e21\u0e2a\u0e32\u0e22 \u0e40\u0e23\u0e35\u0e22\u0e07\u0e2a\u0e35\u0e21\u0e32\u0e41\u0e1a\u0e1a\u0e19\u0e35\u0e49\u0e40\u0e25\u0e22\u0e04\u0e23\u0e31\u0e1a \u0e41\u0e15\u0e48\u0e21\u0e35\u0e1a\u0e32\u0e07 version \u0e08\u0e30\u0e40\u0e1b\u0e47\u0e19\u0e2a\u0e35\u0e40\u0e23\u0e35\u0e22\u0e07\u0e15\u0e48\u0e32\u0e07\u0e08\u0e32\u0e01\u0e19\u0e35\u0e49 \u0e44\u0e21\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e15\u0e01\u0e43\u0e08\u0e04\u0e23\u0e31\u0e1a ..<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2978\" src=\"http:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/SHARP_GP2Y1010AU0F_PIN.jpg\" alt=\"\" width=\"606\" height=\"394\" srcset=\"https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/SHARP_GP2Y1010AU0F_PIN.jpg 606w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/SHARP_GP2Y1010AU0F_PIN-100x65.jpg 100w\" sizes=\"auto, (max-width: 606px) 100vw, 606px\" \/><br \/>\nPIN \u0e15\u0e48\u0e32\u0e07\u0e46 \u0e21\u0e35\u0e14\u0e31\u0e07\u0e19\u0e35\u0e49 INPUT \u0e08\u0e30\u0e21\u0e35 LED PIN (Digital PIN) \u0e01\u0e31\u0e1a Vo PIN (Analog PIN)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2977\" src=\"http:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/SHARP_GP2Y1010AU0F_WIRE-627x640.jpg\" alt=\"\" width=\"627\" height=\"640\" srcset=\"https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/SHARP_GP2Y1010AU0F_WIRE-627x640.jpg 627w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/SHARP_GP2Y1010AU0F_WIRE-98x100.jpg 98w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/SHARP_GP2Y1010AU0F_WIRE-70x70.jpg 70w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/SHARP_GP2Y1010AU0F_WIRE.jpg 686w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/><br \/>\n\u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14\u0e01\u0e32\u0e23\u0e15\u0e48\u0e2d\u0e02\u0e32\u0e15\u0e48\u0e32\u0e07\u0e46 \u0e43\u0e19\u0e17\u0e35\u0e48\u0e19\u0e35\u0e49\u0e40\u0e17\u0e35\u0e22\u0e1a\u0e01\u0e31\u0e1a Arduino \u0e16\u0e49\u0e32\u0e40\u0e1b\u0e47\u0e19 ESP32 \u0e01\u0e47\u0e04\u0e25\u0e49\u0e32\u0e22\u0e46 \u0e01\u0e31\u0e19\u0e04\u0e23\u0e31\u0e1a<\/p>\n<h2>3. PIN \u0e15\u0e48\u0e32\u0e07\u0e46 \u0e17\u0e35\u0e48\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e01\u0e31\u0e1a\u00a0ESP32 (NODE32 LITE)<\/h2>\n<p>\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e43\u0e19\u0e01\u0e32\u0e23\u0e15\u0e48\u0e2d\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19 \u0e01\u0e31\u0e1a ESP32 (NODE32 LITE) \u0e1c\u0e21\u0e08\u0e30\u0e43\u0e0a\u0e49 PIN \u0e15\u0e48\u0e32\u0e07\u0e46 \u0e1b\u0e23\u0e30\u0e21\u0e32\u0e13\u0e19\u0e35\u0e49<br \/>\n&#8211; <strong>PIN 13<\/strong> \u0e01\u0e31\u0e1a\u0e02\u0e32 INPUT \u0e02\u0e2d\u0e07 AM2302 (Temperature+Humidity Sensor)<br \/>\n&#8211; <strong>PIN 16<\/strong> \u0e01\u0e31\u0e1a\u0e02\u0e32 LED \u0e02\u0e2d\u0e07 SHARP GP2Y1010AU0F (PM2.5 Sensor)<br \/>\n&#8211; <strong>PIN 36<\/strong> (Analog INPUT) \u0e01\u0e31\u0e1a\u0e02\u0e32 Vo \u0e02\u0e2d\u0e07 SHARP GP2Y1010AU0F (PM2.5 Sensor)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3003\" src=\"http:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/Node32Lite_PM25_DHT22_bb-640x636.png\" alt=\"\" width=\"640\" height=\"636\" srcset=\"https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/Node32Lite_PM25_DHT22_bb-640x636.png 640w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/Node32Lite_PM25_DHT22_bb-150x150.png 150w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/Node32Lite_PM25_DHT22_bb-768x763.png 768w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/Node32Lite_PM25_DHT22_bb-1024x1017.png 1024w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/Node32Lite_PM25_DHT22_bb-100x100.png 100w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/Node32Lite_PM25_DHT22_bb-70x70.png 70w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/Node32Lite_PM25_DHT22_bb.png 1755w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><br \/>\n\u0e01\u0e32\u0e23\u0e40\u0e0a\u0e37\u0e48\u0e2d\u0e21\u0e15\u0e48\u0e2d Node32 Lite + Sharp GP2Y1010AU0F \u0e41\u0e25\u0e30 AM2302<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2984\" src=\"http:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PM25_hardware_dashboard-476x640.jpg\" alt=\"\" width=\"476\" height=\"640\" srcset=\"https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PM25_hardware_dashboard-476x640.jpg 476w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PM25_hardware_dashboard-74x100.jpg 74w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PM25_hardware_dashboard.jpg 714w\" sizes=\"auto, (max-width: 476px) 100vw, 476px\" \/><br \/>\n\u0e43\u0e19\u0e23\u0e39\u0e1b \u0e22\u0e31\u0e07\u0e44\u0e21\u0e48\u0e44\u0e14\u0e49\u0e15\u0e48\u0e2d AM2302 (Temperature+Humidity Sensor) \u0e41\u0e15\u0e48\u0e04\u0e34\u0e14\u0e27\u0e48\u0e32\u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e19\u0e46 \u0e19\u0e48\u0e32\u0e08\u0e30\u0e40\u0e04\u0e22\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e01\u0e31\u0e19\u0e21\u0e32\u0e41\u0e25\u0e49\u0e27<\/p>\n<p>\u0e43\u0e19 Arduino IDE \u0e40\u0e23\u0e32\u0e08\u0e30\u0e15\u0e49\u0e2d\u0e07\u0e17\u0e33\u0e01\u0e32\u0e23\u0e40\u0e1e\u0e34\u0e48\u0e21 <strong>PMSensor Library<\/strong> \u0e40\u0e02\u0e49\u0e32\u0e44\u0e1b\u0e14\u0e49\u0e27\u0e22\u0e19\u0e30\u0e04\u0e23\u0e31\u0e1a<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2991\" src=\"http:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PMSensor_Arduino-640x394.png\" alt=\"\" width=\"640\" height=\"394\" srcset=\"https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PMSensor_Arduino-640x394.png 640w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PMSensor_Arduino-768x473.png 768w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PMSensor_Arduino-100x62.png 100w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PMSensor_Arduino.png 912w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<h2>4. Source Code<\/h2>\n<p>\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a Code \u0e1c\u0e21\u0e40\u0e02\u0e35\u0e22\u0e19\u0e40\u0e1b\u0e47\u0e19 Deep Sleep Mode \u0e17\u0e38\u0e01\u0e46 1 \u0e19\u0e32\u0e17\u0e35 \u0e1b\u0e23\u0e30\u0e21\u0e32\u0e13\u0e19\u0e35\u0e49\u0e04\u0e23\u0e31\u0e1a ..<br \/>\n\u0e16\u0e32\u0e21\u0e27\u0e48\u0e32\u0e17\u0e33\u0e44\u0e21\u0e15\u0e49\u0e2d\u0e07 Deep Sleep Mode?<br \/>\n\u0e04\u0e33\u0e15\u0e2d\u0e1a\u0e04\u0e37\u0e2d \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e1b\u0e23\u0e30\u0e2b\u0e22\u0e31\u0e14 battery \u0e40\u0e27\u0e25\u0e32\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e08\u0e23\u0e34\u0e07\u0e04\u0e23\u0e31\u0e1a \u0e41\u0e25\u0e30\u0e2d\u0e38\u0e1b\u0e01\u0e23\u0e13\u0e4c\u0e1e\u0e27\u0e01\u0e19\u0e35\u0e49 \u0e16\u0e49\u0e32\u0e43\u0e2b\u0e49 connect WiFi \u0e15\u0e25\u0e2d\u0e14\u0e40\u0e27\u0e25\u0e32 \u0e08\u0e30\u0e40\u0e01\u0e34\u0e14\u0e04\u0e27\u0e32\u0e21\u0e23\u0e49\u0e2d\u0e19\u0e2a\u0e39\u0e07\u0e21\u0e32\u0e01 \u0e17\u0e33\u0e43\u0e2b\u0e49 \u0e1b\u0e23\u0e30\u0e2a\u0e34\u0e17\u0e18\u0e34\u0e20\u0e32\u0e1e\u0e43\u0e19\u0e01\u0e32\u0e23\u0e17\u0e33\u0e07\u0e32\u0e19 \u0e25\u0e14\u0e25\u0e07 \u0e2b\u0e23\u0e37\u0e2d\u0e17\u0e33\u0e07\u0e32\u0e19\u0e1c\u0e34\u0e14\u0e1e\u0e25\u0e32\u0e14\u0e44\u0e14\u0e49\u0e07\u0e48\u0e32\u0e22 \u0e04\u0e23\u0e31\u0e1a ..<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-cpp\" data-lang=\"C++\"><code>\/* Connect to SHARP PM2.5 Sensor*\/\r\n#include &lt;PMsensor.h&gt;\r\nPMsensor PM;\r\n#include &lt;WiFi.h&gt;\r\n#include \"DHT.h\"\r\n#define DHTPIN 13   \/\/ NodeMCU PIN D1\r\n#define DHTTYPE DHT22   \/\/ DHT 22  (AM2302), AM2321\r\n\/\/#define DHTTYPE DHT21   \/\/ DHT 21 (AM2301)\r\nDHT dht(DHTPIN, DHTTYPE);\r\n\r\n\/\/ AP \r\nconst char* ssid     = \"SookYenFarm\";    \/\/ SSID Wifi\r\nconst char* password = \"********\";   \/\/ Password Wifi\r\n\r\n\/\/ HTTP API \r\nconst char* host = \"api.thingspeak.com\";\r\nconst char* api   = \"********\";  \/\/API Key\r\n\r\nint value = 0;\r\nvoid connect() {\r\n  \/\/ We start by connecting to a WiFi network\r\n  Serial.println();\r\n  Serial.println();\r\n  Serial.print(\"Connecting to \");\r\n  Serial.println(ssid);\r\n  WiFi.begin(ssid, password);\r\n  while (WiFi.status() != WL_CONNECTED) {\r\n    delay(500);\r\n    Serial.print(\".\");\r\n  }\r\n  Serial.println(\"\");\r\n  Serial.println(\"WiFi connected\");  \r\n  Serial.println(\"IP address: \");\r\n  Serial.println(WiFi.localIP());\r\n  Serial.println(\"DHT22 test!\");\r\n  \r\n  dht.begin();\r\n\r\n  \/\/ LED Stop\r\n  \/\/digitalWrite(LED_BUILTIN, HIGH);\r\n  \/\/delay(10);\r\n  \/\/delay(60000);\r\n  ++value;\r\n  float h = dht.readHumidity();\r\n  float t = dht.readTemperature();\r\n  float f = dht.readTemperature(true);\r\n  if (isnan(h) || isnan(t) || isnan(f)) {\r\n    Serial.println(\"Failed to read from DHT sensor!\");\r\n    return;\r\n  }\r\n  float hif = dht.computeHeatIndex(f, h);\r\n  float hic = dht.computeHeatIndex(t, h, false);\r\n  Serial.print(\"Humidity: \");\r\n  Serial.print(h);\r\n  Serial.print(\" %\\t\");\r\n  Serial.print(\"Temperature: \");\r\n  Serial.print(t);\r\n  Serial.print(\" *C \");\r\n  Serial.print(f);\r\n  Serial.print(\" *F\\t\");\r\n  Serial.print(\"Heat index: \");\r\n  Serial.print(hic);\r\n  Serial.print(\" *C \");\r\n  Serial.print(hif);\r\n  Serial.println(\" *F\");\r\n  Serial.print(\"connecting to \");\r\n  Serial.println(host);\r\n\r\n  float pm = 0;\r\n  int err = PMsensorErrSuccess;\r\n  \r\n  if ((err = PM.read(&amp;pm, true, 0.1)) != PMsensorErrSuccess) {\r\n    Serial.print(\"data Error = \");\r\n    Serial.println(err);\r\n    return;\r\n  }\r\n  Serial.print(\"PM2.5: \");\r\n  Serial.print(pm);\r\n  Serial.println(\" ppm\");\r\n\r\n  \/\/ Use WiFiClient class to create TCP connections\r\n  WiFiClient client;\r\n  const int httpPort = 80;\r\n  if (!client.connect(host, httpPort)) {\r\n    Serial.println(\"connection failed\");\r\n    return;\r\n  }\r\n\r\n  \/\/ We now create a URI for the request\r\n  String url = \"\/update?api_key=\";\r\n  url += api;\r\n  url += \"&amp;field1=\";\r\n  url += t;\r\n  url += \"&amp;field2=\";  \r\n  url += h;\r\n  url += \"&amp;field3=\";  \r\n  url += pm;\r\n  \/\/ https:\/\/api.thingspeak.com\/update?api_key=xxxxxxxxxx&amp;field1=t&amp;field2=h&amp;field3=pm\r\n  Serial.print(\"Requesting URL: \");\r\n  Serial.println(url);\r\n  \/\/ This will send the request to the server\r\n  client.print(String(\"GET \") + url + \" HTTP\/1.1\\r\\n\" +\r\n               \"Host: \" + host + \"\\r\\n\" + \r\n               \"Connection: close\\r\\n\\r\\n\");\r\n   \/\/Wait up to 10 seconds for server to respond then read response\r\n   int i=0;\r\n   while((!client.available()) &amp;&amp; (i&lt;1000)){\r\n     \/\/ LED Blink\r\n     digitalWrite(LED_BUILTIN, LOW);\r\n     delay(10);\r\n     \/\/Serial.println(i);\r\n     i++;\r\n   }\r\n   while(client.available()){\r\n     String line = client.readStringUntil('\\r');\r\n     Serial.print(line);\r\n   }\r\n   Serial.println();\r\n   Serial.println(\"closing connection\");\r\n}\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n  Serial.setTimeout(2000);\r\n  delay(1000);\r\n  pinMode(LED_BUILTIN, OUTPUT);\r\n  \/\/\/\/\/(infrared LED pin, sensor pin)  \/\/\/\/\/\r\n  PM.init(16, 36);\r\n\r\n  \/\/ Wait for serial to initialize.\r\n  while (!Serial) { }\r\n\r\n  Serial.println(\"Device Started\");\r\n  Serial.println(\"-------------------------------------\");\r\n  Serial.println(\"Running Deep Sleep Firmware!\");\r\n  Serial.println(\"-------------------------------------\");\r\n\r\n  connect();\r\n\r\n  Serial.println(\"Sleeping 60 seconds ..\");\r\n  \/\/ Deep Sleep 60 seconds\r\n  ESP.deepSleep(58e6); \/\/ 60e6 is 60 microsecondsESP.\r\n  \/\/ESP.deepSleep(298e6); \/\/ 5*60 microsecondsESP.\r\n}\r\n<\/code><\/pre>\n<\/div>\n<p>Source Code \u0e43\u0e19 GitHub \u0e15\u0e32\u0e21\u0e19\u0e35\u0e49\u0e40\u0e25\u0e22\u0e04\u0e23\u0e31\u0e1a <a href=\"https:\/\/github.com\/pornpasok\/ESP32PM25sensor\/blob\/master\/ESP32_ThingSpeak_DHT22_PM25_deepsleep.ino\">ESP32 PM2.5 sensor<\/a><\/p>\n<h2>5. Data \u0e17\u0e35\u0e48 Feed \u0e02\u0e36\u0e49\u0e19 ThingSpeak<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2993\" src=\"http:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/ThingSpeak_dashboard-640x419.png\" alt=\"\" width=\"640\" height=\"419\" srcset=\"https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/ThingSpeak_dashboard-640x419.png 640w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/ThingSpeak_dashboard-768x503.png 768w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/ThingSpeak_dashboard-1024x671.png 1024w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/ThingSpeak_dashboard-100x66.png 100w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/ThingSpeak_dashboard.png 1035w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><a href=\"https:\/\/thingspeak.com\/channels\/91414\">https:\/\/thingspeak.com\/channels\/91414<\/a><\/p>\n<h2>6. Dashboard \u0e17\u0e35\u0e48 feed \u0e08\u0e32\u0e01 ThingSpeak \u0e02\u0e36\u0e49\u0e19 netpie.io Freeboard<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2989\" src=\"http:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PM25_netpie_dashboard-640x474.png\" alt=\"\" width=\"640\" height=\"474\" srcset=\"https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PM25_netpie_dashboard-640x474.png 640w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PM25_netpie_dashboard-768x569.png 768w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PM25_netpie_dashboard-100x74.png 100w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2019\/02\/PM25_netpie_dashboard.png 977w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<h2>Next Step &#8230;<\/h2>\n<p>&#8211; \u0e17\u0e33 Shield \u0e2a\u0e33\u0e40\u0e23\u0e47\u0e08\u0e23\u0e39\u0e1b SHARP GP2Y1010AU0F + AM2302 \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a ESP32 (NODE32 LITE)<br \/>\n&#8211; \u0e17\u0e33 Box \u0e01\u0e31\u0e19\u0e19\u0e49\u0e33 \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e43\u0e2b\u0e49\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e19\u0e33\u0e44\u0e1b\u0e15\u0e34\u0e14\u0e15\u0e31\u0e49\u0e07\u0e15\u0e32\u0e21\u0e08\u0e38\u0e14\u0e15\u0e48\u0e32\u0e07\u0e46 \u0e44\u0e14\u0e49\u0e2a\u0e30\u0e14\u0e27\u0e01\u0e02\u0e36\u0e49\u0e19<br \/>\n&#8211; \u0e43\u0e0a\u0e49\u0e41\u0e1c\u0e07 Solar Cells \u0e21\u0e32\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e01\u0e31\u0e1a Battery 18650<br \/>\n&#8211; \u0e23\u0e32\u0e22\u0e07\u0e32\u0e19 \u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14 \u0e1c\u0e48\u0e32\u0e19 LINE Bot<br \/>\n&#8211; \u0e2a\u0e31\u0e48\u0e07\u0e1b\u0e31\u0e49\u0e21\u0e1e\u0e48\u0e19\u0e2b\u0e21\u0e2d\u0e01\u0e17\u0e33\u0e07\u0e32\u0e19 \u0e40\u0e21\u0e37\u0e48\u0e2d\u0e04\u0e48\u0e32 PM2.5 \u0e40\u0e01\u0e34\u0e19\u0e01\u0e33\u0e2b\u0e19\u0e14 \ud83d\ude42<\/p>\n<p><strong>Reference Links<\/strong><br \/>\n<a href=\"https:\/\/blog.netpie.io\/archives\/3028\">https:\/\/blog.netpie.io\/archives\/3028<\/a><br \/>\n<a href=\"https:\/\/www.instructables.com\/id\/How-to-Interface-With-Optical-Dust-Sensor\/\">https:\/\/www.instructables.com\/id\/How-to-Interface-With-Optical-Dust-Sensor\/<\/a><\/p>\n<p><strong>\u0e1b\u0e25. \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e43\u0e04\u0e23\u0e17\u0e35\u0e48\u0e2a\u0e19\u0e43\u0e08\u0e2d\u0e22\u0e32\u0e01\u0e17\u0e33\u0e1a\u0e49\u0e32\u0e07 \u0e2b\u0e23\u0e37\u0e2d\u0e2a\u0e07\u0e2a\u0e31\u0e22\u0e15\u0e23\u0e07\u0e44\u0e2b\u0e19 \u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16 post \u0e16\u0e32\u0e21\u0e44\u0e14\u0e49\u0e17\u0e35\u0e48 blog \u0e19\u0e35\u0e49\u0e44\u0e14\u0e49\u0e40\u0e25\u0e22\u0e04\u0e23\u0e31\u0e1a \ud83d\ude42<\/strong><\/p>\n<div class=\"fcbkbttn_buttons_block\" id=\"fcbkbttn_left\"><div class=\"fcbkbttn_like \"><fb:like href=\"https:\/\/ton.packetlove.com\/blog\/iot\/esp32-node32-lite-pm25-temperature-humidity-sensors-node.html\" action=\"like\" colorscheme=\"light\" layout=\"button_count\"  size=\"small\"><\/fb:like><\/div><div class=\"fb-share-button  \" data-href=\"https:\/\/ton.packetlove.com\/blog\/iot\/esp32-node32-lite-pm25-temperature-humidity-sensors-node.html\" data-type=\"button_count\" data-size=\"small\"><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>\u0e40\u0e19\u0e37\u0e48\u0e2d\u0e07\u0e43\u0e19\u0e27\u0e31\u0e19 ESP32 Day (03\/02\/2019) \u0e1c\u0e21\u0e40\u0e2d\u0e07\u0e44\u0e21\u0e48\u0e44\u0e14\u0e49\u0e44\u0e1b\u0e23\u0e48\u0e27\u0e21\u0e07\u0e32\u0e19\u0e17\u0e35\u0e48\u0e08\u0e31\u0e14\u0e01\u0e31\u0e19 \u0e40\u0e1e\u0e23\u0e32\u0e30\u0e15\u0e34\u0e14\u0e07\u0e32\u0e19\u0e2d\u0e37\u0e48\u0e19 \u0e41\u0e25\u0e30\u0e44\u0e14\u0e49 sensors \u0e27\u0e31\u0e14 PM2.5 \u0e21\u0e32\u0e1e\u0e2d\u0e14\u0e35 \u0e01\u0e47\u0e40\u0e25\u0e22\u0e21\u0e32\u0e17\u0e33 Sensers Node \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e27\u0e31\u0e14\u0e04\u0e48\u0e32 PM2.5 \u0e43\u0e19\u0e1a\u0e23\u0e34\u0e40\u0e27\u0e13\u0e17\u0e35\u0e48\u0e2d\u0e22\u0e39\u0e48\u0e2d\u0e32\u0e28\u0e31\u0e22 \u0e41\u0e25\u0e49\u0e27\u0e2a\u0e48\u0e07\u0e02\u0e36\u0e49\u0e19 thingspeak.com \u0e41\u0e25\u0e30 netpie.io freeboard \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e17\u0e33 Dashboard \u0e2a\u0e27\u0e22\u0e46 \u0e07\u0e32\u0e21\u0e46 \u0e41\u0e25\u0e30\u0e40\u0e1b\u0e47\u0e19\u0e1b\u0e23\u0e30\u0e42\u0e22\u0e0a\u0e19\u0e4c\u0e43\u0e19\u0e01\u0e32\u0e23\u0e23\u0e32\u0e22\u0e07\u0e32\u0e19\u0e04\u0e48\u0e32 PM2.5 \u0e17\u0e35\u0e48\u0e21\u0e35\u0e1b\u0e31\u0e0d\u0e2b\u0e32\u0e01\u0e31\u0e19\u0e2d\u0e22\u0e39\u0e48\u0e43\u0e19\u0e1b\u0e23\u0e30\u0e40\u0e17\u0e28\u0e44\u0e17\u0e22 \u0e15\u0e2d\u0e19\u0e19\u0e35\u0e49 \u0e43\u0e2b\u0e49\u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e19\u0e46 \u0e1e\u0e35\u0e48\u0e46 \u0e19\u0e49\u0e2d\u0e07\u0e46 \u0e44\u0e14\u0e49\u0e23\u0e31\u0e1a\u0e17\u0e23\u0e32\u0e1a\u0e01\u0e31\u0e19\u0e04\u0e23\u0e31\u0e1a &#8230; 1. \u0e2d\u0e38\u0e1b\u0e01\u0e23\u0e13\u0e4c \u0e41\u0e25\u0e30 stack \u0e17\u0e35\u0e48\u0e43\u0e0a\u0e49\u0e21\u0e35\u0e14\u0e31\u0e07\u0e19\u0e35\u0e49 &#8211; ESP32 (NODE32 LITE) 275 \u0e1a\u0e32\u0e17 [https:\/\/gravitechthai.com\/product_detail.php?d=3318] &#8211; SHARP GP2Y1010AU0F (PM2.5 Sensor) 137 \u0e1a\u0e32\u0e17 [https:\/\/shopee.co.th\/product\/59553004\/1361931900] [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1049],"tags":[1047,1043,1052,1051,1050,1053],"class_list":["post-2973","post","type-post","status-publish","format-standard","hentry","category-iot","tag-esp32","tag-linebot","tag-netpie","tag-node32lite","tag-pm2-5","tag-thingspeak"],"_links":{"self":[{"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/posts\/2973","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/comments?post=2973"}],"version-history":[{"count":26,"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/posts\/2973\/revisions"}],"predecessor-version":[{"id":3496,"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/posts\/2973\/revisions\/3496"}],"wp:attachment":[{"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/media?parent=2973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/categories?post=2973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/tags?post=2973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}