{"id":2029,"date":"2013-05-07T18:49:31","date_gmt":"2013-05-07T09:49:31","guid":{"rendered":"http:\/\/www.pinewell.jp\/wordpress\/?p=2029"},"modified":"2013-05-07T18:49:31","modified_gmt":"2013-05-07T09:49:31","slug":"%e3%82%a6%e3%82%a7%e3%82%b6%e3%83%bc%e3%83%a1%e3%83%bc%e3%82%bf%e3%83%bc","status":"publish","type":"post","link":"http:\/\/www.pinewell.jp\/wordpress\/?p=2029","title":{"rendered":"\u30a6\u30a7\u30b6\u30fc\u30e1\u30fc\u30bf\u30fc"},"content":{"rendered":"<p>\u6c17\u306b\u306a\u3063\u3066\u3044\u305fstrawberrylinux\u306e\u30a6\u30a7\u30b6\u30fc\u30e1\u30fc\u30bf\u30fc\u3002<\/p>\n<p><a title=\"\u30a6\u30a7\u30b6\u30fc\u30e1\u30fc\u30bf\u30fc\" href=\"https:\/\/strawberry-linux.com\/catalog\/items?code=18078\">https:\/\/strawberry-linux.com\/catalog\/items?code=18078<\/a><\/p>\n<p>Sparkfun\u672c\u56fd\u306e\u30b5\u30a4\u30c8\u3067arduino\u306e\u30b9\u30b1\u30c3\u30c1\u3092\u767a\u898b\u3057\u305f\u306e\u3068\u3001DHT22\u3092\u8ffd\u52a0\u767a\u6ce8\u3057\u305f\u306e\u3067\u3064\u3044\u3067\u306b\u6ce8\u6587\u3057\u3066\u307f\u305f\u3002<\/p>\n<p>\u3055\u3063\u305d\u304f\u3064\u306a\u3044\u3067\u307f\u305f\u304c\u3001\u30b9\u30b1\u30c3\u30c1\u3067\u306f\u306a\u305c\u304b\u98a8\u5411\u304d\u304c\u9006\u65b9\u5411\u3067\u51fa\u529b\u3055\u308c\u308b\u3002<\/p>\n<p>\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u898b\u308b\u306816\u65b9\u5411\u306e\u6642\u306b\u5f97\u3089\u308c\u308b\u62b5\u6297\u5024\u304c\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u8abf\u3079\u3066\u307f\u308b\u3068\u3001\u82e5\u5e72\u306e\u76f8\u9055\uff1f\u3068\u3044\u3046\u304b\u8aa4\u5dee\u30ec\u30d9\u30eb\u306e\u62b5\u6297\u5024\u3082\u51fa\u529b\u3055\u308c\u3066\u3044\u308b\u3088\u3046\u3060\u3002<\/p>\n<style><!--\nBODY,DIV,TABLE,THEAD,TBODY,TFOOT,TR,TH,TD,P { font-family:\"VL P\u30b4\u30b7\u30c3\u30af\"; font-size:x-small }\n--><\/style>\n<table style=\"width: 121px; height: 336px;\" border=\"0\" cellspacing=\"0\">\n<colgroup width=\"68\"><\/colgroup>\n<tbody>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">\u62b5\u6297\u5024<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">\u65b9\u89d2<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">15<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">ESE<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">16<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">ESE<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">20<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">E<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">22<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">E<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">23<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">E<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">31<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">SSE<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">45<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">SE<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">46<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">SE<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">60<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">SSW<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">61<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">SSW<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">71<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">S<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">101<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">NNE<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">115<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">NE<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">150<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">WSW<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">157<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">SW<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">158<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">SW<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">176<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">NNW<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">196<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">N<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">197<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">N<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">207<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">WNW<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">222<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">NW<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">236<\/span><\/td>\n<td align=\"RIGHT\" height=\"13\"><span style=\"font-family: Liberation Sans;\">W<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u3053\u306e\u307e\u307e\u5f97\u3089\u308c\u305f\u62b5\u6297\u5024\u3092\u30b7\u30ea\u30a2\u30eb\u306b\u51fa\u529b\u3057\u3066\u3001PHP\u3067\u65b9\u89d2\u306b\u5909\u63db\u3057\u305f\u307b\u3046\u304c\u697d\u3067\u3042\u308d\u3046\u3002<\/p>\n<p lang=\"zxx\">\u98a8\u901f\u306f <span style=\"font-family: Times New Roman,serif;\">1.492 MPh \/ hz \u3060\u305d\u3046\u3060\u3002 <strong>1\u30de\u30a4\u30eb\uff1d\uff11\uff0e\uff16\uff10\uff19\uff13\uff14\u30ad\u30ed<\/strong>\u3060\u304b\u3089\uff1f \u7d042.4km\u304b\u3002\u65e5\u672c\u3067\u306f\u666e\u901a\u98a8\u901f\u306fm\/s\u306a\u306e\u3067\u3001\u00f760\u306e\u00f760\u30022400m\/60\/60=0.66666m\u3002<br \/>\n<\/span><\/p>\n<p lang=\"zxx\">1\u79d2\u304b\u3051\u30661\u5468\u3055\u305b\u308c\u30700.67m\u3063\u3066\u3053\u3068\u304b\u3002\u4eee\u306b5\u79d2\u7f6e\u304d\u306b\u8a08\u6e2c\u3059\u308b\u3068\u3057\u30665\u79d2\u9593\u306720\u5468\u3057\u305f\u3089\uff1f1\u79d2\u9593\u306b4\u5468=0.67*4=2.68m\/s\u304b\u3002<\/p>\n<p lang=\"zxx\">\u5225\u306e\u3068\u3053\u308d\u304b\u3089\u62fe\u3063\u3066\u304d\u305f\u30b3\u30fc\u30c9\u3067\u306f\u3001km\/h\u306e\u8a08\u7b97\u3067\u3001\u4e0b\u8a18\u306e\u901a\u308a\u3002<\/p>\n<p lang=\"zxx\">WindSpeed = (numRevsAnemometer\/ 5) * 2.4; \/\/2.4 K\/h for one switch closure per second\u3000\u3063\u3066\u306a\u3063\u3066\u3044\u308b\u304b\u3089\u300120 \/5 * 2.4\u00a0 k\/h = 9.6 k\/h = 2.66666666m\u3002<\/p>\n<p lang=\"zxx\">\u3046\u3093\u3001\u3042\u3063\u3066\u3044\u308b\u3002\u3053\u308c\u3082\u6307\u5b9a\u79d2\u9593\u3042\u305f\u308a\u306e\u56de\u8ee2\u6570\u3092\u51fa\u529b\u3055\u305b\u3066\u3057\u307e\u3048\u3070\u826f\u3044\u304b\u3002\u8a08\u7b97\u306f\u6bcd\u8266\u3067\u3002<\/p>\n<p lang=\"zxx\">\u3067\u3001\u30b9\u30b1\u30c3\u30c1<\/p>\n<p lang=\"zxx\">\n<pre lang=\"c\" >\n\/* Arduino sketch for Weather device from Sparkfun.\n\u3053\u308c\u306f\u30cd\u30c3\u30c8\u3067\u62fe\u3063\u305f\u30b9\u30b1\u30c3\u30c1\u3092\u6539\u4fee\u3057\u3066\u3044\u307e\u3059\u3002\n\u79c1\u306e\u30aa\u30ea\u30b8\u30ca\u30eb\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\n=========================================================\nANEMOMETER\n=========================================================\n\u98a8\u901f\u8a08\u306fgnd\u30682\u756a\u30d4\u30f3\u306b\u3064\u306a\u3050\u3002\n\u30d1\u30eb\u30b9\u3092\u62fe\u3046\u305f\u3081\u306b attachInterrupt\u3000\u304c\u3067\u304d\u308b\u30d4\u30f3\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002\n1\u30d1\u30eb\u30b9 = 0.67m\/s \u3068\u306a\u308b\u3002\n\u521d\u671f\u5024\u3067\u306f5\u79d2\u3042\u305f\u308a\u306e\u56de\u8ee2\u6570\u3092\u51fa\u529b\u3059\u308b\u3002\n\u98a8\u901f\u8a08\u306f\u30e2\u30b8\u30e5\u30e9\u30fc\u306e4\u30d4\u30f3\u306e\u5185\u30012\u756a\u30683\u756a\uff08\u5185\u5074\uff09\u3002\n\u6975\u6027\u306f\u306a\u3055\u305d\u3046\u3002\n=========================================================\nWIND DIRECTION VANE\n=========================================================\n\u98a8\u5411\u8a08\n\u30e2\u30b8\u30e5\u30e9\u30fc\u306e1\u756a\u30684\u756a\uff08\u5916\u5074\uff09\u3002\u6975\u6027\u306f\u306a\u3055\u305d\u3046\u3002\n10k\u306e\u62b5\u6297\u3092\u4e0e\u3048\u3066\u4e0b\u56f3\u306e\u3088\u3046\u306b\u63a5\u7d9a\u3002\n\u98a8\u5411\u306b\u5fdc\u3058\u3066\u62b5\u6297\u5024\u304c\u8fd4\u3063\u3066\u304f\u308b\u306e\u3067\u305d\u308c\u3092\u5909\u63db\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002\n\uff08\u30a2\u30ca\u30ed\u30b0\u3068\u3044\u3063\u3066\u3082\u98a8\u5411\u3067\u8fd4\u3063\u3066\u304f\u308b\u5024\u306f\u6c7a\u307e\u3063\u3066\u3044\u308b\uff09\n\u5b9f\u6e2c\u3067\u306f\u3053\u3093\u306a\u611f\u3058\u3060\u3063\u305f\u3002\n\u62b5\u6297\u5024\t\u65b9\u89d2\n15\tESE\n16\tESE\n20\tE\n22\tE\n23\tE\n31\tSSE\n45\tSE\n46\tSE\n60\tSSW\n61\tSSW\n71\tS\n101\tNNE\n115\tNE\n150\tWSW\n157\tSW\n158\tSW\n176\tNNW\n196\tN\n197\tN\n207\tWNW\n222\tNW\n236\tW\n\u914d\u7dda\u56f3\n                  +5V\n                   |\n                   <\n                   >     10K\n                   <   Resistor\n                   <\n                   >\n                   |\n Analog Pin 5------|\n                   |\n                   -----------| To weather vane\n                              | (mystery resistance)\n                   -----------|\n                   |\n                   |\n                 -----\n                  ---\n                   -\n*********************************************************************\/\n#define ulong unsigned long\n\n#define PIN_ANEMOMETER  2     \/\/ Digital 2 \u98a8\u901f\n#define PIN_VANE        5     \/\/ Analog 5 \u98a8\u5411\n\n\/\/ 5\u79d2\u7f6e\u304d\u306b\u51fa\u529b\n#define MSECS_CALC_WIND_SPEED 5000\n#define MSECS_CALC_WIND_DIR   5000\n\nvolatile int numRevsAnemometer = 0; \/\/ \u56de\u8ee2\u6570\nulong nextCalcSpeed;                \/\/ \u98a8\u901f\u3092\u6b21\u306b\u51fa\u529b\u3059\u308b\u6642\u9593\uff08\u3053\u306e\u79d2\u306b\u306a\u3063\u305f\u3089\u51fa\u529b\uff09\nulong nextCalcDir;                  \/\/ \u98a8\u5411\u304d\u3092\u6b21\u306b\u51fa\u529b\u3059\u308b\u6642\u9593\uff08\u3053\u306e\u79d2\u306b\u306a\u3063\u305f\u3089\u51fa\u529b\uff09\nulong time;                         \/\/ \u6642\u9593\u306e\u6d41\u308c\n\n\/\/=======================================================\n\/\/ \u521d\u671f\u5316\n\/\/=======================================================\nvoid setup() {\n   Serial.begin(9600);\n   pinMode(PIN_ANEMOMETER, INPUT);\n   digitalWrite(PIN_ANEMOMETER, HIGH);\n   attachInterrupt(0, countAnemometer, FALLING);   \/\/\u5272\u308a\u8fbc\u307f0=\u30d4\u30f32\u3000\u306e\u5272\u308a\u8fbc\u307f\u8a2d\u5b9a\n   nextCalcSpeed = millis() + MSECS_CALC_WIND_SPEED; \/\/\u6b21\u306e\u8a08\u6e2c\u306f\u73fe\u5728\u306e+5000\u30df\u30ea\u79d2\n   nextCalcDir   = millis() + MSECS_CALC_WIND_DIR;\n}\n\n\/\/=======================================================\n\/\/ \u30e1\u30a4\u30f3\u30eb\u30fc\u30d7\n\/\/=======================================================\nvoid loop() {\n   time = millis();\/\/\u73fe\u5728\u6642\u523b\u3092\u53d6\u5f97\n\n   if (time >= nextCalcSpeed) {  \/\/\u8a08\u6e2c\u6642\u9593\u306b\u306a\u3063\u305f\u3089\n      calcWindSpeed();\n      nextCalcSpeed = time + MSECS_CALC_WIND_SPEED; \/\/\u6b21\u306e\u8a08\u6e2c\u6642\u9593\u3092\u8a2d\u5b9a\n   }\n   if (time >= nextCalcDir) {\n      calcWindDir();\n      nextCalcDir = time + MSECS_CALC_WIND_DIR;\n   }\n}\n\n\/\/=======================================================\n\/\/\u98a8\u901f\u306e\u5272\u308a\u8fbc\u307f\u3002\u56de\u8ee2\u6570\u3092+1\n\/\/=======================================================\nvoid countAnemometer() {\n   numRevsAnemometer++;\n}\n\n\/\/=======================================================\n\/\/ \u98a8\u5411\u3092\u51fa\u529b\n\/\/=======================================================\nvoid calcWindDir() {\n   int val;\n   val = analogRead(PIN_VANE);\n   val >>=2;                        \/\/ Shift to 255 range(0~255\u306e\u5024\u306b\u3059\u308b\uff1f)\n   Serial.print(\"Dir:\");\n   Serial.println(val);\n}\n\n\n\/\/=======================================================\n\/\/ \u98a8\u901f\u3092\u51fa\u529b (\u521d\u671f\u5024\u3067\u306f5\u79d2\u3042\u305f\u308a\u306e\u56de\u8ee2\u6570\u3068\u306a\u308b)\n\/\/=======================================================\nvoid calcWindSpeed() {\n   Serial.print(\"speed:\");\n   Serial.println(numRevsAnemometer);\n   numRevsAnemometer = 0;        \/\/ \u56de\u8ee2\u6570\u3092\u30ea\u30bb\u30c3\u30c8\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6c17\u306b\u306a\u3063\u3066\u3044\u305fstrawberrylinux\u306e\u30a6\u30a7\u30b6\u30fc\u30e1\u30fc\u30bf\u30fc\u3002 https:\/\/strawberry-linux.com\/catalog\/items?code=18078 Sparkfun\u672c\u56fd\u306e\u30b5\u30a4\u30c8\u3067arduino\u306e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-2029","post","type-post","status-publish","format-standard","hentry","category-13"],"views":4342,"_links":{"self":[{"href":"http:\/\/www.pinewell.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2029","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.pinewell.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.pinewell.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.pinewell.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.pinewell.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2029"}],"version-history":[{"count":0,"href":"http:\/\/www.pinewell.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2029\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.pinewell.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.pinewell.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2029"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.pinewell.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}