前提・実現したいこと
風速センサ(Wind Sensor Rev.C(https://moderndevice.com/product/wind-sensor/))で風速を計測したいです。
最終的にはarduinoを使って空気温度、相対湿度、黒球温度、風速を計測し、それらのデータからPMVという値を出したいと考えています。
発生している問題・エラーメッセージ
現時点では空気温度、相対湿度、黒球温度は各種センサを用いて適した値を計測することが出来ましたが、風速センサだけ値のズレが大きくなってしまいます。
具体的には、無風状態にも関わらず風速7m/s以上の値が計測されたり、息を少し吹きかけただけで風速が20m/sを超えるなどです。
時間経過で無風状態で0m/sを示すこともありますが、その場合でも息を吹きかけると20m/sを超えていました。
該当のソースコード
/* Modern Device Wind Sensor Sketch for Rev C Wind Sensor * * Hardware Setup: Wind Sensor Signals Arduino GND GND +V 5V RV A1 // modify the definitions below to use other pins TMP A0 // modify the definitions below to use other pins Paul Badger 2014 Original at https://github.com/moderndevice/Wind_Sensor Licensed for use on official Modern Device hardware Reproduced with the permission of Paul Badger Revised by John Keefe 2016 Hardware setup: Wind Sensor is powered from a regulated five volt source. RV pin and TMP pin are connected to analog inputs. */ #define analogPinForRV 1 // change to pins you the analog pins are using #define analogPinForTMP 0 const float zeroWindAdjustment = .2; int TMP_Therm_ADunits; float RV_Wind_ADunits; float RV_Wind_Volts; unsigned long lastMillis; int TempCtimes100; float zeroWind_ADunits; float zeroWind_volts; float WindSpeed_MPH; void setup() { Serial.begin(9600);//シリアル通信を9600bpsで初期化 } void loop() { if (millis() - lastMillis > 200){ TMP_Therm_ADunits = analogRead(analogPinForTMP); RV_Wind_ADunits = analogRead(analogPinForRV); RV_Wind_Volts = (RV_Wind_ADunits * 0.0048828125); // these are all derived from regressions from raw data as such they depend on a lot of experimental factors // such as accuracy of temp sensors, and voltage at the actual wind sensor, (wire losses) which were unaccouted for. TempCtimes100 = (0.005 *((float)TMP_Therm_ADunits * (float)TMP_Therm_ADunits)) - (16.862 * (float)TMP_Therm_ADunits) + 9075.4; zeroWind_ADunits = -0.0006*((float)TMP_Therm_ADunits * (float)TMP_Therm_ADunits) + 1.0727 * (float)TMP_Therm_ADunits + 47.172; // 13.0C 553 482.39 zeroWind_volts = (zeroWind_ADunits * 0.0048828125) - zeroWindAdjustment; WindSpeed_MPH = pow(((RV_Wind_Volts - zeroWind_volts) /.2300) , 2.7265); Serial.print("風速:");//文字列「風速」をシリアルモニタに送信 Serial.print(WindSpeed_MPH);//「temperature」をシリアルモニタに送信 Serial.println("m/s");//文字列「m/s」をシリアルモニタに送信、改行 lastMillis = millis(); } }
試したこと
センサ本体に問題があるかと思い、幾つか購入して試してみましたが、いずれも同様の結果となっていました。
arduino本体も幾つか変えながら行いましたがいずれも変わりませんでした。
残る可能性としてコードがおかしい可能性があると思い送らせていただきました。
このサイトで送ってよい質問なのかも分かっていない初心者ですがお力添えいただければ幸いです。
【追記】
https://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q10234596555?fr=chie_my_notice_newans
thkanaさんからのご指摘をいただき、yahoo知恵袋のURLを追記しました。
マルチポストをした理由としては、こちらのサイトでは特定のセンサの不具合点について質問することはふさわしくない可能性があると思ってしまったためです。
このようなルールがあったことも知らずに投稿をしてしまい申し訳ございませんでした。
また、あちらにはお礼の返信を出来ていなかったことをお詫び申し上げます。
皆様本当にありがとうございました。