#28 照度センサ
Tibbitの配置
Tibbit #28 と Tibbit #00-3を挿入します。
ノードの配置
以下のようにフローを配置します。
ノードの設定を開き、スロットを選択します。
Node-REDデプロイ後、injectノードをクリックすると照度を取得することができます。
サンプルフロー
1 |
[{"id":"a509b8a.5339948","type":"inject","z":"f79c229d.089ba8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":140,"wires":[["42caa167.0c44"]]},{"id":"42caa167.0c44","type":"Tibbit-#28","z":"f79c229d.089ba8","name":"","tpSlot":"S01","communication":"I2C","connectedStatus":"start","host":"","x":300,"y":200,"wires":[["67b4f998.8884c"]]},{"id":"67b4f998.8884c","type":"debug","z":"f79c229d.089ba8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":400,"y":260,"wires":[]}] |
dashboardで可視化
gauge
簡易的に可視化するために、dashboardのgaugeノードを使用します。
以下のようにフローを配置します。
5秒間隔で表示を更新します。
gaugeノードの設定を開きます。
Units(単位)やRange(範囲)を指定します。
Groupは任意で設定してください。
ダッシュボードタブの赤枠をクリックします。
Node-REDデプロイ後、injectノードをクリックするとゲージが5秒間隔で更新されます。
サンプルフロー
1 |
[{"id":"41b62ccd.914a44","type":"inject","z":"3c31dc44.0e66fc","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":640,"wires":[["8ab773d9.3926d8"]]},{"id":"8ab773d9.3926d8","type":"Tibbit-#28","z":"3c31dc44.0e66fc","name":"","tpSlot":"S01","communication":"I2C","connectedStatus":"start","host":"","x":340,"y":680,"wires":[["d013769b.6430e","734d7804.6b92e"]]},{"id":"d013769b.6430e","type":"delay","z":"3c31dc44.0e66fc","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":340,"y":760,"wires":[["8ab773d9.3926d8"]]},{"id":"734d7804.6b92e","type":"ui_gauge","z":"3c31dc44.0e66fc","name":"","group":"173ca4ac.32a41b","order":0,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"lux","format":"{{value}}","min":"70","max":"400","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":510,"y":640,"wires":[]},{"id":"173ca4ac.32a41b","type":"ui_group","z":"","name":"デフォルト","tab":"da05ff1c.ed28b","disp":true,"width":"6","collapse":false},{"id":"da05ff1c.ed28b","type":"ui_tab","z":"","name":"ホーム","icon":"dashboard"}] |
chart
簡易的にグラフ化するために、dashboardのchartノードを使用します。
以下のようにフローを配置します。
5秒間隔で表示を更新します。
chartノードの設定を開きます。
Y-axisなどを指定します。
Groupは任意で設定してください。
ダッシュボードタブの赤枠をクリックします。
Node-REDデプロイ後、injectノードをクリックするとグラフが5秒間隔で更新されます。
サンプルフロー
1 |
[{"id":"41b62ccd.914a44","type":"inject","z":"3c31dc44.0e66fc","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":640,"wires":[["8ab773d9.3926d8"]]},{"id":"8ab773d9.3926d8","type":"Tibbit-#28","z":"3c31dc44.0e66fc","name":"","tpSlot":"S01","communication":"I2C","connectedStatus":"start","host":"","x":340,"y":680,"wires":[["d013769b.6430e","a3269b5a.734ef"]]},{"id":"d013769b.6430e","type":"delay","z":"3c31dc44.0e66fc","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":340,"y":760,"wires":[["8ab773d9.3926d8"]]},{"id":"a3269b5a.734ef","type":"ui_chart","z":"3c31dc44.0e66fc","name":"","group":"173ca4ac.32a41b","order":0,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"70","ymax":"400","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":500,"y":640,"wires":[[],[]]},{"id":"173ca4ac.32a41b","type":"ui_group","z":"","name":"デフォルト","tab":"da05ff1c.ed28b","disp":true,"width":"6","collapse":false},{"id":"da05ff1c.ed28b","type":"ui_tab","z":"","name":"ホーム","icon":"dashboard"}] |