{"id":1242,"date":"2014-01-05T06:56:30","date_gmt":"2014-01-04T21:56:30","guid":{"rendered":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/?p=1242"},"modified":"2014-02-03T06:25:54","modified_gmt":"2014-02-02T21:25:54","slug":"beaglebone-black-4","status":"publish","type":"post","link":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/2014\/01\/beaglebone-black-4\/","title":{"rendered":"<!--:ja-->BeagleBone Black \u306e\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2\u30cf\u30c3\u30af(4)<!--:--><!--:en-->Hacking BeagleBone Black, part 4<!--:-->"},"content":{"rendered":"<p><!--:ja-->\u30b7\u30ea\u30fc\u30ba\u7b2c\uff14\u5f3e\u306fBeagleBone Black\u306b\u30a2\u30ca\u30ed\u30b0\u30bb\u30f3\u30b5\u3092\u4ed8\u3051\u307e\u3059<\/p>\n<div id=\"attachment_1244\" style=\"width: 403px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/morecatlab.akiba.coocan.jp\/lab\/wp-content\/uploads\/2014\/01\/BBB-Sensor01.jpg\"><img aria-describedby=\"caption-attachment-1244\" loading=\"lazy\" class=\"size-medium wp-image-1244\" title=\"BBB-Sensor01\" src=\"http:\/\/morecatlab.akiba.coocan.jp\/lab\/wp-content\/uploads\/2014\/01\/BBB-Sensor01-393x300.jpg\" alt=\"BBB\u306b\u53d6\u308a\u4ed8\u3051\u305f\u30a2\u30ca\u30ed\u30b0\u30bb\u30f3\u30b5\" width=\"393\" height=\"300\" srcset=\"http:\/\/morecatlab.akiba.coocan.jp\/lab\/wp-content\/uploads\/2014\/01\/BBB-Sensor01-393x300.jpg 393w, http:\/\/morecatlab.akiba.coocan.jp\/lab\/wp-content\/uploads\/2014\/01\/BBB-Sensor01.jpg 1024w\" sizes=\"(max-width: 393px) 100vw, 393px\" \/><\/a><p id=\"caption-attachment-1244\" class=\"wp-caption-text\">BBB\u306b\u53d6\u308a\u4ed8\u3051\u305f\u30a2\u30ca\u30ed\u30b0\u30bb\u30f3\u30b5<\/p><\/div>\n<h2><!--:--><!--more--><!--:ja-->1. \u306f\u3058\u3081\u306b<\/h2>\n<p>BBB\u306b\u306f\u30a2\u30ca\u30ed\u30b0\u5165\u529b\u30dd\u30fc\u30c8\u304c7\u30dd\u30fc\u30c8\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>AD\u5909\u63db\u306e\u5b66\u7fd2\u3082\u517c\u306d\u3066\u3001\u30a2\u30ca\u30ed\u30b0\u30dd\u30fc\u30c8\u306b\u6e29\u5ea6\u8a08\u3068\u5149\u30bb\u30f3\u30b5\u3092\u4ed8\u3051\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u5143\u30cd\u30bf\u306fAdafruit\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306e\u4ee5\u4e0b\u306e\uff12\u3064\u3067\u3059\u3002<\/p>\n<p><a href=\"http:\/\/learn.adafruit.com\/measuring-light-with-a-beaglebone-black\">Measuring Light with a Beaglebone Black<\/a><\/p>\n<p><a href=\"http:\/\/learn.adafruit.com\/measuring-temperature-with-a-beaglebone-black\">Measuring Temperature with a Beaglebone Black<\/a><\/p>\n<h2>2. \u30a2\u30ca\u30ed\u30b0\u30dd\u30fc\u30c8\uff08AD\u5909\u63db\u5668\uff09\u306e\u4ed5\u69d8<\/h2>\n<p>\u307e\u305a\u3001AD\u5909\u63db\u5668\u306e\u4ed5\u69d8\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li>AIN0- AIN6\u306e7\u30dd\u30fc\u30c8\u304c\u5229\u7528\u53ef\u80fd<\/li>\n<li>12bit A\/D\u5909\u63db\u5668<\/li>\n<li>\u96fb\u5727\u30ec\u30f3\u30b8\u306f0-1.8V (\u6ce8\u610f\uff01\uff09<\/li>\n<li>VDD_ADC\u3068\u3044\u3046\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u96fb\u5727\u304c\u51fa\u3066\u3044\u308b<\/li>\n<\/ul>\n<p>\u7279\u306b\u3001\u96fb\u5727\u30ec\u30f3\u30b8\u304c1.8V\u307e\u3067\u3068\u8a00\u3046\u70b9\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<h2>3. \u5229\u7528\u3057\u305f\u30bb\u30f3\u30b5\u3068\u56de\u8def\u56f3<\/h2>\n<h3>3.1 \u6e29\u5ea6\u30bb\u30f3\u30b5<\/h3>\n<p>Adafruit\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u30a2\u30ca\u30ed\u30b0\u30c7\u30d0\u30a4\u30bb\u30ba\u306eTMP36\u3068\u3044\u3046\u30bb\u30f3\u30b5IC\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002\u624b\u6301\u3061\u306e\u95a2\u4fc2\u3067\u3001\u985e\u4f3c\u306eMCP9700\u3092\u4f7f\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\uff08\u3053\u306e\u30bb\u30f3\u30b5\u6a5f\u5668\u306e\u5185\u90e8\u6e29\u5ea6\u306e\u6e2c\u5b9a\u7528\u3089\u3057\u304f\u30010-70\u2103\u7bc4\u56f2\u3067\u00b14\u2103\u3068\u30d0\u30e9\u30c4\u30ad\u304c\u5927\u304d\u3044\u3067\u3059\u3002\u65b0\u898f\u306b\u8cfc\u5165\u3059\u308b\u5834\u5408\u306f\u3001TMP36\u306b\u3059\u3079\u304d\u3067\u3059\u3002\uff09<\/p>\n<h3>3.2 \u7167\u5ea6\u30bb\u30f3\u30b5<\/h3>\n<p>\u307e\u305f\u3001CdS\u3082\u79cb\u6708\u306e\u5e97\u982d\u3067\u8cfc\u5165\u3057\u305f\u4ed5\u69d8\u4e0d\u660e\u54c1\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<div id=\"attachment_1194\" style=\"width: 410px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/morecatlab.akiba.coocan.jp\/lab\/wp-content\/uploads\/2014\/01\/BBB-SENSOR1.png\"><img aria-describedby=\"caption-attachment-1194\" loading=\"lazy\" class=\"size-medium wp-image-1194\" title=\"BBB-SENSOR1\" src=\"http:\/\/morecatlab.akiba.coocan.jp\/lab\/wp-content\/uploads\/2014\/01\/BBB-SENSOR1-400x200.png\" alt=\"Schematic of Sensor\" width=\"400\" height=\"200\" srcset=\"http:\/\/morecatlab.akiba.coocan.jp\/lab\/wp-content\/uploads\/2014\/01\/BBB-SENSOR1-400x200.png 400w, http:\/\/morecatlab.akiba.coocan.jp\/lab\/wp-content\/uploads\/2014\/01\/BBB-SENSOR1.png 1024w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><p id=\"caption-attachment-1194\" class=\"wp-caption-text\">Schematic of Sensor<\/p><\/div>\n<p>\u63a5\u7d9a\u306f\u56f3\u306e\u901a\u308a\u3067\u3059\u3002\u30b1\u30fc\u30d7\u306eP9\u8fd1\u304f\u306e\u8868\u5074\u306b\u306a\u308b\u3079\u304f\u5e73\u5766\u306b\u306a\u308b\u3088\u3046\u306b\u914d\u7f6e\u3057\u307e\u3057\u305f\u3002<\/p>\n<h2>4. \u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u306e\u8a2d\u5b9a<\/h2>\n<p>\u6b21\u306e\u30da\u30fc\u30b8\u306bADC\u3092\u4f7f\u3046\u305f\u3081\u306e\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u306e\u8a2d\u5b9a\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/beaglebone.cameon.net\/home\/reading-the-analog-inputs-adc\">BeagleBone Reading the analog input (ADC) <\/a><\/p>\n<p>\u30aa\u30ea\u30b8\u30ca\u30eb\u306eBeagleBone\u3068BBB\u3067\u306fkernel\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u7570\u306a\u308b\u305f\u3081\u3001\u64cd\u4f5c\u304c\u7570\u306a\u308a\u307e\u3059\u3002BBB\u3067\u306fCape Manager\u3092\u8a2d\u5b9a\u3059\u308c\u3070\u826f\u3044\u69d8\u3067\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\r\nroot@beaglebone:~# echo cape-bone-iio &gt; \/sys\/devices\/bone_capemgr.9\/slots\r\nroot@beaglebone:~# find \/sys\/ -name '*AIN*'\r\n\/sys\/devices\/ocp.3\/helper.15\/AIN0\r\n\/sys\/devices\/ocp.3\/helper.15\/AIN1\r\n\/sys\/devices\/ocp.3\/helper.15\/AIN2\r\n\/sys\/devices\/ocp.3\/helper.15\/AIN3\r\n\/sys\/devices\/ocp.3\/helper.15\/AIN4\r\n\/sys\/devices\/ocp.3\/helper.15\/AIN5\r\n\/sys\/devices\/ocp.3\/helper.15\/AIN6\r\n\/sys\/devices\/ocp.3\/helper.15\/AIN7\r\nroot@beaglebone:~# cat \/sys\/devices\/ocp.3\/helper.15\/AIN1\r\n703\r\n\r\n<\/pre>\n<p>\u30c7\u30d0\u30a4\u30b9\u7d4c\u7531\u306e\u30a2\u30af\u30bb\u30b9\u65b9\u6cd5\u3067\u3042\u308c\u3070\u3001\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u306a\u3069\u304b\u3089\u7c21\u5358\u306b\u30a2\u30ca\u30ed\u30b0\u5165\u529b\u3092\u884c\u3046\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001Adafruit\u306e\u63d0\u4f9b\u3057\u3066\u3044\u308bpython\u7528\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3046\u3068\u66f4\u306b\u7c21\u5358\u3067\u3059\u3002\u5177\u4f53\u7684\u306a\u64cd\u4f5c\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u3001\u4ee5\u4e0b\u306e\u30da\u30fc\u30b8\u3092\u53c2\u7167\u4e0b\u3055\u3044\u3002<\/p>\n<p><a href=\"http:\/\/learn.adafruit.com\/setting-up-io-python-library-on-beaglebone-black\">Setting up io python library on Beaglebone Black<\/a><\/p>\n<p>\u6e29\u5ea6\u30bb\u30f3\u30b5\u3001\u7167\u5ea6\u30bb\u30f3\u30b5\u306e\u5024\u3092\u8aad\u307f\u53d6\u3063\u3066\uff11\u56de\u3060\u3051\u8868\u793a\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n#! \/usr\/bin\/python\r\nimport Adafruit_BBIO.ADC as ADC\r\nimport time\r\n\r\ntmp_pin = 'P9_40'\r\ncds_pin = 'P9_38'\r\n\r\nADC.setup()\r\n\r\nreading = ADC.read(tmp_pin)\r\nmillivolts = reading * 1800 # 1.8V reference = 1800 mV\r\ntemp_c = (millivolts - 500) \/ 10\r\ntemp_f = (temp_c * 9\/5) + 32\r\nreading = ADC.read(cds_pin)\r\nvolts = reading * 100\r\nprint('%dC L%d%%' % (temp_c, volts)),\r\n<\/pre>\n<p>\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u304b\u3089\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nroot@beaglebone:~# python sensor1.py\r\n29C L87%\r\n\r\n<\/pre>\n<p>\uff08\u7d9a\u304f\uff09<!--:--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30b7\u30ea\u30fc\u30ba\u7b2c\uff14\u5f3e\u306fBeagleBone Black\u306b\u30a2\u30ca\u30ed\u30b0\u30bb\u30f3\u30b5\u3092\u4ed8\u3051\u307e\u3059<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18,7],"tags":[],"_links":{"self":[{"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/posts\/1242"}],"collection":[{"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/comments?post=1242"}],"version-history":[{"count":17,"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/posts\/1242\/revisions"}],"predecessor-version":[{"id":1330,"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/posts\/1242\/revisions\/1330"}],"wp:attachment":[{"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/media?parent=1242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/categories?post=1242"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/tags?post=1242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}