javaone preso how to make geiger usin sunspot and arduino
DESCRIPTION
TRANSCRIPT
1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
LOGO
Presenting with
How to make Geiger counter devices
using SunSPOT and Ardruino
Project Pid0.org Masafumi Ohta,
OpenForce Yoshimasa Kawano and Gclue Akira Sasaki
2 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Program Agenda
• SunSPOTの紹介(太田)
• 放射線や計測器やマッピングの基礎知識(河野)
• CLOUDCANDEプロジェクトの紹介(河野)
• SunSPOTを使った放射線計測器接続事例(河野)
• Arduinoを使った放射線計測器接続紹介(佐々木)
3 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
はじめに
• このセッションではいろいろな方にご協力いただきました。
– 元SunSPOT担当の方
– 夜中までおしかけてごめなさい m(__)m
• 小出先生@九州工業大学様
– 本当にありがとうございます。謹んで御礼申し上げます。
• 若松通商様
– ショールームを一時占拠しました…ごめんなさい
• …ほかいろいろ皆様方、謹んで御礼申し上げます。
4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
SunSPOTの紹介
5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
自己紹介
• 太田 昌文(おおた まさふみ)
• 東京都出身・でも実際は大分県民?
• 皆様しってのOpenSolaris CoreContributorでございます。
– 今日はSolarisつかいませんケド、関係者の方ごめんなさい。
• CTCにて仮想化案件の推進・Sun/Solaris案件の技術支援・OSS案件の推進=なんでも屋さん。
• SunSPOTはかつて学校の研究用に売り込みにいったことがあってヘンに思い入れがあるのですが、ここまで大変とは思いもしませんでした…orz
6 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
SunSPOTってなに?
7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
SunSPOTの開発環境
• OS:Windows 32bit/MacOS X/Linux 32bit
– MacOS Xでの利用を推奨
• SunSPOT SDKインスト後にsudo dscl . -append /Groups/uucp GroupMembership
$USERが必要
– Windows,Linuxだと、動作させるまでが面倒
• 64bitだとSolariumでデモが全然うごきません。
• Windowsの場合リカバリ・アップデート処理で失敗することがあります。
8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
SunSPOT Demoは豊富!
• 使い方がいまいちわからなかったらまずデモをデプロイしてみる。
– 基本はNetbeansで直接build and deploy
– デプロイはSolariumでもVirtual SPOTでエミュレートできます。
9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
SunSPOTとガイガーカウンター
10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
SunSPOTデモ
• Windows 7(64bit)上のVirtualboxでUbuntu Linux 10.04LTS(32bit)をインストールし、SunSPOT ManagerとNetbeansをインストール、SunSPOT sdkのデモをデプロイし、SunSPOTの動作を確認。
– 販売当初は32bit OS(Windows XP)が主流であったが、現在は64bit OS(Windows 7)が主流であり、かつWindows 64bitの場合SunSPOT sdkにあるデモが動作しないなど問題があるため、仮想環境を構築して動作可能なOSを利用する。
– FLOSSとして使い勝手のよいUbuntu Linux(32bit)をSunSPOT利用環境として選定
11 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
OpenJDK,Antをインストール
12 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
NetBeansのインストール、環境設定
• http://www.netbeans.org よりダウンロード、インストール
• http://www.sunspotworld.com/NB6/com-sun-sunspot-updatecenter.nbmからNetbeans SunSPOT pluginをインストール
• .xprofileの設定
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
export ANT_HOME=/usr/share/ant
export NETBEANS_HOME=/usr/local/netbeans-7.1.1
• .profileの設定
PATH="/usr/local/netbeans-7.1.1/bin:$PATH”
13 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
SunSPOT Managerのインストール
14 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
SunSPOT SDKのインストール
15 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
放射線や計測器やマッピングの基礎知識
16 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
自己紹介
• 河野 悦昌(かわの よしまさ)
– 徳島県出身・東京に単身赴任中
• 若松通商にいます
– アキバNET館
• 秘密結社やってます
– オープンフォース
– あく(オープンな)技術で
– 破壊活動(イノベーション)をする組織
17 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
汚染の種類
• ウラン系元素
– 原発内部またはごく近辺のみ
• 分裂核系元素
– セシウム、ストロンチウム、ヨウ素の同位体
• 汚染と区別するべきもの
– バックグラウンド
– 宇宙線やカリウム
18 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
話題の放射性核種
19 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
放射線の種類
• α線、β線、γ線、その他
• α線は肺胞への吸塵時に強い毒性があり、
その他にはあまり影響がない
• β線は今回の汚染で広範に検出するが透過力
が弱く測定条件で100倍以上の変動が発生する
• γ線はマッピング測定のためには最も手軽に
測定できるが弱いエネルギーでの検出なの
で工夫が必要
• その他は検出が難しい
→人体への直接的影響は少ない
20 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
計測器の種類
• ガイガー
• 半導体
• シンチレーション
21 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
ガイガー
• 原理:高圧電場の中に放射線を入れると気体全体が放電する。その信号を利用。
• 400V以上の高圧が必要
• 本来はベータ線しか反応しないものが多い
• γ 線は?
– 光電効果でβ 線に変換したものを計測する
– なので感度が低い
22 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
半導体
• 原理:半導体のギャップを放射線のエネルギーで乗り越える
– ギャップって?
– 電気の流れない層
– 薄いよ
• 小型化できる
– 素子が小さい
– ギャップも薄い
– 感応領域が小さい
• 体積が少ないのでガイガーに比べると反応が弱い
• 回路上の問題で振動で誤作動することが多い
• 大体1時間ぐらい安置しておかないといけない
23 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
シンチレータ
• 原理:蛍光を発する結晶に放射線をあてると光を発するのでそれを計測する
• 安定、感度高い、値段も高い
24 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
マッピングソリューションの種類
• 国
– 文科省航空機モニタリング
• 市民系
– Scanning the Earth Project、市民放射線測定マップ
– Safecast
– 測ってガイガー
– 早川マップ
• 市民系はいろいろ批判があるが国の結果と同じような結果を描き出す
• 国よりも速い
• データ量が何よりものを言う
25 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
CLOUDCANDEプロジェクトの紹介
26 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
CLOUDCANDE
• 原発災害に対応するため
• データをクラウドに収集、マッピングする
• そのためのサービスの開発
• そのためのデータ送信機器の開発
• そのための測定機材の入手
• そのためのテクニカル情報の集積
• 啓蒙活動
27 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
汚染を計測
• 分裂核系元素
– セシウム、 ストロンチウム、 ヨウ素の同位体
• 幸いにして、大放出が 一度きりだったので、 組成はどこでもほぼ同じ – 半減期、組成から見て
Cs-137をターゲットに
28 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
CLOUDCANDEのために
• 放射線計測機
– 入手難の解消
– 輸入
– 独自開発
• PC,スマートフォンなどに接続
– インターフェースを開発
– プログラムを作成
• サーバサイドを構築
29 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
データ収集の種類
• スマートフォン
• PC
• 計測器をHack
• 接続方法
– いくつも接続方法があるがどれも統一して使えるように
– バリエーション広くして間口を広く
30 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
ケース1(ガイガー方式)
• 自作ガイガーカウンター
• ガイガー管輸入
• 高圧回路は使い捨てカメラのフラッシュ回路
31 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
ケース2(半導体方式)
• 半導体方式はbeep出力が無いものが多い(ex,エアカウンター)
• 音声出力に特化したものはむしろ安価に入手可能
– ex,Radiationwatch.org(フリスクガイガー)
• 音声入力なのでそれを受けるプログラムを開発
32 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
ケース3(ガイガー、シンチ方式)
• 出来合いの放射線計測器を改造
• 例として、FUKUSHIMA GEIGER COUTER
• この機種はオープンハードウェアなので回路図が公開されている
• 分解してスピーカ部分から信号を取り出す
33 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
ケース4(ガイガー、シンチ方式等)
• モニタリングポスト装置を改造
• Mark2、BlueV2など
• 元々定置測定用なので、フォーマットを変更するだけで使える
34 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
PC,スマートフォン等への接続方法
• USB有線接続
– Arduinoを使った方法
– 安定している
– 電力供給も含めてOK
• センサネットワーク
– Xbeeを使った方法
– SunSPOT
• 自律収集ネットが構築できる
35 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
PC,スマートフォン等への接続方法(続き)
• Bluetooth
– 専用モジュールを開発中
– 持ち歩きにはこれをお勧め
• Wi-Fi
– 未開発
• 有線LAN
– 単体でLANに接続
– 専用機
• 音声有線接続
– iPhoneなどに
36 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
PC,スマートフォン上で
• 数値表示
• 分析
– グラフ表示など
• クラウドアップロード
37 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
クラウドアップロード
• データ形式:JSON形式
• IMAOCANDEフォーマット
• 日時、計測値、緯度、経度、通し番号、 ・・・
• Cf, IMAOCANDEマシン
38 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
クラウド側
• 製作中
• 乞ご期待!
• Hadoopを使い分析、OpenStreetMapなどへのマッピングを行う。
• 作成のエピソードは後程
39 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
SunSPOTを使った放射線計測器接続事例
40 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
SunSPOT
• 改めて計測器ドライバとして見てみる
– 無線センサーネットワークデバイス
– フィジカルコンピューティングデバイス
– フルJavaプログラミングデバイス
41 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
SunSPOTハードウェアスペック
• USBから充電
• 小型
• オンボードセンサーがいっぱい
– 温度センサー
– 照度センサー
– 3軸加速度センサー
• フルカラーLED x 8
• IEEE802.15.4
• デジタル入出力x4、アナログ入出力x4
• スイッチ入力x2 (割り込み)
42 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
電源スペック
• 電池 3.7V 770mAh
• 3V ピン 電力供給可能
• 大電流出力ピンが4つある
• ソース、シンク300mA 合計500mA 個別制御
• モータコントロールなどもできる
43 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
センサネットワーク
• Sleep 30μA
• IEEE802.15.4
• メッシュネットワークが構築できる
44 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
コンセプト
• 放射線検出器を接続したSUNSPOT
• 数百m程度のフィールドでメッシュネットワークを構築
• データ収集はホストPC1台に
• ノードは太陽電池で駆動
45 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
太陽電池
• 2W級 SP80180 180x81x1.5mm
• 5.5V 360mA
• SunSPOTは低消費電力なので
太陽電池でも駆動可能
• 1.4V 240mA
(エクトプラズム動作状態)
46 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
昼間の数時間のみの動作
• 数値を1時間安定するまで計測して
• 1時間たったら転送する
• ノード同士でホップして順繰りにデータを転送
• 最大255ノードからPCにデータを収集
• 屋外のモニターをメッシュ状にしなければならない
• 農園などで動作
47 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
実験1
• 最初は半導体検出器を接続することを考えた
– コンパクト、消費電力小
• 問題点
– 半導体検出器はノイズに著しく弱い
– 半導体の感度を上げようとすると十数ボルト以上を作成しなければならない
– SunSPOTの3.3Vから昇圧するとノイズが発生
– 正確な計測が困難に
• ガイガー管式に変更した
– 400Vが必要だがノイズには非常に強い
– 不感時間があるので高線量では誤差が大きくなる
48 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
実験2
• 屋外ノイズ実験
• ガイガー管式に変更したので振動には強い
• 半導体式では風雨の振動を除外するしくみを作らないといけないがガイガー管式では特に対策をとらずに問題が発生しないことを確認
49 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
実験3
• 太陽電池で満充電するには…2W級 SP80180 180x81x1.5mm を2枚利用
• 実測値
– USBコネクタからの電源供給値
• CPUアクティブ時 4.98V 97.2mA
• スリープ時 5.03V 50.6mA
– 電池セルへの充電電流
• CPUアクティブ時 4.16V 70~80mV
• スリープ時 3.6V 20mA
• 充電時間4時間程度
50 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
実験4
• ホップ転送のために
• スリープ中の自律ノード同士で通信させる
• 出力 PALevel 31…0dBmm 19…-5dBM 7…-15dBm 3…-25dBm
• -20dBmで1m程度なので、最大出力だと30m程度と推測
51 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
マッピングへ
(図は従来システムのマッピング例)
メッシュネットワークの対応
移動計測の交点
突き合わせ
データは自由に利用可能に
52 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
応用へ
• 放射線以外への応用
• 屋外での長期モニタリング
• 月、年単位
• 農場の植物生育
• 植生変化
• メモリはフラッシュなので通信をせずに年単位のデータ収集もOK
53 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
発展形
• 1.空中散布ロボット?
• 2.SUNSpot入手できない場合 – Arduino+XBee+シリアル通信+Javaで同様のものが動作するように
– モックアップ作成
54 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Geiger Cooking
55 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Arduinoを使った放射線計測器接続紹介
56 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
自己紹介
• 佐々木 陽(ささき あきら)
• 1999年よりPalmのKVMでJavaアプリを開発。2001年にGClueを設立し、代表取締役に就任。
• 以後、携帯電話向けのJavaアプリの開発に従事。2007年よりスマートフォン向けアプリ開発をおこなっている。
57 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Arduinoとは?
• Arduinoプロジェクトは2005年にイタリアで始まり、当時入手可能であった他の学生向けのロボット製造用コントロールデバイスよりも安価なプロトタイピング・システムを製造することを目的にスタートした
• 現在までに35万枚が出荷
• コミュニティには4万人が登録
58 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Geiger Counter
• 登録入力
– 5V
• ガイガーミューラー菅
– 400V
• 出力
– 数V(一瞬)
59 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
5Vから400Vを作り回路図
60 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
ブレッドボードで試作
61 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Arduino
• 放射能が計測されると放電する
• 割り込みで値を取得
– 1秒間の合計を累計する
62 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Arduinoと接続
63 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
表示
• LCDに表示
• USBでスマートフォンに転送
• Mic端子でスマートフォンに転送
64 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
LCDで表示
65 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
転送
• Zigbeeで転送 • 3Gシールドで転送
66 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Arduino + 3G Shield
67 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
補足
68 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
今後の予定
• CLOUDCANDEサーバサイドインプリメント、サービスイン
• 災害管理システムSAHANAプラグイン
• 開発ハードウェアのスピンアウト
69 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
スピンアウト例
• Bluetooth汎用入出力装置
• InkscapeでG-code作成
• FT232RLフィジカルコンピューティングモジュール
70 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
参考文献
• WebサイトPROJECT2108.com - CLOUDCANDE
• テキスト「Programing Sun Spot 2009.08」
• もっと知りたい方はオープンフォースMLへ!
71 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
最後にひとこと
72 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
最後に
• 東北の大惨事から一年たってじわじわと放射能の脅威が広がっていて、風評被害もそれにともないひろがっています。正しい知識をもつということは大事です。
• 当初放射線計測器は高かったものの少しずつですが値段が下がってきています。今度はこれをどう生かしていくかの腕もかかってくるかと。
• Hack4jpや被災者をITで支援していくコミュニティで貢献することも、現地に行って作業をすることと同様大切なことかと思ってます。
• 今後との私どもの活躍、ご期待くださいませ.
73 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Q&A
74 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Thanks for Ur Coming! Masafumi Ohta
Akira Sasaki
Yoshikmasa Kawan