皆さんメリークリスマス!(遅くなってごめんなさい)
この記事はIoTLT Advent Calendar 2019の12/24記事です。
IoTLT仙台やってるひろみちゃんこと櫻井です。
今年はめちゃくちゃ忙しくて参加するのどうしようかなと思ってたんですが思わず枠取っちゃったんですよね。
それでも後の方に後の方にと23日にしたのに遅れるという。申し訳ございません。
んで何書こうか迷ったんですが、先日イベントの為に作成した(してもらった)ウルトラハットについて書こうかと。
職業柄展示会に参加する事が多いんですが、内容によっては一人で対応する事もあるんですよね。
でもステージとかで聞きたい講演とかあるじゃないですか。
そんな時、こんなんあればいいなって思ったのがファミレスとか居酒屋にあるアレ↓
これ押してくれたら戻りますって感じにしたらIoTっぽいしいいんじゃないかと。
でも、普通に作っても面白くないので、いろいろ考えてみたんです。
皆さんアメリカ横断ウルトラクイズって知ってますかね?
子供ながらに見てた番組でしたが、福留さんの決め台詞「ニューヨークへ行きたいかー!?」が今でも忘れられません。
ゲームボーイでゲームソフト化もされ、自分もお年玉で買いました。
そんな国民的クイズ番組ですが、その中の早押しクイズなどで使用されていた回答権を解り易く表示する仕組がウルトラハットです。
これ見たらワクワクしますよね?
なんなら講演聞いてる人達も気になって声かけてくれるかも!
・BLE対応環境
-Node-RED用BLE環境インストール
sudo apt-get update
node-red-stop
sudo apt-get install bluetooth libbluetooth-dev libudev-dev
sudo npm install noble
sudo reboot
・スピーカー、ブロック配置
スピーカーを接続
電源用USBをUSBコネクタへ
音声用ジャックをAVジャックへ
ブロック
#003を、S06, S07とS08へ
#38(SW)をS06へ
#39(LED)をS07へ
ボタンと接続した#21(端子)をS08へ
帽子(BLE&サーボ付き)
USB電源へ接続
[{"id":"6bb9caa5.5aa2b4","type":"tab","label":"ウルトラハット","disabled":true,"info":""},{"id":"c6a7f4f7.f271b8","type":"Tibbit-#00 in","z":"6bb9caa5.5aa2b4","name":"","tpSlot":"S08","communication":"GPIO","outputOnly":true,"pinA":"IN_Edge","pinB":"other","pinC":"other","pinD":"other","serialConf":"","connectedStatus":"start","host":"","x":180,"y":540,"wires":[["e850b6c8.053bf8"]]},{"id":"ee6047e6.127c28","type":"delay","z":"6bb9caa5.5aa2b4","name":"","pauseType":"delay","timeout":"18","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":820,"y":540,"wires":[["69e5b54e.14d84c"]]},{"id":"908c5017.8d0c6","type":"change","z":"6bb9caa5.5aa2b4","name":"pin1","rules":[{"t":"set","p":"filename","pt":"msg","to":"/home/pi/P3/UltraHat/wav/pin1.wav","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":840,"wires":[["bef41f2c.a87ca"]]},{"id":"1b2a655d.86180b","type":"inject","z":"6bb9caa5.5aa2b4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"1","x":150,"y":160,"wires":[["2af7ebfe.42a0b4"]]},{"id":"e850b6c8.053bf8","type":"switch","z":"6bb9caa5.5aa2b4","name":"","property":"payload.v","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":350,"y":540,"wires":[["43374493.9e7e0c","a8c78a32.bbfb58"]]},{"id":"a0729ca6.6ffad","type":"inject","z":"6bb9caa5.5aa2b4","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":true,"onceDelay":"2","x":150,"y":340,"wires":[["c3227b16.3dc818"]]},{"id":"c3227b16.3dc818","type":"switch","z":"6bb9caa5.5aa2b4","name":"","property":"st","propertyType":"flow","rules":[{"t":"true"},{"t":"false"}],"checkall":"false","repair":false,"outputs":2,"x":310,"y":340,"wires":[["dd01fda1.4446d","8929b006.846b4"],["27e40f9e.3ebd6","758ae789.957e88"]]},{"id":"2a755093.20982","type":"exec","z":"6bb9caa5.5aa2b4","command":"gatttool","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":640,"y":340,"wires":[["64db979d.76fa78"],["d4276252.05a0b"],[]]},{"id":"27e40f9e.3ebd6","type":"function","z":"6bb9caa5.5aa2b4","name":"倒す","func":"msg.payload = \"-b E0:09:C6:C4:FE:BB -t random --char-write-req -a 0x000b -n 0420\";\nreturn msg;","outputs":1,"noerr":0,"x":470,"y":360,"wires":[["2a755093.20982"]]},{"id":"dd01fda1.4446d","type":"function","z":"6bb9caa5.5aa2b4","name":"起こす","func":"msg.payload = \"-b E0:09:C6:C4:FE:BB -t random --char-write-req -a 0x000b -n 07d0\";\nreturn msg;","outputs":1,"noerr":0,"x":470,"y":320,"wires":[["2a755093.20982"]]},{"id":"cfb19a6a.d87888","type":"function","z":"6bb9caa5.5aa2b4","name":"OFF","func":"msg.payload = [{line: 'B', v: 0}];\nreturn msg;","outputs":1,"noerr":0,"x":230,"y":700,"wires":[["d7064a42.e1c918"]]},{"id":"a63b9274.30cb3","type":"function","z":"6bb9caa5.5aa2b4","name":"LED-ON","func":"msg.payload = [{line: 'B', v: 1}];\nreturn msg;","outputs":1,"noerr":0,"x":220,"y":660,"wires":[["d7064a42.e1c918"]]},{"id":"d7064a42.e1c918","type":"Tibbit-#00","z":"6bb9caa5.5aa2b4","name":"","tpSlot":"S08","communication":"GPIO","pinA":"other","pinB":"OUT","pinC":"other","pinD":"other","i2cBaudRateK":"100","spiSpeed":"500","spiMode":"1","spiEndian":"1","serialConf":"","connectedStatus":"start","host":"","x":400,"y":680,"wires":[[]]},{"id":"bbb7ab95.58de68","type":"change","z":"6bb9caa5.5aa2b4","name":"","rules":[{"t":"set","p":"st","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":540,"wires":[["ee6047e6.127c28","8365bc68.aa2d2"]]},{"id":"6ff6e607.1e6c58","type":"change","z":"6bb9caa5.5aa2b4","name":"reset flow.st","rules":[{"t":"set","p":"st","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":1000,"wires":[["f419c65f.862b98"]]},{"id":"2af7ebfe.42a0b4","type":"change","z":"6bb9caa5.5aa2b4","name":"","rules":[{"t":"set","p":"st","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":160,"wires":[[]]},{"id":"d4276252.05a0b","type":"change","z":"6bb9caa5.5aa2b4","name":"エラー","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload[0].line","pt":"msg","to":"A","tot":"str"},{"t":"set","p":"payload[0].v","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":810,"y":360,"wires":[["d35bfac7.7b52d8"]]},{"id":"64db979d.76fa78","type":"change","z":"6bb9caa5.5aa2b4","name":"正常","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload[0].line","pt":"msg","to":"A","tot":"str"},{"t":"set","p":"payload[0].v","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":810,"y":300,"wires":[["d35bfac7.7b52d8"]]},{"id":"d35bfac7.7b52d8","type":"Tibbit-#00","z":"6bb9caa5.5aa2b4","name":"","tpSlot":"S07","communication":"GPIO","pinA":"OUT","pinB":"other","pinC":"other","pinD":"other","i2cBaudRateK":"100","spiSpeed":"500","spiMode":"1","spiEndian":"1","serialConf":"","connectedStatus":"start","host":"","x":980,"y":340,"wires":[[]]},{"id":"bef41f2c.a87ca","type":"speakerpi-output","z":"6bb9caa5.5aa2b4","choose":"givenfile","filename":"","channels":"1","bitdepth":"16","samplerate":"22050","name":"","x":440,"y":860,"wires":[[]]},{"id":"4f2beae7.46d324","type":"Tibbit-#00 in","z":"6bb9caa5.5aa2b4","name":"","tpSlot":"S06","communication":"GPIO","outputOnly":true,"pinA":"IN_Edge","pinB":"other","pinC":"other","pinD":"other","serialConf":"","connectedStatus":"start","host":"","x":180,"y":1000,"wires":[["b92cbf50.b2e1d","f52f3edb.876f4"]]},{"id":"b92cbf50.b2e1d","type":"switch","z":"6bb9caa5.5aa2b4","name":"","property":"payload.v","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":350,"y":1000,"wires":[["6ff6e607.1e6c58"]]},{"id":"b8912fc.c45d9d","type":"comment","z":"6bb9caa5.5aa2b4","name":"ウルトラハット Ver 1.0 2019/11/26","info":"","x":200,"y":40,"wires":[]},{"id":"7fbbca57.ab6874","type":"comment","z":"6bb9caa5.5aa2b4","name":"初期化 -------------------------------------------------------------------------------------","info":"","x":320,"y":120,"wires":[]},{"id":"4e42a1e9.30574","type":"comment","z":"6bb9caa5.5aa2b4","name":"ハット制御 -------------------------------------------------------------------------------------","info":"","x":330,"y":240,"wires":[]},{"id":"ae448b2d.d21908","type":"comment","z":"6bb9caa5.5aa2b4","name":"BLEリンクステータス","info":"","x":1000,"y":300,"wires":[]},{"id":"d7a41690.080f68","type":"comment","z":"6bb9caa5.5aa2b4","name":"早押しボタン制御 -------------------------------------------------------------------------------------","info":"","x":350,"y":460,"wires":[]},{"id":"8929b006.846b4","type":"link out","z":"6bb9caa5.5aa2b4","name":"BT_LED_ON","links":["fffb9e86.5515f"],"x":435,"y":280,"wires":[]},{"id":"758ae789.957e88","type":"link out","z":"6bb9caa5.5aa2b4","name":"BT_LED_OFF","links":["524947ed.277c68"],"x":435,"y":400,"wires":[]},{"id":"fffb9e86.5515f","type":"link in","z":"6bb9caa5.5aa2b4","name":"","links":["8929b006.846b4"],"x":115,"y":660,"wires":[["a63b9274.30cb3"]]},{"id":"524947ed.277c68","type":"link in","z":"6bb9caa5.5aa2b4","name":"","links":["758ae789.957e88"],"x":115,"y":700,"wires":[["cfb19a6a.d87888"]]},{"id":"3ede0407.9fd39c","type":"comment","z":"6bb9caa5.5aa2b4","name":"押しボタン","info":"","x":140,"y":500,"wires":[]},{"id":"7aeb28da.0eb3e8","type":"comment","z":"6bb9caa5.5aa2b4","name":"ボタンLED","info":"","x":140,"y":620,"wires":[]},{"id":"ab5fd8d3.9eaab8","type":"link out","z":"6bb9caa5.5aa2b4","name":"Hat","links":["6df0703e.f8145"],"x":595,"y":500,"wires":[]},{"id":"6df0703e.f8145","type":"link in","z":"6bb9caa5.5aa2b4","name":"","links":["ab5fd8d3.9eaab8","f419c65f.862b98"],"x":195,"y":280,"wires":[["c3227b16.3dc818"]]},{"id":"a3666e41.0e793","type":"comment","z":"6bb9caa5.5aa2b4","name":"音楽制御 -------------------------------------------------------------------------------------","info":"","x":320,"y":800,"wires":[]},{"id":"69e5b54e.14d84c","type":"change","z":"6bb9caa5.5aa2b4","name":"","rules":[{"t":"set","p":"st","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":980,"y":540,"wires":[[]]},{"id":"a8c78a32.bbfb58","type":"link out","z":"6bb9caa5.5aa2b4","name":"Music_1","links":["c81bc9ac.b4b928"],"x":455,"y":580,"wires":[]},{"id":"c81bc9ac.b4b928","type":"link in","z":"6bb9caa5.5aa2b4","name":"","links":["a8c78a32.bbfb58"],"x":115,"y":840,"wires":[["908c5017.8d0c6"]]},{"id":"9cdfbd67.309d5","type":"change","z":"6bb9caa5.5aa2b4","name":"fanfare1","rules":[{"t":"set","p":"filename","pt":"msg","to":"/home/pi/P3/UltraHat/wav/fanfare1.wav","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":240,"y":880,"wires":[["bef41f2c.a87ca"]]},{"id":"b6641c91.8d0da","type":"link out","z":"6bb9caa5.5aa2b4","name":"Music_2","links":["47a354a0.f666fc"],"x":935,"y":600,"wires":[]},{"id":"47a354a0.f666fc","type":"link in","z":"6bb9caa5.5aa2b4","name":"","links":["b6641c91.8d0da"],"x":115,"y":880,"wires":[["9cdfbd67.309d5"]]},{"id":"8365bc68.aa2d2","type":"delay","z":"6bb9caa5.5aa2b4","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":820,"y":600,"wires":[["b6641c91.8d0da"]]},{"id":"df26b26f.3184d","type":"comment","z":"6bb9caa5.5aa2b4","name":"Blockのボタン -------------------------------------------------------------------------------------","info":"","x":340,"y":960,"wires":[]},{"id":"43374493.9e7e0c","type":"switch","z":"6bb9caa5.5aa2b4","name":"","property":"st","propertyType":"flow","rules":[{"t":"false"}],"checkall":"false","repair":false,"outputs":1,"x":490,"y":540,"wires":[["bbb7ab95.58de68","ab5fd8d3.9eaab8"]]},{"id":"f52f3edb.876f4","type":"change","z":"6bb9caa5.5aa2b4","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":1060,"wires":[["2988b91c.033d96"]]},{"id":"2988b91c.033d96","type":"link out","z":"6bb9caa5.5aa2b4","name":"BT_Reset","links":["a1ce7c3f.0ca1b"],"x":455,"y":1060,"wires":[]},{"id":"a1ce7c3f.0ca1b","type":"link in","z":"6bb9caa5.5aa2b4","name":"","links":["2988b91c.033d96"],"x":675,"y":600,"wires":[["ee6047e6.127c28","8365bc68.aa2d2"]]},{"id":"f419c65f.862b98","type":"link out","z":"6bb9caa5.5aa2b4","name":"Hat","links":["6df0703e.f8145"],"x":635,"y":1000,"wires":[]}]
今年はET/IoTTechnology2019Award受賞したり、RRIのスマートものづくり応援ツール受賞したり、みやぎIT認定ツールとして登録されたり(宣伝)したうちの製品「Tibbo-Pi」をもちろん使用。
Bluetoothで飛ばしてサーボ動かしてハテナマークが起きる仕様
そして欠かせないのがこの音源
実物のデモ動画
ちなみにスピーカーはDAISOで300円。
めっちゃうけると思ったんですよ。
なんとイベントで披露したところ、反応薄いんですよ。全体的に。
「え…?そんな番組あったんですか…?」
OH…
知らん人多すぎ。喜んでくれる人達は自分より歳上の人たち(涙
懲りずに次のイベントでも使おう…。
それまでは会社の呼び鈴にでもしておきます。