{"id":463,"date":"2018-09-02T22:50:47","date_gmt":"2018-09-02T13:50:47","guid":{"rendered":"https:\/\/windabaft.co.jp\/blog_ceo\/?p=463"},"modified":"2018-09-09T15:09:10","modified_gmt":"2018-09-09T06:09:10","slug":"%e3%83%80%e3%82%b9%e3%83%88%e3%82%bb%e3%83%b3%e3%82%b5%e3%83%bc-dsm501a%e3%81%a7pm1-0-%e3%81%a8-pm2-5-%e3%81%ae%e6%b8%ac%e5%ae%9a%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f-arduino-%e3%82%b9%e3%82%b1","status":"publish","type":"post","link":"https:\/\/windabaft.co.jp\/blog_ceo\/?p=463","title":{"rendered":"\u30c0\u30b9\u30c8\u30bb\u30f3\u30b5\u30fc DSM501A\u3067PM1.0 \u3068 PM2.5 \u306e\u6e2c\u5b9a\u3057\u3066\u307f\u305f Arduino \u30b9\u30b1\u30c3\u30c1\u30b3\u30fc\u30c9\u4ed8"},"content":{"rendered":"<p>\u30c0\u30b9\u30c8\u30bb\u30f3\u30b5\u30fcDSM501A\u3067PM1.0\uff08\u4ee5\u4e0a\u306e\uff09\u7c92\u5b50\u6570\u30ab\u30a6\u30f3\u30c8\u3057\u3066\u307f\u305f<\/p>\n<p>PM1.0\u3092\u8a08\u6e2c\u3067\u304d\u308b\u306e\u304b\uff1f\u3068\u601d\u3044\u304d\u3084<br \/>\nPM1.0\u4ee5\u4e0a\u306e\u30b5\u30a4\u30ba\u306e\u7c92\u5b50\u3092\u30ab\u30a6\u30f3\u30c8\u3067\u304d\u308b\u3088\u3068\u3044\u3046\u3082\u306e\u306e\u3088\u3046\u3060\u3002<\/p>\n<p>PWM\u51fa\u529b\u3055\u308c\u308b\u30d1\u30eb\u30b9\u3092\uff13\uff10\u79d2\u9593\u8a08\u6e2c\u3057\u3066\u3001\u305d\u306e\u4e2d\u3067LOW\u30d1\u30eb\u30b9\u5e45\u306e\u5168\u4f53\u306b\u5360\u3081\u308b\u6bd4\u7387\u304b\u3089<br \/>\n\u7c92\u5b50\u6570\u3092\u51fa\u3059\u3068\u3044\u3046\u3082\u306e\u3002<\/p>\n<p>\u3082\u3061\u308d\u3093\u3001\u30c7\u30fc\u30bf\u30b7\u30fc\u30c8\u306b\u30e1\u30fc\u30ab\u30fc\u5074\u304c<br \/>\n\u300cLow\u30d1\u30eb\u30b9\u5e45\u306e\u5360\u6709\u7387\u306b\u5bfe\u3059\u308b\u7c92\u5b50\u6570\u300d<br \/>\n\u306e\u30b0\u30e9\u30d5\u3092\u7528\u610f\u3057\u3066\u304f\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u305d\u306e\u30b0\u30e9\u30d5\u3092\u5143\u306b\u7c92\u5b50\u6570\u51fa\u3057\u3066\u308b\u3002<br \/>\n\uff08\u5408\u3063\u3066\u3044\u308b\u306e\u304b\uff1f\uff09<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001\u3044\u308d\u3093\u306a\u6240\u3067\u8a08\u6e2c\u3057\u3066\u307f\u3066\u3001\u81ea\u5206\u3067\u3082<br \/>\n\u3053\u306e\u5024\u304b\u3089\u306f\u7a7a\u6c17\u304c\u60aa\u305d\u3046\u3060\u3068\u3044\u3046\u30c7\u30fc\u30bf\u3092\u3068\u3063\u305f\u307b\u3046\u304c\u826f\u3055\u305d\u3046\u306a\u6c17\u3082\u3059\u308b\u3002<\/p>\n<p>\u30d4\u30f3\u914d\u7f6e\u306f\u4e0b\u8a18\u3067\u5de6\u304b\u3089Pin1\uff5ePin5<\/p>\n<p>Pin1: \u30b3\u30f3\u30c8\u30ed\u30fc\u30eb(Vout1\u7528\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb)<br \/>\nPin2: Vout2 (PM1.0\u4ee5\u4e0a\u8a08\u6e2c\u7528)<br \/>\nPin3: VCC<br \/>\nPin4: Vout1\u00a0 (PM2.5\u4ee5\u4e0a\u8a08\u6e2c\u7528)<br \/>\nPin5: GND<\/p>\n<p><a href=\"https:\/\/windabaft.co.jp\/blog_ceo\/wp-content\/uploads\/2018\/09\/DSM501.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-467\" src=\"https:\/\/windabaft.co.jp\/blog_ceo\/wp-content\/uploads\/2018\/09\/DSM501.jpg\" alt=\"\" width=\"285\" height=\"179\" \/><\/a><\/p>\n<p>\u4ee5\u4e0b\u304c\u4eca\u56de\u4f7f\u3063\u305fArduino\u7528\u30b9\u30b1\u30c3\u30c1\u30b3\u30fc\u30c9<\/p>\n<pre class=\"lang:default decode:true \">\/\/ DSM501A Pin3 \u2192 Arduino 5V\r\n\/\/ DSM501A Pin5 \u2192 Arduino GND\r\n\/\/ PM1.0\u4ee5\u4e0a\u3092\u8a08\u6e2c\u3057\u305f\u3044\u5834\u5408\uff1aDSM501A Pin2 \u2192 Arduino D8\r\n\/\/ PM2.5\u4ee5\u4e0a\u3092\u8a08\u6e2c\u3057\u305f\u3044\u5834\u5408\uff1aDSM501A Pin4 \u2192 Arduino D8\r\n\/\/ Wind Abaft Co., Ltd.\r\n\r\n#include&lt;string.h&gt;\r\nbyte buff[2];\r\nint pin = 8;\/\/DSM501A input D8\r\nunsigned long duration;\r\nunsigned long starttime;\r\nunsigned long endtime;\r\nunsigned long sampletime_ms = 30000; \/\/ \u30c7\u30fc\u30bf\u30b7\u30fc\u30c8\u306e\u8a08\u6e2c\u65b9\u6cd5\u304c30\u79d2\u306e\u305f\u3081\r\nunsigned long lowpulseoccupancy = 0;\r\nfloat ratio = 0;\r\nfloat concentration = 0;\r\n \r\nint i=0;\r\nvoid setup()\r\n{\r\n  Serial.begin(9600);\r\n  pinMode(8,INPUT);\r\n  starttime = millis(); \r\n}\r\nvoid loop()\r\n{\r\n  duration = pulseIn(pin, LOW);\r\n  lowpulseoccupancy += duration;\r\n  endtime = millis();\r\n  if ((endtime-starttime) &gt; sampletime_ms)\r\n  {\r\n    ratio = (lowpulseoccupancy-endtime+starttime + sampletime_ms)\/(sampletime_ms*10.0);  \/\/ Integer percentage 0=&gt;100\r\n    concentration = 1.1*pow(ratio,3)-3.8*pow(ratio,2)+520*ratio+0.62; \/\/ \u30c7\u30fc\u30bf\u30b7\u30fc\u30c8\u306e\u30b0\u30e9\u30d5\u53c2\u7167\r\n    Serial.print(\"low\u30d1\u30eb\u30b9\u5e45(30\u79d2\u9593):\");\r\n    Serial.print(lowpulseoccupancy);\r\n    Serial.print(\"    Low\u30d1\u30eb\u30b9\u5e45\u306e\u5360\u6709\u7387[%]:\");\r\n    Serial.print(ratio);\r\n    Serial.print(\"    DSM501A\u8a08\u6e2c\u7c92\u5b50\u6570[pcs\/283ml]:\");\r\n    Serial.println(concentration);\r\n    lowpulseoccupancy = 0;\r\n    starttime = millis();\r\n  } \r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30c0\u30b9\u30c8\u30bb\u30f3\u30b5\u30fcDSM501A\u3067PM1.0\uff08\u4ee5\u4e0a\u306e\uff09\u7c92\u5b50\u6570\u30ab\u30a6\u30f3\u30c8\u3057\u3066\u307f\u305f PM1.0\u3092\u8a08\u6e2c\u3067\u304d\u308b\u306e\u304b\uff1f\u3068\u601d\u3044\u304d\u3084 PM1.0\u4ee5\u4e0a\u306e\u30b5\u30a4\u30ba\u306e\u7c92\u5b50\u3092\u30ab\u30a6\u30f3\u30c8\u3067\u304d\u308b\u3088\u3068\u3044\u3046\u3082\u306e\u306e\u3088\u3046\u3060\u3002 PWM\u51fa\u529b\u3055\u308c\u308b\u30d1\u30eb\u30b9\u3092\uff13\uff10\u79d2\u9593\u8a08\u6e2c\u3057 &hellip; <a href=\"https:\/\/windabaft.co.jp\/blog_ceo\/?p=463\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">\u30c0\u30b9\u30c8\u30bb\u30f3\u30b5\u30fc DSM501A\u3067PM1.0 \u3068 PM2.5 \u306e\u6e2c\u5b9a\u3057\u3066\u307f\u305f Arduino \u30b9\u30b1\u30c3\u30c1\u30b3\u30fc\u30c9\u4ed8<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":468,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[17,18],"tags":[],"class_list":["post-463","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-raspberrypi"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/posts\/463","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=463"}],"version-history":[{"count":5,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/posts\/463\/revisions"}],"predecessor-version":[{"id":470,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/posts\/463\/revisions\/470"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/media\/468"}],"wp:attachment":[{"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}