いんくらyochさんの日記

興味あることの忘備録

WeatherボードのCentOSへの接続

完成した気象観測ボードをCentOS6.3へ接続して、シリアルでデータを抜くプログラムを実験しました。
プログラムはSi-Linuxさんの所で公開されているソースを基に、カノニカルモードとなるよう手を加え、AVRから吐き出すデータをアペンドでファイルに書き出すようにしました。

date_str=2013/01/21, 22:30:21,buffer=000/000g000t062r000p000P000h50b10170_0190076
2013/01/21, 22:30:21
000/000g000t062r000p000P000h50b10170_0190076
date_str=2013/01/21, 22:30:24,buffer=000/000g000t062r000p000P000h50b10170_0190076
2013/01/21, 22:30:24
000/000g000t062r000p000P000h50b10170_0190076

結果は上記のように出来ました。
改行コードはCRからLFに変更してます。
これでwxnow.txtを配置する目処がたった訳ですが、xastirの方をよく調べてみると、わざわざファイル化しなくてもシリアルポートからじかに抜けるようです。wxnow.txtはAGWTrackerの設定で見たものでしたので、WXってのはこれが共通なものと思ってました。
では、xastirで対応しているフォーマットについて調べたところ、Radio ShackのWX-200とか1-wireのowwなどがあるようです。wx-200また、PeetBros.ULTIMETER2000は今回の接続パタンと同じシリアルで抜ける模様で、owwの場合、データをUDPでアクセスする必要があるみたいです。
それぞれのデータフォーマットも調査したところ、検索より以下が出てきました。
次はWX-200ULTIMETER2000のフォーマットを出力させて、xastirで取り込めるか確認しようと思います。
WX-200ULTIMETER2000

KE7CXV>APRS,TRACE3-3,qAO,NG7M-11:$ULTW0000000001FF000427C70002CCD30001026E003A050F00040000

Header = $ULTW (this identifies the report as a Ultimeter Weather Station)

All values are reported in hex format

Field #1, 0000 = Wind Speed Peak over last 5 min. ( reported as 0.1 kph increments)
Field #2, 0000 = Wind Direction of Wind Speed Peak (0-255)
Field #3, 01FF = Current Outdoor Temp (reported as 0.1 deg F increments) i.e. 01FF = 511 decimal * 0.1 = 51.1 deg F
Field #4, 0004 = Rain Long Term Total (reported in 0.01 in. increments) 0.04 inches in this example
Field #5, 27C7 = Current Barometer (reported in 0.1 mbar increments) 27C7 = 10183 decimal = 1018.3
Field #6, 0002 = Barometer Delta Value(reported in 0.1 mbar increments)
Field #7, CCD3 = Barometer Corr. Factor(LSW)
Field #8, 0001 = Barometer Corr. Factor(MSW)
Field #9, 026E = Current Outdoor Humidity (reported in 0.1% increments) You know the drill now...
Field #10, 003A = 10. Date (day of year since January 1) 58 decimal in this case... it was February 28th, 30 + 28 for Jan and Feb.
Field #11, 050F = Time (minute of day) 1295 in this case after conversion to decimal.
Field #12, 0004 = Today's Rain Total (reported as 0.01 inch increments)* 0.04 inches in this example
Field #13, 0000 = 1 Minute Wind Speed Average (reported in 0.1kph increments)*

■oww

OWW Sends:
3.8 12.5 3.8 1.5 4.4 7.3 14 12 0.000 0.730 0.730 0.730 29.7 0.0 0.0 0.0000 0.0 0.0 0.0

Or Easier to read:
// tmp1: primary temp (C) =3.8
// tmp2: temp max (C) = 12.5
// tmp3: temp min (C) = 3.8
// tmp4: anemometer (mps) = 1.5
// tmp5: anemometer gust (peak speed MS) = 4.4
// tmp6: anemometer speed max * 0.447040972 (max speed MS) = 7.3
// tmp7: vane bearing - 1 (current wind direction)= 14
// tmp8: vane mode (max dir) = 12
// tmp9: rain rate = 0.000
// tmp10: rain total today = 0.730
// tmp11: rain total week = 0.730
// tmp12: rain since month = 0.730
// tmp13: Current Humidity = 29.7
// tmp14: Max Humidity = 0.0
// tmp15: Min Humidity = 0.0
// tmp16: Current Barometer = 0.0000
// tmp17: Max Barometer = 0.0
// tmp18: Min Barometer = 0.0
// tmp19: Barometer Rate = 0.0