{"id":2004,"date":"2018-07-27T13:24:11","date_gmt":"2018-07-27T04:24:11","guid":{"rendered":"http:\/\/research.itplants.com\/?p=2004"},"modified":"2018-07-27T13:29:21","modified_gmt":"2018-07-27T04:29:21","slug":"iaq-core-cvoc-sensor","status":"publish","type":"post","link":"https:\/\/research.itplants.com\/?p=2004","title":{"rendered":"iAQ-Core C(VOC) Sensor"},"content":{"rendered":"<p>ams\u793e\u304b\u3089\u3001\u30b5\u30f3\u30d7\u30eb\u3067\u9001\u3063\u3066\u3082\u3089\u3063\u305f\u3001iAQ-Core C\u30bb\u30f3\u30b5\u30fc\u3092\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>I2C\u30bb\u30f3\u30b5\u30fc\u3067\u3059\u3002\u30a2\u30c9\u30ec\u30b9\u306f0x5a\u3067\u3059\u3002<\/p>\n<p>\u4e0b\u8a18\u30b3\u30fc\u30c9\u306f\u3001\u30bb\u30f3\u30b5\u30fc\u304b\u3089\uff11\u79d2\u304a\u304d\u306b\u5024\u3092\u8aad\u307f\u51fa\u3059python\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u3059\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n#!\/usr\/bin\/env python\r\nimport pigpio\r\nimport time,sys,datetime\r\n\r\npi = pigpio.pi()\r\nif not pi.connected:\r\n   exit()\r\n\r\nh = pi.i2c_open(1, 0x5a)\r\n\r\nwhile True:\r\n    try:\r\n        c, d = pi.i2c_read_device(h, 9)\r\n        length=len(d)\r\n        if length != 9:\r\n            continue\r\n        print('time ='+str(datetime.datetime.today()))\r\n        prediction=d&#x5B;0]*pow(2,8)+d&#x5B;1]\r\n        print('eCO2 = '+str(prediction)+' ppm')\r\n        if d&#x5B;2] == 0:\r\n            status='OK'\r\n        if d&#x5B;2] == 0x01:\r\n        prediction=d&#x5B;0]*pow(2,8)+d&#x5B;1]\r\n        print('eCO2 = '+str(prediction)+' ppm')\r\n        if d&#x5B;2] == 0:\r\n            status='OK'\r\n        if d&#x5B;2] == 0x01:\r\n            status='BUSY'\r\n        if d&#x5B;2] == 0x10:\r\n            status='RUNIN'\r\n        if d&#x5B;2] == 0x80:\r\n            status='BUSY'\r\n\r\n        if status == 'OK':\r\n            print('status = '+str(status))\r\n            resistance = d&#x5B;4]*pow(2,16)+d&#x5B;5]*pow(2,8)+d&#x5B;6]\r\n            print('resistance = '+str(resistance)+' Ohm')\r\n            eTVOC= d&#x5B;7]*pow(2,8)+d&#x5B;8]\r\n            print(' eTVOC = '+str(eTVOC)+' ppb')\r\n            #time.sleep(4)\r\n        time.sleep(1)\r\n    except KeyboardInterrupt:\r\n        pi.i2c_close(h)\r\n        pi.stop()\r\n        sys.exit(0)\r\n<\/pre>\n<p>thingspeak\u3067\u30b0\u30e9\u30d5\u5316\u3057\u305f\u7d50\u679c\u3067\u3059\u3002\u591a\u5c11\u306e\u30d0\u30e9\u30c4\u30ad\u306f\u3042\u308a\u307e\u3059\u304c\u3001CS811\u3088\u308a\u3082\u5b89\u5b9a\u3057\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u3002<br \/>\n\u5185\u90e8\u306b\u6e29\u5ea6\u30bb\u30f3\u30b5\u30fc\u3092\u6301\u3063\u3066\u3044\u308b\u3088\u3046\u3067\u3001\u6e29\u5ea6\u88dc\u511f\u306f\u5fc5\u8981\u3042\u308a\u307e\u305b\u3093\u3002\u30d0\u30fc\u30a4\u30f3\u3082\u4e0d\u8981\u306e\u3088\u3046\u3067\u3059\u3002<\/p>\n<p><a href=\"https:\/\/research.itplants.com\/wp\/wp-content\/uploads\/2018\/07\/da983064ffa114a29ac0017ff5a66710.jpg\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-2009\" src=\"https:\/\/research.itplants.com\/wp\/wp-content\/uploads\/2018\/07\/da983064ffa114a29ac0017ff5a66710.jpg\" alt=\"\" width=\"932\" height=\"594\" srcset=\"https:\/\/research.itplants.com\/wp\/wp-content\/uploads\/2018\/07\/da983064ffa114a29ac0017ff5a66710.jpg 932w, https:\/\/research.itplants.com\/wp\/wp-content\/uploads\/2018\/07\/da983064ffa114a29ac0017ff5a66710-300x191.jpg 300w, https:\/\/research.itplants.com\/wp\/wp-content\/uploads\/2018\/07\/da983064ffa114a29ac0017ff5a66710-768x489.jpg 768w, https:\/\/research.itplants.com\/wp\/wp-content\/uploads\/2018\/07\/da983064ffa114a29ac0017ff5a66710-320x204.jpg 320w\" sizes=\"(max-width: 932px) 100vw, 932px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ams\u793e\u304b\u3089\u3001\u30b5\u30f3\u30d7\u30eb\u3067\u9001\u3063\u3066\u3082\u3089\u3063\u305f\u3001iAQ-Core C\u30bb\u30f3\u30b5\u30fc\u3092\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002 I2C\u30bb\u30f3\u30b5\u30fc\u3067\u3059\u3002\u30a2\u30c9\u30ec\u30b9\u306f0x5a\u3067\u3059\u3002 \u4e0b\u8a18\u30b3\u30fc\u30c9\u306f\u3001\u30bb\u30f3\u30b5\u30fc\u304b\u3089\uff11\u79d2\u304a\u304d\u306b\u5024\u3092\u8aad\u307f\u51fa\u3059python\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u3059\u3002 #!\/u&#8230;<\/p>\n<p><a class=\"more\" href=\"https:\/\/research.itplants.com\/?p=2004\"> Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":2005,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/research.itplants.com\/index.php?rest_route=\/wp\/v2\/posts\/2004"}],"collection":[{"href":"https:\/\/research.itplants.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/research.itplants.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/research.itplants.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/research.itplants.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2004"}],"version-history":[{"count":4,"href":"https:\/\/research.itplants.com\/index.php?rest_route=\/wp\/v2\/posts\/2004\/revisions"}],"predecessor-version":[{"id":2010,"href":"https:\/\/research.itplants.com\/index.php?rest_route=\/wp\/v2\/posts\/2004\/revisions\/2010"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/research.itplants.com\/index.php?rest_route=\/wp\/v2\/media\/2005"}],"wp:attachment":[{"href":"https:\/\/research.itplants.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2004"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/research.itplants.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2004"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/research.itplants.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}