Auto Switch Controller

© CC BY 4+ visibility390
© CC BY 4+
visibility390

Nintendo Switchの操作を自動化できるLINE Botです。

動画
開発素材
システム構成
system image

M5ATOMのSwitchコントローラー化

SwitchControllerESP32を使用し、M5ATOMからコントローラー信号をUSB経由でNintendo Switchへ送信しています。

M5ATOMのリアルタイム制御切り替え

M5ATOMのリアルタイム制御切り替えにはopnizを使用しています。
opnizはデバイス側へopniz Arduinoライブラリ書き込むことでRaspberry PiやPC、クラウドからTypeScript/JavaScriptでデバイスを制御できるようにできるフレームワークです。

今回M5ATOMへはSwitchControllerESP32をプラグイン化しopniz Arduinoライブラリへインポートしています。
またRaspberry Piにてopniz Node.js SDKを使用しM5ATOMを制御しています。

LINE Botからの制御

Nintendo Switchコントローラーのマクロを気軽に登録、実行できるようユーザーインターフェースとしてLINE Botを提供しています。
LINE Botではチャット形式でのマクロ実行に加え、定型マクロの登録やワンタイムおよび繰り返し実行をサポートしています。

LINE Botでの操作内容はLINEサーバー、そしてngrokを経由しRaspberry Piへ送信されます。
Raspberry Piでは送られてきたマクロ内容をパースし、結果に沿ったコントローラー操作コマンドをopnizにてM5ATOMへ送信されます。



Converting M5ATOM to Switch Controller

Using SwitchControllerESP32, controller signals are sent from M5ATOM to Nintendo Switch via USB.

Real-time control switching of M5ATOM

opniz](https://github.com/miso-develop/opniz) is used for real-time control switching of M5ATOM.
opniz is a framework that enables devices to be controlled by TypeScript/JavaScript from Raspberry Pi, PC, or the cloud by writing the opniz Arduino library to the device side.

This time, SwitchControllerESP32 is plugged into M5ATOM and imported into the opniz Arduino library.
Also, M5ATOM is controlled by Raspberry Pi using opniz Node.js SDK.

Control from LINE Bot

We provide LINE Bot as a user interface to easily register and execute macros for Nintendo Switch controllers.
In addition to chat-style macro execution, LINE Bot supports the registration of fixed macros and one-time and repeated execution.

LINE Bot operations are sent to the LINE server and via ngrok to the Raspberry Pi.
The Raspberry Pi parses the sent macro contents and sends the resulting controller operation commands to M5ATOM via opniz.

ストーリー

きっかけ

こどもがPokémon LEGENDS アルセウスというゲームを遊んでいるのですが、このゲームのエンドコンテンツの攻略にはレベル100が基本となってきます。
このゲームでは特定の条件下でAボタンを連打しているだけで自動でレベルが上がっていくという、古き良きレベル上げ法があるのですがレベル100を目指すと数時間の連打が必要となってきます。
1日30分しかゲームを許可されていないこどもが、その貴重な30分をAボタン連打に費やしてく様はとても見ていられるものではなかったため、M5ATOMをNintendo Switchコントローラー化して自動化してみました。

opniz化

Aボタン連打だけであればSwitchControllerESP32で実装したコードをM5ATOMへ1度書き込んで終わりです。
Pokémon LEGENDS アルセウスのみであればそれで十分でしたが、他のゲームでももう少し複雑なステップで自動化が行えそうでした。
毎回コードを書き換えてはM5ATOMに書き込みを繰り返すのは面倒なので、opnizに対応させ処理をホットスワップ可能としました。

LINE Bot対応

opniz化により様々なSwitch操作マクロをM5ATOMへの再書き込み不要で簡単に切り替えられるようになりましたが、マクロの記述にはTypeScriptでのコードが必要でした。
そこでコーディング不要でこども自身でマクロを定義できるようにしたいと思い、LINE Botへ対応させました。
定型マクロの保存や、繰り返し実行も簡単に行えるため、こども自身でマクロを組んでゲームを自動化できるようになりました。

めでたしめでたし🤗



Trigger

My child was playing a game called Pokémon LEGENDS Arceus. Level 100 is the basic level for the end content of this game.
In this game, there is a good old method of leveling up where you just have to keep hitting the A button under certain conditions and the game will automatically level up, but it took me several hours of continuous hitting to reach level 100.
I couldn't stand to see my child, who is only allowed to play the game for 30 minutes a day, spend those precious 30 minutes hitting the A button.

opnization

If you only want to use the A button, just write the code implemented in SwitchControllerESP32 to M5ATOM once and you're done.
That was sufficient for only Pokémon LEGENDS Arceus, but it would have been possible to automate other games with more complex steps.
It would be tedious to rewrite the code and write it to M5ATOM every time, so we added support for opniz and made it possible to hot-swap the process.

LINE Bot Support

With opniz, various switch operation macros can be easily switched without rewriting to M5ATOM, but TypeScript code was required to write the macros.
We wanted to make it possible for children to define their own macros without the need for coding, so we added support for LINE Bot.
Now, children can create their own macros and automate games by themselves, since they can easily save and repeat the macro.

Congratulations!🤗

メンバー
  • user
    田中みそ @miso_develop

関連イベント
  • event M5Stack Japan Creativity Contest 20242024-06-01 開催
  • event ヒーローズ・リーグ 20242024-09-02 開催
関連リンク
user
ばんの @tomoki_banno

YouTubeで紹介させていただきました!
https://youtube.com/live/zQwMDeuOhWw

user
田中みそ @miso_develop

@tomoki_banno
ご紹介いただきありがとうございました!!


同じニオイがする作品
  • event スマートねこじゃらし
  • event 測定器をとことん使い倒したいと頑張ってみた結果…
  • event Cube Scrambler
  • event M5 Paper Home Assistant Dashboard

Proto lovers ♥
user
user
user
user
user
user

作品を登録しよう

モノづくりしている人に、つくった作品を見てもらえ、リアクションがもらえるかも?

close

目次


Proto lovers ♥
user
user
user
user
user
user