基本的な使い方はこちらをご覧下さい。KeiganPi チュートリアル Node-RED

以下のデータをコピーして、Node-REDエディタの右上メニュー>[読み込み > フローをクリップボードから読み込み]で表示されたウインドウに貼り付けてご使用下さい。

基本接続

KeiganMotor にUSB接続し、モーターのLEDを点滅させるフロー

[{"id":"a16689f.6706d78","type":"tab","label":"基本接続(USB)","disabled":false,"info":""},{"id":"c2a80e

 

モーター制御

KeiganMotor に接続し「スピード設定&回転」「位置制御(相対位置)」「位置制御(絶対位置)」を行うフロー

[{"id":"d34b5467.fbd1c8","type":"tab","label":"モーター制御","disabled":false,"info":""},{"id":"15b9134f.497b7d","type":"comment","z":"d34b5467.fbd1c8","name":"位置制御(相対位置)","info":"","x":140,"y":360,"wires":[]},{"id":"69481085.6610c","type":"km-motor-usb-selector","z":"d34b5467.fbd1c8","name":"","selectMotorName":"","isInitializScan":false,"isMotorKeepalive":false,"x":300,"y":420,"wires":[["7204c543.963a7c"]]},{"id":"bac8a38c.b873a","type":"inject","z":"d34b5467.fbd1c8","name":"true","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":420,"wires":[["69481085.6610c"]]},{"id":"7204c543.963a7c","type":"km-motor-sequencer","z":"d34b5467.fbd1c8","name":"","cmdJson":"{\"cmd\":\"cmdEnable\"}","isErrStop":true,"x":520,"y":420,"wires":[["b9ce76e2.4b1a28"]]},{"id":"b9ce76e2.4b1a28","type":"km-motor-sequencer","z":"d34b5467.fbd1c8","name":"","cmdJson":"{\"cmd\":\"cmdMoveByDistanceDeg\",\"arg\":[180,10]}","isErrStop":true,"x":850,"y":420,"wires":[[]]},{"id":"2b2529c2.b4da26","type":"comment","z":"d34b5467.fbd1c8","name":"現在位置から180度回転","info":"","x":1180,"y":420,"wires":[]},{"id":"e7a17c20.92553","type":"km-motor-usb-selector","z":"d34b5467.fbd1c8","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":false,"isMotorKeepalive":false,"x":300,"y":280,"wires":[["a75fec61.e5214"]]},{"id":"7908d4b.7aee42c","type":"inject","z":"d34b5467.fbd1c8","name":"Stop","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":280,"wires":[["e7a17c20.92553"]]},{"id":"a75fec61.e5214","type":"km-motor-sequencer","z":"d34b5467.fbd1c8","name":"","cmdJson":"{\"cmd\":\"cmdDisable\"}","isErrStop":true,"x":520,"y":280,"wires":[[]]},{"id":"9e1ccaa1.de6098","type":"comment","z":"d34b5467.fbd1c8","name":"スピード設定&回転","info":"","x":130,"y":100,"wires":[]},{"id":"22919d08.9e33c2","type":"km-motor-sequencer","z":"d34b5467.fbd1c8","name":"","cmdJson":"{\"cmd\":\"cmdRun_rpm\",\"arg\":[5]}","isErrStop":true,"x":560,"y":220,"wires":[[]]},{"id":"be1c7bfd.3dbeb8","type":"km-motor-usb-selector","z":"d34b5467.fbd1c8","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":false,"isMotorKeepalive":true,"x":300,"y":160,"wires":[["4315449f.80550c"]]},{"id":"b2688c5e.17e1","type":"inject","z":"d34b5467.fbd1c8","name":"true","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":160,"wires":[["be1c7bfd.3dbeb8"]]},{"id":"4315449f.80550c","type":"km-motor-sequencer","z":"d34b5467.fbd1c8","name":"","cmdJson":"{\"cmd\":\"cmdEnable\"}","isErrStop":true,"x":520,"y":160,"wires":[["22919d08.9e33c2"]]},{"id":"d1aea2ff.72c46","type":"comment","z":"d34b5467.fbd1c8","name":"モーター停止","info":"","x":730,"y":280,"wires":[]},{"id":"8f0466f9.3c27f8","type":"comment","z":"d34b5467.fbd1c8","name":"5 rpmの速度で正回転させる","info":"","x":840,"y":220,"wires":[]},{"id":"3529de50.a73c92","type":"comment","z":"d34b5467.fbd1c8","name":"位置制御(絶対位置)","info":"","x":140,"y":500,"wires":[]},{"id":"5ac9237b.234bec","type":"km-motor-usb-selector","z":"d34b5467.fbd1c8","name":"","selectMotorName":"","isInitializScan":false,"isMotorKeepalive":false,"x":300,"y":560,"wires":[["290ddbdb.650544"]]},{"id":"86f5a3d2.a3dc6","type":"inject","z":"d34b5467.fbd1c8","name":"true","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":560,"wires":[["5ac9237b.234bec"]]},{"id":"edbfe4da.c1cc58","type":"comment","z":"d34b5467.fbd1c8","name":"90度の位置に回転","info":"","x":1050,"y":620,"wires":[]},{"id":"290ddbdb.650544","type":"km-motor-sequencer","z":"d34b5467.fbd1c8","name":"","cmdJson":"{\"cmd\":\"cmdPresetPosition\",\"arg\":[0]}","isErrStop":true,"x":570,"y":560,"wires":[["4d479c0.ab43c64"]]},{"id":"bc78b54.0a71848","type":"comment","z":"d34b5467.fbd1c8","name":"モーター座標の初期化(0に設定)","info":"","x":1110,"y":560,"wires":[]},{"id":"422a01a7.a51cb","type":"km-motor-sequencer","z":"d34b5467.fbd1c8","name":"","cmdJson":"{\"cmd\":\"cmdMoveToPositionDeg\",\"arg\":[0,20]}","isErrStop":true,"x":760,"y":800,"wires":[[]]},{"id":"6c472796.bbc0d8","type":"comment","z":"d34b5467.fbd1c8","name":"原点に移動","info":"","x":1020,"y":800,"wires":[]},{"id":"67dcb991.48a9d8","type":"delay","z":"d34b5467.fbd1c8","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":480,"y":620,"wires":[["6eec7494.5d932c"]]},{"id":"6eec7494.5d932c","type":"km-motor-sequencer","z":"d34b5467.fbd1c8","name":"","cmdJson":"{\"cmd\":\"cmdMoveToPositionDeg\",\"arg\":[90,10]}","isErrStop":true,"x":760,"y":620,"wires":[["bf4e51c0.6c19a"]]},{"id":"bf4e51c0.6c19a","type":"delay","z":"d34b5467.fbd1c8","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":480,"y":680,"wires":[["b6b25041.8ef69"]]},{"id":"b6b25041.8ef69","type":"km-motor-sequencer","z":"d34b5467.fbd1c8","name":"","cmdJson":"{\"cmd\":\"cmdMoveToPositionDeg\",\"arg\":[180,10]}","isErrStop":true,"x":770,"y":680,"wires":[["9c7b3cf0.46363"]]},{"id":"9c7b3cf0.46363","type":"delay","z":"d34b5467.fbd1c8","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":480,"y":740,"wires":[["eaa3a51a.8a4e58"]]},{"id":"eaa3a51a.8a4e58","type":"km-motor-sequencer","z":"d34b5467.fbd1c8","name":"","cmdJson":"{\"cmd\":\"cmdMoveToPositionDeg\",\"arg\":[360,20]}","isErrStop":true,"x":770,"y":740,"wires":[["31f9bed1.39cd02"]]},{"id":"28bb4632.0b8f0a","type":"comment","z":"d34b5467.fbd1c8","name":"180度の位置に回転","info":"","x":1050,"y":680,"wires":[]},{"id":"cac5e26d.81802","type":"comment","z":"d34b5467.fbd1c8","name":"360度の位置に回転","info":"","x":1050,"y":740,"wires":[]},{"id":"31f9bed1.39cd02","type":"delay","z":"d34b5467.fbd1c8","name":"","pauseType":"delay","timeout":"4","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":480,"y":800,"wires":[["422a01a7.a51cb"]]},{"id":"4d479c0.ab43c64","type":"km-motor-sequencer","z":"d34b5467.fbd1c8","name":"","cmdJson":"{\"cmd\":\"cmdEnable\"}","isErrStop":true,"x":840,"y":560,"wires":[["67dcb991.48a9d8"]]},{"id":"29120428.5515fc","type":"comment","z":"d34b5467.fbd1c8","name":"※モーターの誤動作を防止する為、使用しないフロータブは無効化して下さい。","info":"","x":300,"y":40,"wires":[]},{"id":"d9c3e1e7.a54e","type":"km-motor-usb-selector","z":"d34b5467.fbd1c8","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":false,"isMotorKeepalive":false,"x":300,"y":920,"wires":[["b83b95af.24d188"]]},{"id":"b696c55a.ba19b8","type":"inject","z":"d34b5467.fbd1c8","name":"Stop","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":920,"wires":[["d9c3e1e7.a54e"]]},{"id":"b83b95af.24d188","type":"km-motor-sequencer","z":"d34b5467.fbd1c8","name":"","cmdJson":"{\"cmd\":\"cmdDisable\"}","isErrStop":true,"x":520,"y":920,"wires":[[]]},{"id":"7a26d8e9.9cf7e8","type":"comment","z":"d34b5467.fbd1c8","name":"モーター停止","info":"","x":110,"y":860,"wires":[]},{"id":"7168b761.3f7338","type":"comment","z":"d34b5467.fbd1c8","name":"cmdEnable:初回にモーターを動作させるのに必要。一度実行すれば、モーターが再起動するまで有効。","info":"","x":1010,"y":160,"wires":[]},{"id":"72874035.cee5e","type":"km-motor-usb-selector","z":"d34b5467.fbd1c8","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":true,"isMotorKeepalive":false,"x":300,"y":1040,"wires":[[]]},{"id":"f2b06b56.c9b8c8","type":"inject","z":"d34b5467.fbd1c8","name":"","topic":"","payload":"scan","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"0.5","x":130,"y":1040,"wires":[["72874035.cee5e"]]},{"id":"e60351d.a05c7b","type":"comment","z":"d34b5467.fbd1c8","name":"入力に文字列\"scan\"を入れるとモーターを再検出します","info":"","x":600,"y":1040,"wires":[]},{"id":"eedcc424.2aeb38","type":"comment","z":"d34b5467.fbd1c8","name":"モーターの再検出(通常は使用しません。フロー実行中に新しいモーターを接続した場合にのみ使用)","info":"","x":390,"y":1000,"wires":[]}]

 

回転位置の到達と検出

KeiganMotor が目標の座標に到達したらLEDを変化させます。制限時間内に到達しない場合はエラーとしてLEDを赤点滅させます。

フローデータ

[{"id":"5dac5725.91b948","type":"tab","label":"回転位置の到達と検出","disabled":false,"info":""},{"id":"4ff6ff3e.6e5e8","type":"km-motor-usb-selector","z":"5dac5725.91b948","name":"","selectMotorName":"","isInitializScan":false,"isMotorKeepalive":false,"x":260,"y":100,"wires":[["e0a99f6a.a7242"]]},{"id":"85a66f30.73f5a","type":"inject","z":"5dac5725.91b948","name":"true","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":100,"wires":[["4ff6ff3e.6e5e8"]]},{"id":"ba6c1ae0.bf73d8","type":"km-motor-sequencer","z":"5dac5725.91b948","name":"","cmdJson":"{\"cmd\":\"cmdEnable\"}","isErrStop":false,"x":280,"y":160,"wires":[["ef8649a0.a8c0f8"]]},{"id":"ef8649a0.a8c0f8","type":"km-motor-sequencer","z":"5dac5725.91b948","name":"","cmdJson":"{\"cmd\":\"cmdMoveByDistanceDegSync\",\"arg\":[720,20,5000]}","isErrStop":true,"x":620,"y":160,"wires":[["c8b802f1.e2be"]]},{"id":"e0a99f6a.a7242","type":"km-motor-sequencer","z":"5dac5725.91b948","name":"","cmdJson":"{\"cmd\":\"cmdDisable\"}","isErrStop":true,"x":480,"y":100,"wires":[["50c47ec0.869b3"]]},{"id":"50c47ec0.869b3","type":"km-motor-sequencer","z":"5dac5725.91b948","name":"","cmdJson":"{\"cmd\":\"cmdLed\",\"arg\":[2,0,0,200]}","isErrStop":true,"x":760,"y":100,"wires":[["93dd791e.cdc7c8"]]},{"id":"c8b802f1.e2be","type":"km-motor-sequencer","z":"5dac5725.91b948","name":"","cmdJson":"{\"cmd\":\"cmdLed\",\"arg\":[1,0,200,0]}","isErrStop":true,"x":320,"y":240,"wires":[[]]},{"id":"b10cb453.2ffb68","type":"catch","z":"5dac5725.91b948","name":"syncErr catch","scope":["eb750895.966d18","ef8649a0.a8c0f8"],"uncaught":false,"x":250,"y":300,"wires":[["2800935c.9aa63c"]]},{"id":"34ed369b.7e8c5a","type":"debug","z":"5dac5725.91b948","name":"syncEr","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":750,"y":300,"wires":[]},{"id":"2800935c.9aa63c","type":"km-motor-sequencer","z":"5dac5725.91b948","name":"","cmdJson":"{\"cmd\":\"cmdLed\",\"arg\":[2,200,0,0]}","isErrStop":true,"x":500,"y":300,"wires":[["34ed369b.7e8c5a"]]},{"id":"93dd791e.cdc7c8","type":"delay","z":"5dac5725.91b948","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":980,"y":100,"wires":[["ba6c1ae0.bf73d8"]]},{"id":"fac83a82.3051d8","type":"comment","z":"5dac5725.91b948","name":"5秒以内に到着しないとエラー","info":"","x":980,"y":160,"wires":[]},{"id":"8a4265c7.23e368","type":"comment","z":"5dac5725.91b948","name":"5秒以内に到着した場合はLED緑","info":"","x":610,"y":240,"wires":[]},{"id":"2811bcb2.0fa564","type":"comment","z":"5dac5725.91b948","name":"エラー処理: 5秒以内に到着しない場合はLED赤","info":"","x":1020,"y":300,"wires":[]},{"id":"7628a3a9.802f4c","type":"km-motor-usb-selector","z":"5dac5725.91b948","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":false,"isMotorKeepalive":false,"x":280,"y":440,"wires":[["1bc3a65.d767c5a"]]},{"id":"45f81238.3c4c3c","type":"inject","z":"5dac5725.91b948","name":"Stop","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":440,"wires":[["7628a3a9.802f4c"]]},{"id":"1bc3a65.d767c5a","type":"km-motor-sequencer","z":"5dac5725.91b948","name":"","cmdJson":"{\"cmd\":\"cmdDisable\"}","isErrStop":true,"x":480,"y":440,"wires":[[]]},{"id":"ea50a15c.3f05b","type":"comment","z":"5dac5725.91b948","name":"モーター停止","info":"","x":90,"y":380,"wires":[]},{"id":"918c7ef5.2f938","type":"km-motor-usb-selector","z":"5dac5725.91b948","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":true,"isMotorKeepalive":false,"x":280,"y":560,"wires":[[]]},{"id":"6c43ce2f.d214c","type":"inject","z":"5dac5725.91b948","name":"","topic":"","payload":"scan","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"0.5","x":110,"y":560,"wires":[["918c7ef5.2f938"]]},{"id":"cb20426e.13f85","type":"comment","z":"5dac5725.91b948","name":"入力に文字列\"scan\"を入れるとモーターを再検出します","info":"","x":580,"y":560,"wires":[]},{"id":"5a0287fb.68ade8","type":"comment","z":"5dac5725.91b948","name":"モーターの再検出(通常は使用しません。フロー実行中に新しいモーターを接続した場合にのみ使用)","info":"","x":370,"y":520,"wires":[]},{"id":"457a8da9.6a86e4","type":"comment","z":"5dac5725.91b948","name":"回転位置の到達と検出 モーターが目標の座標に到達したらLEDを変化させます。制限時間内に到達しない場合はエラーとして処理します。","info":"","x":490,"y":40,"wires":[]}]

 

回転往復

2種類の回転往復のサンプル

  • 現在の位置から+360度〜-360度の範囲でモーターが往復回転します。
  • 右180度20rpm回転→3秒停止→右180度20rpm回転→3秒停止→原点に40rpmで戻るを繰り返します。

[{"id":"f340ce8a.f7ff2","type":"tab","label":"回転往復","disabled":false,"info":""},{"id":"644b8f46.a0e6e","type":"km-motor-usb-selector","z":"f340ce8a.f7ff2","name":"","selectMotorName":"","isInitializScan":false,"isMotorKeepalive":false,"x":300,"y":300,"wires":[["2d58ed8f.2f8d02"]]},{"id":"2548a965.61fdb6","type":"inject","z":"f340ce8a.f7ff2","name":"start","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":300,"wires":[["644b8f46.a0e6e"]]},{"id":"cf3e431c.ab4d2","type":"km-motor-sequencer","z":"f340ce8a.f7ff2","name":"","cmdJson":"{\"cmd\":\"cmdMoveByDistanceDegSync\",\"arg\":[360,20,0]}","isErrStop":true,"x":370,"y":380,"wires":[["f58173a1.4ca56"]]},{"id":"2d58ed8f.2f8d02","type":"km-motor-sequencer","z":"f340ce8a.f7ff2","name":"","cmdJson":"{\"cmd\":\"cmdEnable\"}","isErrStop":true,"x":520,"y":300,"wires":[["2f888c67.67e7c4"]]},{"id":"8789fd5.34085","type":"comment","z":"f340ce8a.f7ff2","name":"回転往復(相対座標)現在の位置から+360度〜-360度の範囲でモーターが往復回転します","info":"","x":350,"y":240,"wires":[]},{"id":"f58173a1.4ca56","type":"km-motor-sequencer","z":"f340ce8a.f7ff2","name":"","cmdJson":"{\"cmd\":\"cmdMoveByDistanceDegSync\",\"arg\":[-360,20,0]}","isErrStop":true,"x":830,"y":380,"wires":[["cf3e431c.ab4d2"]]},{"id":"8ce5c2e2.abbae","type":"comment","z":"f340ce8a.f7ff2","name":"※モーターの誤動作を防止する為、使用しないフロータブは無効化して下さい。","info":"","x":300,"y":40,"wires":[]},{"id":"6117c231.8587fc","type":"km-motor-usb-selector","z":"f340ce8a.f7ff2","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":false,"isMotorKeepalive":false,"x":300,"y":800,"wires":[["a841e961.25b2f8"]]},{"id":"7930dd2a.0c2554","type":"inject","z":"f340ce8a.f7ff2","name":"Stop","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":800,"wires":[["6117c231.8587fc"]]},{"id":"a841e961.25b2f8","type":"km-motor-sequencer","z":"f340ce8a.f7ff2","name":"","cmdJson":"{\"cmd\":\"cmdDisable\"}","isErrStop":true,"x":500,"y":800,"wires":[[]]},{"id":"e3774664.28be28","type":"comment","z":"f340ce8a.f7ff2","name":"モーター停止","info":"","x":110,"y":740,"wires":[]},{"id":"f03a2b76.290978","type":"km-motor-usb-selector","z":"f340ce8a.f7ff2","name":"","selectMotorName":"","isInitializScan":false,"isMotorKeepalive":false,"x":300,"y":520,"wires":[["8f7ac2c8.748cd"]]},{"id":"421278a3.7c25d8","type":"inject","z":"f340ce8a.f7ff2","name":"start","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":520,"wires":[["f03a2b76.290978"]]},{"id":"a96acc36.dc22f","type":"km-motor-sequencer","z":"f340ce8a.f7ff2","name":"","cmdJson":"{\"cmd\":\"cmdMoveToPositionDegSync\",\"arg\":[180,20,0]}","isErrStop":true,"x":290,"y":680,"wires":[["751a2c4c.ed4b74"]]},{"id":"8f7ac2c8.748cd","type":"km-motor-sequencer","z":"f340ce8a.f7ff2","name":"","cmdJson":"{\"cmd\":\"cmdEnable\"}","isErrStop":true,"x":520,"y":520,"wires":[["a3e4c1fb.f78be"]]},{"id":"dc51f5f4.a77e48","type":"comment","z":"f340ce8a.f7ff2","name":"複雑な回転往復(絶対座標による制御)","info":"","x":200,"y":460,"wires":[]},{"id":"751a2c4c.ed4b74","type":"delay","z":"f340ce8a.f7ff2","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":580,"y":680,"wires":[["985cd262.9661f"]]},{"id":"985cd262.9661f","type":"km-motor-sequencer","z":"f340ce8a.f7ff2","name":"","cmdJson":"{\"cmd\":\"cmdMoveToPositionDegSync\",\"arg\":[360,20,0]}","isErrStop":true,"x":870,"y":680,"wires":[["a1a4ec26.78343"]]},{"id":"25041591.60365a","type":"km-motor-sequencer","z":"f340ce8a.f7ff2","name":"","cmdJson":"{\"cmd\":\"cmdPresetPosition\",\"arg\":[0]}","isErrStop":true,"x":1530,"y":520,"wires":[["97ac4c56.51fdb"]]},{"id":"97ac4c56.51fdb","type":"delay","z":"f340ce8a.f7ff2","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1760,"y":520,"wires":[["a96acc36.dc22f"]]},{"id":"a1a4ec26.78343","type":"delay","z":"f340ce8a.f7ff2","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1160,"y":680,"wires":[["6b7f48bb.846878"]]},{"id":"6b7f48bb.846878","type":"km-motor-sequencer","z":"f340ce8a.f7ff2","name":"","cmdJson":"{\"cmd\":\"cmdMoveToPositionDegSync\",\"arg\":[0,40,0]}","isErrStop":true,"x":1440,"y":680,"wires":[["a96acc36.dc22f"]]},{"id":"76680d79.f13114","type":"comment","z":"f340ce8a.f7ff2","name":"現在位置を原点として絶対座標を0にリセット","info":"","x":1550,"y":480,"wires":[]},{"id":"6d62e0e1.7df48","type":"comment","z":"f340ce8a.f7ff2","name":"繰り返し 右180度20rpm回転→3秒停止→右180度20rpm回転→3秒停止→原点に40rpmで戻る","info":"","x":400,"y":600,"wires":[]},{"id":"71a1dad5.e4d3c4","type":"comment","z":"f340ce8a.f7ff2","name":"注意 無限ループ防止の為、ループをする場合は「エラー時にメッセージの伝播を停止する」のチェックは必ず入れて下さい","info":"","x":490,"y":640,"wires":[]},{"id":"2f888c67.67e7c4","type":"km-motor-sequencer","z":"f340ce8a.f7ff2","name":"","cmdJson":"{\"cmd\":\"cmdMotorMeasurementInterval\",\"arg\":[7]}","isErrStop":true,"x":870,"y":300,"wires":[["98a0552b.470618"]]},{"id":"a3e4c1fb.f78be","type":"km-motor-sequencer","z":"f340ce8a.f7ff2","name":"","cmdJson":"{\"cmd\":\"cmdMotorMeasurementInterval\",\"arg\":[7]}","isErrStop":true,"x":830,"y":520,"wires":[["6d44edb4.9ae1b4"]]},{"id":"10ddb33a.5293bd","type":"comment","z":"f340ce8a.f7ff2","name":"不要な通知を停止","info":"MotorMeasurementの通知間隔が短い場合、繰り返し動作時にモーターからの完了情報を受信出来ない場合があります。\nMotorMeasurementの通知間隔を大きくする事で繰り返しの安定性を計ります。","x":730,"y":480,"wires":[]},{"id":"1011cb47.41ae65","type":"comment","z":"f340ce8a.f7ff2","name":"不要な通知を停止","info":"MotorMeasurementの通知間隔が短い場合、繰り返し動作時にモーターからの完了情報を受信出来ない場合があります。\nMotorMeasurementの通知間隔を大きくする事で繰り返しの安定性を計ります。","x":770,"y":260,"wires":[]},{"id":"4839de92.a3133","type":"km-motor-usb-selector","z":"f340ce8a.f7ff2","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":true,"isMotorKeepalive":false,"x":300,"y":160,"wires":[[]]},{"id":"2495b0fa.567ca","type":"comment","z":"f340ce8a.f7ff2","name":"モーターの認識","info":"モーターの認識処理を行います","x":120,"y":100,"wires":[]},{"id":"59cb0c6b.74dda4","type":"inject","z":"f340ce8a.f7ff2","name":"","topic":"","payload":"scan","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"0.5","x":130,"y":160,"wires":[["4839de92.a3133"]]},{"id":"44beb474.7badfc","type":"comment","z":"f340ce8a.f7ff2","name":"Node-RED起動後にモーターを接続した場合は、再度scanする必要がある","info":"","x":660,"y":160,"wires":[]},{"id":"98a0552b.470618","type":"km-motor-sequencer","z":"f340ce8a.f7ff2","name":"","cmdJson":"{\"cmd\":\"cmdEnableMotorMeasurement\"}","isErrStop":true,"x":1240,"y":300,"wires":[["cf3e431c.ab4d2"]]},{"id":"6d44edb4.9ae1b4","type":"km-motor-sequencer","z":"f340ce8a.f7ff2","name":"","cmdJson":"{\"cmd\":\"cmdEnableMotorMeasurement\"}","isErrStop":true,"x":1200,"y":520,"wires":[["25041591.60365a"]]}]

 

モーターの値取得

KeiganMotor の設定値、モーターログ、回転情報を取得し、Debugタブに表示するフロー

[{"id":"28bb7c8d.cecce4","type":"tab","label":"モーターの値取得","disabled":false,"info":""},{"id":"1ef79ec9.956e31","type":"km-motor-usb-selector","z":"28bb7c8d.cecce4","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":false,"isMotorKeepalive":false,"x":300,"y":160,"wires":[["712fd066.157ca"]]},{"id":"5d1b3973.6e8f08","type":"inject","z":"28bb7c8d.cecce4","name":"true","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":160,"wires":[["1ef79ec9.956e31"]]},{"id":"712fd066.157ca","type":"km-motor-sequencer","z":"28bb7c8d.cecce4","name":"","cmdJson":"{\"cmd\":\"cmdReadRegister\",\"arg\":[70]}","isErrStop":true,"x":570,"y":160,"wires":[["64c259.a015cda8"]]},{"id":"64c259.a015cda8","type":"debug","z":"28bb7c8d.cecce4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":830,"y":160,"wires":[]},{"id":"b653ff8e.7b562","type":"comment","z":"28bb7c8d.cecce4","name":"モーターの設定値の取得 (debugタブに表示されます)","info":"","x":240,"y":100,"wires":[]},{"id":"7e58964.9df9768","type":"km-motor-usb-selector","z":"28bb7c8d.cecce4","name":"","selectMotorName":"","isInitializScan":false,"isMotorKeepalive":false,"x":300,"y":220,"wires":[["5886dd8e.56e084"]]},{"id":"99b4a850.6b5818","type":"inject","z":"28bb7c8d.cecce4","name":"true","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":220,"wires":[["7e58964.9df9768"]]},{"id":"5886dd8e.56e084","type":"km-motor-sequencer","z":"28bb7c8d.cecce4","name":"","cmdJson":"{\"cmd\":\"cmdReadAllRegister\"}","isErrStop":true,"x":550,"y":220,"wires":[["b53af95.b821d08"]]},{"id":"b53af95.b821d08","type":"debug","z":"28bb7c8d.cecce4","name":"cmdReadAllRegister","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":860,"y":220,"wires":[]},{"id":"cbf81b30.8e8968","type":"comment","z":"28bb7c8d.cecce4","name":"モーター名","info":"","x":1060,"y":160,"wires":[]},{"id":"605c1d42.8f36e4","type":"comment","z":"28bb7c8d.cecce4","name":"全設定値","info":"","x":1060,"y":220,"wires":[]},{"id":"46e5baa9.0b4c84","type":"comment","z":"28bb7c8d.cecce4","name":"※モーターの誤動作を防止する為、使用しないフロータブは無効化して下さい。","info":"","x":300,"y":40,"wires":[]},{"id":"c96cc3ed.9e19f","type":"comment","z":"28bb7c8d.cecce4","name":"回転情報の取得 (debugタブに表示されます)","info":"","x":210,"y":620,"wires":[]},{"id":"3f8e4f09.efe12","type":"km-motor-usb-selector","z":"28bb7c8d.cecce4","name":"","selectMotorName":"","isInitializScan":false,"isMotorKeepalive":false,"x":300,"y":700,"wires":[["43f80f40.628c5"]]},{"id":"e3a56c2a.ab91f","type":"inject","z":"28bb7c8d.cecce4","name":"true","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":700,"wires":[["3f8e4f09.efe12"]]},{"id":"43f80f40.628c5","type":"km-motor-sequencer","z":"28bb7c8d.cecce4","name":"","cmdJson":"{\"cmd\":\"onMotorMeasurement\"}","isErrStop":true,"x":560,"y":700,"wires":[["6f4fa19e.b5d5c"]]},{"id":"6f4fa19e.b5d5c","type":"debug","z":"28bb7c8d.cecce4","name":"motorMeasurement","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":810,"y":700,"wires":[]},{"id":"46b39c29.b3f9d4","type":"comment","z":"28bb7c8d.cecce4","name":"一度実行すると後続ノードに定期的(10ms毎)に通知が送られる。通知間隔はcmdMotorMeasurementIntervalで変更可能","info":"","x":820,"y":660,"wires":[]},{"id":"2e6a11e0.4a416e","type":"comment","z":"28bb7c8d.cecce4","name":"回転情報は msg.payloadに出力される","info":"","x":1090,"y":700,"wires":[]},{"id":"a220a651.e2cc48","type":"comment","z":"28bb7c8d.cecce4","name":"モーターログの取得 (debugタブに表示されます)","info":"","x":220,"y":320,"wires":[]},{"id":"27a381be.2851ae","type":"km-motor-usb-selector","z":"28bb7c8d.cecce4","name":"","selectMotorName":"","isInitializScan":false,"isMotorKeepalive":false,"x":300,"y":380,"wires":[["6272f358.361abc","2d03f1b8.b5f5ee"]]},{"id":"ee1d50d7.4e4e9","type":"inject","z":"28bb7c8d.cecce4","name":"true","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":380,"wires":[["27a381be.2851ae"]]},{"id":"6272f358.361abc","type":"km-motor-sequencer","z":"28bb7c8d.cecce4","name":"","cmdJson":"{\"cmd\":\"onMotorLog\"}","isErrStop":true,"x":540,"y":380,"wires":[["2ef631d.fe1dfce"]]},{"id":"2ef631d.fe1dfce","type":"debug","z":"28bb7c8d.cecce4","name":"motorLog","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":780,"y":380,"wires":[]},{"id":"de3f6724.31ade8","type":"comment","z":"28bb7c8d.cecce4","name":"コマンド実行毎に msg.payloadに出力される","info":"","x":1050,"y":380,"wires":[]},{"id":"2d03f1b8.b5f5ee","type":"km-motor-sequencer","z":"28bb7c8d.cecce4","name":"","cmdJson":"{\"cmd\":\"cmdEnable\"}","isErrStop":true,"x":540,"y":480,"wires":[["3859508b.ce0f9"]]},{"id":"9899eff4.b4e9e","type":"km-motor-sequencer","z":"28bb7c8d.cecce4","name":"","cmdJson":"{\"cmd\":\"cmdMoveByDistance\",\"arg\":[1.57,3.14]}","isErrStop":true,"x":990,"y":480,"wires":[["c9b39ae8.664f08"]]},{"id":"8692ee66.8ac2a","type":"comment","z":"28bb7c8d.cecce4","name":"モーター回転毎に、実行結果のログが出力されます","info":"","x":850,"y":440,"wires":[]},{"id":"3859508b.ce0f9","type":"delay","z":"28bb7c8d.cecce4","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":720,"y":480,"wires":[["9899eff4.b4e9e"]]},{"id":"e199ca73.2528c8","type":"km-motor-sequencer","z":"28bb7c8d.cecce4","name":"","cmdJson":"{\"cmd\":\"cmdMoveByDistance\",\"arg\":[1.57,3.14]}","isErrStop":true,"x":990,"y":520,"wires":[["e08c4e1a.c00cd"]]},{"id":"c9b39ae8.664f08","type":"delay","z":"28bb7c8d.cecce4","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":720,"y":520,"wires":[["e199ca73.2528c8"]]},{"id":"e8e97314.cd576","type":"km-motor-sequencer","z":"28bb7c8d.cecce4","name":"","cmdJson":"{\"cmd\":\"cmdMoveByDistance\",\"arg\":[1.57,3.14]}","isErrStop":true,"x":990,"y":560,"wires":[[]]},{"id":"e08c4e1a.c00cd","type":"delay","z":"28bb7c8d.cecce4","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":720,"y":560,"wires":[["e8e97314.cd576"]]},{"id":"b2ef0ae0.f8d588","type":"km-motor-usb-selector","z":"28bb7c8d.cecce4","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":false,"isMotorKeepalive":false,"x":300,"y":840,"wires":[["4e3a54e2.d0aa4c"]]},{"id":"8dda33eb.af1bc","type":"inject","z":"28bb7c8d.cecce4","name":"Stop","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":840,"wires":[["b2ef0ae0.f8d588"]]},{"id":"4e3a54e2.d0aa4c","type":"km-motor-sequencer","z":"28bb7c8d.cecce4","name":"","cmdJson":"{\"cmd\":\"cmdDisable\"}","isErrStop":true,"x":520,"y":840,"wires":[[]]},{"id":"f959fe75.7a973","type":"comment","z":"28bb7c8d.cecce4","name":"モーター停止","info":"","x":110,"y":780,"wires":[]},{"id":"4c2d7e51.5e4bf","type":"km-motor-usb-selector","z":"28bb7c8d.cecce4","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":true,"isMotorKeepalive":false,"x":300,"y":960,"wires":[[]]},{"id":"3928fc00.097b54","type":"inject","z":"28bb7c8d.cecce4","name":"","topic":"","payload":"scan","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"0.5","x":130,"y":960,"wires":[["4c2d7e51.5e4bf"]]},{"id":"7de70612.478b58","type":"comment","z":"28bb7c8d.cecce4","name":"入力に文字列\"scan\"を入れるとモーターを再検出します","info":"","x":600,"y":960,"wires":[]},{"id":"a3bf71cf.3d9d4","type":"comment","z":"28bb7c8d.cecce4","name":"モーターの再検出(通常は使用しません。フロー実行中に新しいモーターを接続した場合にのみ使用)","info":"","x":390,"y":920,"wires":[]}]

Dashboard からの制御(回転)

Dashboard にKeiganMotor の回転情報を表示し、各ボタンから回転操作を行うフロー

Dashboard(WebブラウザからNode-REDを操作するGUI)からモーターの情報表示と操作がおこなえます。
このフローはDashboardを使用します。実行時にNode-REDエディターからDashboardを表示して下さい。

[{"id":"ada3b6b2.b66778","type":"tab","label":"Dashboardからの制御(回転)","disabled":false,"info":""},{"id":"a13030c8.45cd1","type":"comment","z":"ada3b6b2.b66778","name":"モーターの回転情報を表示する","info":"","x":150,"y":280,"wires":[]},{"id":"9da541d3.52b1d","type":"comment","z":"ada3b6b2.b66778","name":"操作ボタン  右のタブからDashboardを表示して下さい","info":"","x":230,"y":560,"wires":[]},{"id":"12ef8c5d.e2d6b4","type":"ui_button","z":"ada3b6b2.b66778","name":"Stop","group":"172e4fed.8ff15","order":9,"width":0,"height":0,"passthru":false,"label":"Stop","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"cmd\":\"cmdStop\"}","payloadType":"json","topic":"0","x":110,"y":860,"wires":[["223ede67.35ff22"]]},{"id":"f69d38f3.b8c878","type":"ui_button","z":"ada3b6b2.b66778","name":"Move By 180deg","group":"172e4fed.8ff15","order":7,"width":4,"height":1,"passthru":false,"label":"Move By 180deg","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"0","x":150,"y":740,"wires":[["93105b8b.8559b8"]]},{"id":"b1649aaa.7b5368","type":"ui_button","z":"ada3b6b2.b66778","name":"Move By -180deg","group":"172e4fed.8ff15","order":8,"width":4,"height":1,"passthru":false,"label":"Move By -180deg","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"0","x":150,"y":800,"wires":[["311ccb3f.f60904"]]},{"id":"64629e47.d1dcf","type":"ui_button","z":"ada3b6b2.b66778","name":"Run Forward","group":"172e4fed.8ff15","order":5,"width":4,"height":1,"passthru":false,"label":"Run Forward","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"0","x":130,"y":620,"wires":[["accf16ad.0c0548"]]},{"id":"b83e3bd.ff97ac8","type":"comment","z":"ada3b6b2.b66778","name":"※モーターの誤動作を防止する為、使用しないフロータブは無効化して下さい。","info":"","x":300,"y":40,"wires":[]},{"id":"5d1fa666.a0b928","type":"comment","z":"ada3b6b2.b66778","name":"このフローはDashboardを使用します、右のタブからDashboardを表示して下さい。","info":"","x":310,"y":80,"wires":[]},{"id":"93105b8b.8559b8","type":"km-motor-usb-selector","z":"ada3b6b2.b66778","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":true,"isMotorKeepalive":true,"x":340,"y":740,"wires":[["b892e9e1.e65ec8"]]},{"id":"1e5dbba1.85e514","type":"km-motor-usb-selector","z":"ada3b6b2.b66778","name":"","selectMotorName":"","isInitializScan":false,"isMotorKeepalive":false,"x":400,"y":340,"wires":[["a16ad144.2db03","44735bf8.4df164","d757d216.99cf7"]]},{"id":"1ed0e728.1bb269","type":"inject","z":"ada3b6b2.b66778","name":"回転情報表示 自動実行","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":true,"onceDelay":"2","x":170,"y":340,"wires":[["1e5dbba1.85e514"]]},{"id":"a16ad144.2db03","type":"km-motor-sequencer","z":"ada3b6b2.b66778","name":"","cmdJson":"{\"cmd\":\"onMotorMeasurement\"}","isErrStop":true,"x":660,"y":340,"wires":[["c7f302ee.b51c6","8f09fee1.b0e63","67b6cc5f.307144"]]},{"id":"44735bf8.4df164","type":"km-motor-sequencer","z":"ada3b6b2.b66778","name":"","cmdJson":"{\"cmd\":\"onMotorLog\"}","isErrStop":true,"x":620,"y":400,"wires":[["88a8a6db.da1538","3bf6111a.2720de"]]},{"id":"88a8a6db.da1538","type":"debug","z":"ada3b6b2.b66778","name":"motorLog","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":940,"y":500,"wires":[]},{"id":"38657bea.455b94","type":"ui_chart","z":"ada3b6b2.b66778","name":"","group":"172e4fed.8ff15","order":1,"width":8,"height":3,"label":"position (radian)","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"-50","ymax":"50","removeOlder":"5","removeOlderPoints":"50","removeOlderUnit":"1","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":1120,"y":340,"wires":[[]]},{"id":"c7f302ee.b51c6","type":"change","z":"ada3b6b2.b66778","name":"position","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.position","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":340,"wires":[["38657bea.455b94"]]},{"id":"8f09fee1.b0e63","type":"change","z":"ada3b6b2.b66778","name":"velocity","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.velocity","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":380,"wires":[["655a8d1c.663d34"]]},{"id":"67b6cc5f.307144","type":"change","z":"ada3b6b2.b66778","name":"torque","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.torque","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":420,"wires":[["744844ed.d3c13c"]]},{"id":"655a8d1c.663d34","type":"ui_gauge","z":"ada3b6b2.b66778","name":"","group":"172e4fed.8ff15","order":2,"width":4,"height":3,"gtype":"gage","title":"velocity (radian/sec)","label":"units","format":"{{value}}","min":"-20","max":"20","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1140,"y":380,"wires":[]},{"id":"744844ed.d3c13c","type":"ui_gauge","z":"ada3b6b2.b66778","name":"","group":"172e4fed.8ff15","order":3,"width":4,"height":3,"gtype":"gage","title":"torque (N・m)","label":"units","format":"{{value}}","min":"-1","max":"1","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1120,"y":420,"wires":[]},{"id":"223ede67.35ff22","type":"km-motor-usb-selector","z":"ada3b6b2.b66778","name":"","selectMotorName":"","isInitializScan":false,"isMotorKeepalive":false,"x":340,"y":860,"wires":[["95791f86.89e35"]]},{"id":"95791f86.89e35","type":"km-motor-sequencer","z":"ada3b6b2.b66778","name":"","cmdJson":"{\"cmd\":\"cmdDisable\"}","isErrStop":true,"x":540,"y":860,"wires":[[]]},{"id":"3bf6111a.2720de","type":"ui_template","z":"ada3b6b2.b66778","group":"172e4fed.8ff15","name":"","order":4,"width":8,"height":2,"format":"<div ng-bind-html=\"msg.payload.errType\"></div>\n<div ng-bind-html=\"msg.payload.errMsg\"></div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":940,"y":460,"wires":[[]]},{"id":"311ccb3f.f60904","type":"km-motor-usb-selector","z":"ada3b6b2.b66778","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":true,"isMotorKeepalive":true,"x":340,"y":800,"wires":[["64fdc64e.ef39d8"]]},{"id":"30658875.ee48c8","type":"km-motor-sequencer","z":"ada3b6b2.b66778","name":"","cmdJson":"{\"cmd\":\"cmdMoveByDistanceDeg\",\"arg\":[180,10]}","isErrStop":true,"x":850,"y":740,"wires":[[]]},{"id":"caf68997.549e48","type":"km-motor-sequencer","z":"ada3b6b2.b66778","name":"","cmdJson":"{\"cmd\":\"cmdMoveByDistanceDeg\",\"arg\":[-180,10]}","isErrStop":true,"x":850,"y":800,"wires":[[]]},{"id":"accf16ad.0c0548","type":"km-motor-usb-selector","z":"ada3b6b2.b66778","name":"","selectMotorName":"","isInitializScan":false,"isMotorKeepalive":false,"x":320,"y":620,"wires":[["ae916d91.a2f1c"]]},{"id":"ae916d91.a2f1c","type":"km-motor-sequencer","z":"ada3b6b2.b66778","name":"","cmdJson":"{\"cmd\":\"cmdEnable\"}","isErrStop":true,"x":540,"y":620,"wires":[["3da5f280.b96a8e"]]},{"id":"3da5f280.b96a8e","type":"km-motor-sequencer","z":"ada3b6b2.b66778","name":"","cmdJson":"{\"cmd\":\"cmdRun_rpm\",\"arg\":[10]}","isErrStop":true,"x":800,"y":620,"wires":[[]]},{"id":"1049bf07.ea8931","type":"ui_button","z":"ada3b6b2.b66778","name":"Run Reverse","group":"172e4fed.8ff15","order":6,"width":4,"height":1,"passthru":false,"label":"Run Reverse","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"0","x":130,"y":680,"wires":[["e3bb6f9c.caacb"]]},{"id":"e3bb6f9c.caacb","type":"km-motor-usb-selector","z":"ada3b6b2.b66778","name":"","selectMotorName":"","isInitializScan":false,"isMotorKeepalive":false,"x":320,"y":680,"wires":[["6f778f39.9ad53"]]},{"id":"6f778f39.9ad53","type":"km-motor-sequencer","z":"ada3b6b2.b66778","name":"","cmdJson":"{\"cmd\":\"cmdEnable\"}","isErrStop":true,"x":540,"y":680,"wires":[["2ca07341.ad0abc"]]},{"id":"2ca07341.ad0abc","type":"km-motor-sequencer","z":"ada3b6b2.b66778","name":"","cmdJson":"{\"cmd\":\"cmdRun_rpm\",\"arg\":[-10]}","isErrStop":true,"x":800,"y":680,"wires":[[]]},{"id":"64fdc64e.ef39d8","type":"km-motor-sequencer","z":"ada3b6b2.b66778","name":"","cmdJson":"{\"cmd\":\"cmdEnable\"}","isErrStop":true,"x":540,"y":800,"wires":[["caf68997.549e48"]]},{"id":"b892e9e1.e65ec8","type":"km-motor-sequencer","z":"ada3b6b2.b66778","name":"","cmdJson":"{\"cmd\":\"cmdEnable\"}","isErrStop":true,"x":540,"y":740,"wires":[["30658875.ee48c8"]]},{"id":"d757d216.99cf7","type":"km-motor-sequencer","z":"ada3b6b2.b66778","name":"","cmdJson":"{\"cmd\":\"cmdPresetPosition\",\"arg\":[0]}","isErrStop":true,"x":670,"y":500,"wires":[[]]},{"id":"f517d535.b09a48","type":"comment","z":"ada3b6b2.b66778","name":"モーター座標の初期化","info":"","x":620,"y":460,"wires":[]},{"id":"e78ba98b.aff3b8","type":"km-motor-usb-selector","z":"ada3b6b2.b66778","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":false,"isMotorKeepalive":false,"x":280,"y":1000,"wires":[["ee0e7014.21f1"]]},{"id":"3825423.38c17be","type":"inject","z":"ada3b6b2.b66778","name":"Stop","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":1000,"wires":[["e78ba98b.aff3b8"]]},{"id":"ee0e7014.21f1","type":"km-motor-sequencer","z":"ada3b6b2.b66778","name":"","cmdJson":"{\"cmd\":\"cmdDisable\"}","isErrStop":true,"x":480,"y":1000,"wires":[[]]},{"id":"d302307d.49c33","type":"comment","z":"ada3b6b2.b66778","name":"モーター停止","info":"","x":90,"y":940,"wires":[]},{"id":"ea791d7.49bd2e","type":"km-motor-usb-selector","z":"ada3b6b2.b66778","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":true,"isMotorKeepalive":false,"x":280,"y":180,"wires":[[]]},{"id":"a637a97c.e84ec8","type":"comment","z":"ada3b6b2.b66778","name":"モーターの認識","info":"モーターの認識処理を行います","x":100,"y":140,"wires":[]},{"id":"9b339a67.acb9b8","type":"inject","z":"ada3b6b2.b66778","name":"","topic":"","payload":"scan","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"0.5","x":110,"y":180,"wires":[["ea791d7.49bd2e"]]},{"id":"6c2204a2.e0302c","type":"comment","z":"ada3b6b2.b66778","name":"Node-RED起動後にモーターを接続した場合は、再度scanする必要がある","info":"","x":640,"y":180,"wires":[]},{"id":"172e4fed.8ff15","type":"ui_group","z":"","name":"Dashboardからの制御(回転)","tab":"d5ed60de.eb9c2","order":1,"disp":false,"width":"8","collapse":false},{"id":"d5ed60de.eb9c2","type":"ui_tab","z":"","name":"Dashboardからの制御(回転)","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

Dashboard からの制御(座標)

Dashboard から速度、座標、トルクを入力し、リアルタイムに位置制御を行うフロー

Dashboard からの入力に応じて、コマンドのパラメータを動的に変更する事で、リアルタイムな制御が可能になります。


Dashboard から速度、座標、トルクを設定してリアルタイムに位置制御がおこなえます。
このフローはDashboard を使用します。
実行時にNode-REDエディターからDashboardを表示して下さい。

[{"id":"1310c0a9.5a858f","type":"tab","label":"Dashboardからの制御(座標)","disabled":false,"info":""},{"id":"140e4026.6557f","type":"comment","z":"1310c0a9.5a858f","name":"※モーターの誤動作を防止する為、使用しないフロータブは無効化して下さい。","info":"","x":300,"y":40,"wires":[]},{"id":"af484089.14e9e","type":"comment","z":"1310c0a9.5a858f","name":"このフローでは操作ボタン表示の為Dashboardを使用しています、右のタブからDashboardを表示して下さい。","info":"","x":400,"y":80,"wires":[]},{"id":"8ddef66d.a37798","type":"comment","z":"1310c0a9.5a858f","name":"速度、座標、トルクを入力し、リアルタイムに位置制御を行う","info":"","x":240,"y":140,"wires":[]},{"id":"17dde86b.7ec1d8","type":"ui_slider","z":"1310c0a9.5a858f","name":"","label":"Speed (Radian/sec)","tooltip":"","group":"f9969c77.4cd4d","order":2,"width":0,"height":0,"passthru":false,"outs":"end","topic":"","min":"0","max":"200","step":1,"x":690,"y":340,"wires":[["59720f11.5b2f1"]]},{"id":"b5eb4a60.1a4768","type":"ui_button","z":"1310c0a9.5a858f","name":"Stop","group":"f9969c77.4cd4d","order":6,"width":0,"height":0,"passthru":false,"label":"Stop","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"cmd\":\"cmdStop\"}","payloadType":"json","topic":"0","x":130,"y":660,"wires":[["e8a797dc.71fdf8"]]},{"id":"b3618c22.fb9cb","type":"km-motor-usb-selector","z":"1310c0a9.5a858f","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":false,"isMotorKeepalive":false,"x":500,"y":500,"wires":[["ad2c813f.08605"]]},{"id":"e8a797dc.71fdf8","type":"km-motor-usb-selector","z":"1310c0a9.5a858f","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":false,"isMotorKeepalive":false,"x":400,"y":660,"wires":[["398fa0c5.599e2"]]},{"id":"398fa0c5.599e2","type":"km-motor-sequencer","z":"1310c0a9.5a858f","name":"","cmdJson":"{\"cmd\":\"cmdDisable\"}","isErrStop":true,"x":620,"y":660,"wires":[[]]},{"id":"59720f11.5b2f1","type":"change","z":"1310c0a9.5a858f","name":"","rules":[{"t":"set","p":"speed","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":920,"y":340,"wires":[["b3618c22.fb9cb"]]},{"id":"e184f703.114c78","type":"change","z":"1310c0a9.5a858f","name":"","rules":[{"t":"set","p":"speed","pt":"flow","to":"5","tot":"num"},{"t":"set","p":"payload","pt":"msg","to":"speed","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":340,"wires":[["17dde86b.7ec1d8"]]},{"id":"d8f416c0.2c7108","type":"comment","z":"1310c0a9.5a858f","name":"Speed初期値設定、スライダーに初期値設定","info":"","x":1230,"y":340,"wires":[]},{"id":"72337697.14e438","type":"comment","z":"1310c0a9.5a858f","name":"flow.speedの値を使用してモーターの速度を設定する","info":"","x":620,"y":460,"wires":[]},{"id":"c043a8d5.48f848","type":"ui_slider","z":"1310c0a9.5a858f","name":"","label":"Distance (Radian)","tooltip":"","group":"f9969c77.4cd4d","order":3,"width":0,"height":0,"passthru":false,"outs":"end","topic":"","min":"-31.4","max":"31.4","step":"0.1","x":690,"y":400,"wires":[["f235f680.98ad98"]]},{"id":"f235f680.98ad98","type":"change","z":"1310c0a9.5a858f","name":"","rules":[{"t":"set","p":"distance","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":400,"wires":[["b3618c22.fb9cb"]]},{"id":"ad2c813f.08605","type":"km-motor-sequencer","z":"1310c0a9.5a858f","name":"","cmdJson":"{\"cmd\":\"cmdEnable\"}","isErrStop":true,"x":720,"y":500,"wires":[["a8f1f9f0.2851e8"]]},{"id":"a8f1f9f0.2851e8","type":"change","z":"1310c0a9.5a858f","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$join([$string($flowContext(\"distance\"))\t,$string($flowContext(\"speed\")),\"0\"], \",\")\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":500,"wires":[["51b63e33.83d24"]]},{"id":"e02d27cc.008e88","type":"change","z":"1310c0a9.5a858f","name":"","rules":[{"t":"set","p":"distance","pt":"flow","to":"0","tot":"num"},{"t":"set","p":"payload","pt":"msg","to":"distance","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":400,"wires":[["c043a8d5.48f848"]]},{"id":"51b63e33.83d24","type":"km-motor-sequencer","z":"1310c0a9.5a858f","name":"","cmdJson":"{\"cmd\":\"cmdMoveToPosition\",\"arg\":\"msg.payload\"}","isErrStop":true,"x":1260,"y":500,"wires":[[]]},{"id":"12841747.2c28a9","type":"km-motor-usb-selector","z":"1310c0a9.5a858f","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":false,"isMotorKeepalive":false,"x":460,"y":180,"wires":[["e5cf011c.d434f","8eba421e.618e7"]]},{"id":"79162274.cf3f0c","type":"inject","z":"1310c0a9.5a858f","name":"初期設定 自動実行","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":"2","x":170,"y":180,"wires":[["12841747.2c28a9","e184f703.114c78","e02d27cc.008e88","b512f473.0a3af8"]]},{"id":"e5cf011c.d434f","type":"km-motor-sequencer","z":"1310c0a9.5a858f","name":"","cmdJson":"{\"cmd\":\"cmdPresetPosition\",\"arg\":[0]}","isErrStop":true,"x":750,"y":260,"wires":[[]]},{"id":"72fe938.e5d826c","type":"comment","z":"1310c0a9.5a858f","name":"モーター絶対座標の初期化","info":"","x":1030,"y":260,"wires":[]},{"id":"7f54773b.ea8848","type":"comment","z":"1310c0a9.5a858f","name":"モーター座標のグラフ化","info":"","x":1390,"y":180,"wires":[]},{"id":"8eba421e.618e7","type":"km-motor-sequencer","z":"1310c0a9.5a858f","name":"","cmdJson":"{\"cmd\":\"onMotorMeasurement\"}","isErrStop":true,"x":740,"y":180,"wires":[["3bfaac86.c0b744"]]},{"id":"f7be8adb.b72888","type":"ui_chart","z":"1310c0a9.5a858f","name":"","group":"f9969c77.4cd4d","order":1,"width":0,"height":0,"label":"Position (Radian)","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"-40","ymax":"40","removeOlder":"5","removeOlderPoints":"50","removeOlderUnit":"1","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":1170,"y":180,"wires":[[]]},{"id":"3bfaac86.c0b744","type":"change","z":"1310c0a9.5a858f","name":"position","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.position","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":980,"y":180,"wires":[["f7be8adb.b72888"]]},{"id":"d76da236.7c56e","type":"comment","z":"1310c0a9.5a858f","name":"Distance初期値設定、スライダーに初期値設定","info":"","x":1230,"y":400,"wires":[]},{"id":"4c6d4542.a80dcc","type":"km-motor-usb-selector","z":"1310c0a9.5a858f","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":false,"isMotorKeepalive":false,"x":280,"y":780,"wires":[["49468982.bc1248"]]},{"id":"c42924be.8ef388","type":"inject","z":"1310c0a9.5a858f","name":"Stop","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":780,"wires":[["4c6d4542.a80dcc"]]},{"id":"49468982.bc1248","type":"km-motor-sequencer","z":"1310c0a9.5a858f","name":"","cmdJson":"{\"cmd\":\"cmdDisable\"}","isErrStop":true,"x":480,"y":780,"wires":[[]]},{"id":"fdf3fee1.3a36f","type":"comment","z":"1310c0a9.5a858f","name":"モーター停止","info":"","x":90,"y":720,"wires":[]},{"id":"8814aa79.bafa48","type":"km-motor-usb-selector","z":"1310c0a9.5a858f","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":true,"isMotorKeepalive":false,"x":280,"y":900,"wires":[[]]},{"id":"cc1dbb74.298cb8","type":"inject","z":"1310c0a9.5a858f","name":"","topic":"","payload":"scan","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"0.5","x":110,"y":900,"wires":[["8814aa79.bafa48"]]},{"id":"ea7c995d.00d828","type":"comment","z":"1310c0a9.5a858f","name":"入力に文字列\"scan\"を入れるとモーターを再検出します","info":"","x":580,"y":900,"wires":[]},{"id":"2ff59413.f954cc","type":"comment","z":"1310c0a9.5a858f","name":"モーターの再検出(通常は使用しません。フロー実行中に新しいモーターを接続した場合にのみ使用)","info":"","x":370,"y":860,"wires":[]},{"id":"fe117277.322a7","type":"ui_slider","z":"1310c0a9.5a858f","name":"","label":"Torque","tooltip":"","group":"f9969c77.4cd4d","order":4,"width":0,"height":0,"passthru":false,"outs":"end","topic":"","min":"0","max":"1","step":"0.01","x":630,"y":600,"wires":[["f9f1f250.3108"]]},{"id":"f9f1f250.3108","type":"km-motor-usb-selector","z":"1310c0a9.5a858f","name":"","selectMotorName":"","selectMotorNameself":false,"isInitializScan":false,"isMotorKeepalive":false,"x":820,"y":600,"wires":[["75bce6e5.430d28"]]},{"id":"75bce6e5.430d28","type":"km-motor-sequencer","z":"1310c0a9.5a858f","name":"","cmdJson":"{\"cmd\":\"cmdMaxTorque\",\"arg\":\"msg.payload\"}","isErrStop":true,"x":1110,"y":600,"wires":[[]]},{"id":"b512f473.0a3af8","type":"change","z":"1310c0a9.5a858f","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":600,"wires":[["fe117277.322a7"]]},{"id":"86cb548d.438168","type":"comment","z":"1310c0a9.5a858f","name":"トルク初期値設定","info":"","x":470,"y":560,"wires":[]},{"id":"f9969c77.4cd4d","type":"ui_group","z":"","name":"Dashboardからの制御(座標)","tab":"ff246c2b.4566a","order":1,"disp":false,"width":"8","collapse":false},{"id":"ff246c2b.4566a","type":"ui_tab","z":"","name":"Dashboardからの制御(座標)","icon":"dashboard","order":2,"disabled":false,"hidden":false}]

物理PUSHボタンでシャットダウン

GPIOに接続した物理ボタンを長押しする事で、KeiganPiをシャットダウンするサンプルです。
物理PUSHボタンはKeiganPiに附属の物やそれ以外も使用可能です。
物理PUSHボタンの接続例はこちらをご覧下さい。

[{"id":"6bd8bb0f.230f34","type":"tab","label":"物理ボタンでシステム停止","disabled":false,"info":""},{"id":"ca9251f0.c458a","type":"trigger","z":"6bd8bb0f.230f34","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"3","extend":true,"units":"s","reset":"","bytopic":"all","name":"","x":240,"y":100,"wires":[["d3733c30.21589"]]},{"id":"704ea072.ed857","type":"comment","z":"6bd8bb0f.230f34","name":"物理ボタン(赤)3秒間長押しでシャットダウン","info":"","x":200,"y":60,"wires":[]},{"id":"64b0d0d2.2796c","type":"rpi-gpio in","z":"6bd8bb0f.230f34","name":"","pin":"37","intype":"up","debounce":"25","read":false,"x":120,"y":440,"wires":[["f1c3383a.01e558"]]},{"id":"f1c3383a.01e558","type":"debug","z":"6bd8bb0f.230f34","name":"緑ボタン","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":340,"y":440,"wires":[]},{"id":"59d06999.edc778","type":"rpi-gpio in","z":"6bd8bb0f.230f34","name":"","pin":"35","intype":"up","debounce":"25","read":false,"x":120,"y":500,"wires":[["f5631aeb.5fb468"]]},{"id":"d919b8e2.3c60f8","type":"rpi-gpio in","z":"6bd8bb0f.230f34","name":"","pin":"33","intype":"up","debounce":"25","read":false,"x":120,"y":560,"wires":[["f02cefc9.478cc"]]},{"id":"f5631aeb.5fb468","type":"debug","z":"6bd8bb0f.230f34","name":"黄色ボタン","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":350,"y":500,"wires":[]},{"id":"e1d4239b.7b5b","type":"comment","z":"6bd8bb0f.230f34","name":"物理ボタンの動作確認 https://docs.keigan-motor.com/keiganpi/add_button","info":"","x":290,"y":360,"wires":[]},{"id":"f02cefc9.478cc","type":"debug","z":"6bd8bb0f.230f34","name":"赤ボタン","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":340,"y":560,"wires":[]},{"id":"4070b6a3.d073a8","type":"comment","z":"6bd8bb0f.230f34","name":"物理ボタン押下で「0」離すと「1」","info":"","x":200,"y":400,"wires":[]},{"id":"2cf88ced.a10314","type":"rpi-gpio in","z":"6bd8bb0f.230f34","name":"","pin":"33","intype":"up","debounce":"25","read":false,"x":100,"y":100,"wires":[["ca9251f0.c458a"]]},{"id":"d3733c30.21589","type":"switch","z":"6bd8bb0f.230f34","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":370,"y":100,"wires":[["799b569b.9d6c18"],[]]},{"id":"84fc2d97.8b36a","type":"inject","z":"6bd8bb0f.230f34","name":"RasPi 再起動","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":350,"y":180,"wires":[["850e8317.20561"]]},{"id":"b0ece292.162f6","type":"inject","z":"6bd8bb0f.230f34","name":"NodeRed 再起動","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":360,"y":260,"wires":[["f5fb0c36.2ee1e"]]},{"id":"799b569b.9d6c18","type":"exec","z":"6bd8bb0f.230f34","command":"sudo halt -p","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"RasPi シャットダウン","x":600,"y":100,"wires":[[],[],["fba73a7f.4f2f28"]]},{"id":"fba73a7f.4f2f28","type":"debug","z":"6bd8bb0f.230f34","name":"System Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":850,"y":100,"wires":[]},{"id":"f5fb0c36.2ee1e","type":"exec","z":"6bd8bb0f.230f34","command":"node-red-restart","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"NodeRed 再起動","x":590,"y":260,"wires":[[],[],["fba73a7f.4f2f28"]]},{"id":"850e8317.20561","type":"exec","z":"6bd8bb0f.230f34","command":"sudo reboot","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"RasPi 再起動","x":570,"y":180,"wires":[[],[],["fba73a7f.4f2f28"]]}]

リモート操作ドリー

遠隔地にある2台のKeiganPiを中継サーバーを介して接続し、コントロールします。

接続構成

  • KeiganPiを2つ用意し、片方は操作側、もう片方はKeiganMotorと接続してドリーを操作する受信側とします。
  • お互いをMQTTサーバーと接続します 。
  • MQTTサーバーにはクラウドサービスのビーボットを使用します。

 このデモに使用するフロー

※フローファイルはzip形式で圧縮されています、ダウンロード後解凍して使用して下さい。

 ビーボットの設定

  • https://beebotte.com/ にアクセスし必要な情報を入力しアカウントを作成。作成したアカウントでログイン。
  • My ChannelsからCreate Newボタンを押して新規Channelを作成
  • 以下の赤ワクの部分のみ入力。
    Channel Nameに「nodeRedTwoWheeledCar」
    Resources Nameに「node_red_two_wheeled」

 認証に必要なtokenを控える

Channels > チャンネル名(nodeRedTwoWheeledCar) をクリック。
Channel Tokenの「token_XXXXXXXXXXX」をコピーして控えておく。

 受信側の設定

  • 2台のKeiganMotorとモバイルバッテリーを用意し、USBTYPECポートに接続して給電。
  • KeiganPiとUSBハブを繋ぐ 。(※ keiganPiで複数のモーターを接続する場合の制限 )
  • USBハブと2台のKeiganMotorのUSBポートを接続。
  • KeiganPiを立ち上げ、WIFIかLANに接続しておく。
  • KeiganPiのNode-REDエディターから次のデモフローを読み込む。
    MQTTCar.json
  • 読み込んだフローを一旦デプロイ。

フローのUSBSelectorノード部分を自分のモーターに変更する。

 MQTTノードの設定

Beebotte の CA 証明書をダウンロードし、MQTTノードに設定する。

先ほど控えたChannel Tokenの「token_XXXXXXXXXXX」をMQTTノードに設定する。

フローをデプロイしてMQTTノードとKeiganMotorノードに接続済みと表示されれば設定完了。

 コントローラー側の設定

  • KeiganPiを立ち上げ、WIFIかLANに接続しておく。
  • KeiganPiのNode-REDエディターから次のデモフローを読み込む。

    MQTTCarController.json
  • 読み込んだフローを一旦デプロイ。

読み込んだフローをデプロイ後、ダッシュボードから以下の操作画面を表示する。
(ダッシュボードはhttp://[KeiganPiのIPアドレス]:1880/ui/ で表示できます)

ダッシュボードから操作すると受信側のモーターが動きます(動画)