This project is a firmware for M5Stack developed by a team of instructors for the participants of NEWVIEW SCHOOL 2021 TAIPEI, a workshop on xR (VR/AR/MR), to enable them to create DIY controllers.
The M5Stack is a toolkit that allows you to easily create various IoT projects by simply connecting sensors and other units with cables. The controller functions as a Bluetooth keyboard, sending keyboard events to the device in response to input from sensors, buttons, etc.
Instead of just accepting a pre-made controller as a constraint and using it as it is, by thinking about what a suitable controller for your work should be and realizing it, you may be able to create a work that expands the concept of VR and AR.
該項目是由講師團隊為參加NEWVIEW SCHOOL 2021 台北 xR (VR/AR/MR)研討會的參與者開發的M5Stack固件,使他們能夠創建DIY控制器。
M5Stack是一個工具包,讓您只需用模組連接線連接感測器和其他單元,即可輕鬆創建各種物聯網項目。控制器用作藍牙鍵盤,將鍵盤事件發送到設備以響應來自感測器、按鈕等的輸入。
不再受限於既有的控制器,讓你可以創造不同體驗的控制器去實現你對VR與AR的概念及創意
このプロジェクトは、xR(VR/AR/MR)に関するワークショップ「NEWVIEW SCHOOL 2021 TAIPEI」参加者のために講師チームが開発した、DIYでコントローラを制作できるようにするためのM5Stack用ファームウェアです。
M5Stackは、センサなどのユニットをケーブルで接続するだけで簡単に多彩なIoTプロジェクトを実現できるツールキットです。M5Stackとこのファームウェアを組み合わせることにより、電子工作やプログラミングの経験がない人でも、短時間でDIYコントローラを制作できるでしょう。コントローラはBluetoothキーボードとして機能し、センサやボタンなどの入力に応じたキーボードイベントをデバイスに送信します。
あらかじめ用意されたコントローラを制約条件として受け入れてそのまま用いるのでなく、自分の作品に適したコントローラはどうあるべきかから考えて実現することにより、VRやARの概念を拡張するような作品を制作できるかもしれません。
- Mini Dual Button Unit
- Light Sensor Unit
- I2C Joystick Unit
- Distance Ranging Sensor Unit
- TVOC/eCO2 Gas Sensor Unit
- Mini RFID Reader/Writer Unit
- 12 Key Capacitive I2C Touch Sensor V3 by Seeed Studio
- Oculus Quest 2 - STYLY app (from App Lab)
- Windows - STYLY VR app
- Windows - Chrome
- macOS - Chrome
- iOS/iPadOS - STYLY app
- Android - STYLY app
The connected Unit(s) input is transmitted on three different channels: analog, joystick, and buttons. The analog and joystick channels can handle up to one sensor Unit input for each at once, and the buttons channel can handle up to six button inputs simultaneously.
Unit | Port | Channel | Pattern A | Pattern B | Pattern C | Pattern D | Pattern E | Pattern F |
---|---|---|---|---|---|---|---|---|
Dual Button | B | Buttons | 💡 | 💡 | 💡 | 💡 | ||
Light Sensor | B | Analog | 💡 | 💡 | ||||
Joystick | A | Joystick | 💡 | 💡 | 💡 | 💡 | ||
Gas Sensor | A | Analog | 💡 | 💡 | ||||
Ranging Sensor | A | Analog | 💡 | 💡 | ||||
Touch Sensor | A | Buttons | 💡 | 💡 | 💡 | |||
RFID Reader | A | Buttons | 💡 | 💡 | 💡 |
- If you want to connect multiple Units to port A, please connect via a 1 to 3 HUB Expansion Unit.
- When a Ranging Sensor Unit is connected, you can't use a Joystick Unit nor Gas Sensor Unit.
- To change the connection, double-click the power button on the left side of the M5Stack controller to turn off the power (you cannot turn it off while it is connected to a USB port).
- Download M5Burner for your platform from the official website
- Extract and launch the M5Burner (move to your Applications folder before launching on macOS)
- Choose the serial port in the
COM
menu on the top-left corner - Choose "HID_Input_Framework_for_xR" from the projects
- Click on the
Download
button of the project - Once finished downloading, the
Download
button becomes theBurn
button - Click on the
Burn
button to burn the firmware
- Choose a pattern from the table above and connect Unit(s) to your M5Stack controller (e.g., M5Stack FIRE)
- Power on your M5Stack controller
- If you want to use Dual Button, Light Sensor, or RFID reader, please refer to the "How to setup" section and setup
- Connect the controller as a Bluetooth device to your device (please follow standard instruction for the device)
- Open the Test_Gamepad scene in a browser and bring the browser frontmost
- Press the
Send
(C) button to start sending - Control the joystick, sensor, etc.
- Once confirmed, press the
Stop
(C) button again to stop sending
- Press the
Setup
(A) button to enter the preferences screen - Press the
Next
(C) button (if needed) to choose thePORT B: NONE
line - Press the
Go
(B) button - Press the
-
(A) or+
(C) button to be matched to the device connected to the Port B (i.e.,DUAL BUTTON
orLIGHT
) - Press the
Done
(B) button - Press the
Exit
(A) button to back to the main screen
- Press the
Setup
(A) button to enter the preferences screen - Press the
Next
(C) button (if needed) to choose theRFID 1: **:**:**:**
line - Press the
Go
(B) button - Press the
Reset
(C) button - Put an RFID Tag on the RFID Unit, then remove the Tag
- Press the
Next
(C) button to choose the next line - Repeat from step 3 for 3 times to register the remaining 3 RFID Tags
- Press the
Exit
(A) button to back to the main screen
- "alt. controller" is shown as connected but no input to the STYLY scene. → Please try to unpair the controller in the Bluetooth preference and pair it again.
- Bluetooth connection status on my controller keeps switching between
Connected
andDisconnected
when not connected. → The controller might have been paired with an old host (i.e., a PC or smartphone). If you no longer use the controller with the host, please remove the device from the host.
- Keys in green: used in STYLY Web Player
- Keys in yellow: used for the Analog channel
- Keys in orange: used for the Joystick channel
- Keys in red: used for the Buttons channel
Analog value | Key |
---|---|
0 | ` |
1 | 1 |
2 | 2 |
3 | 3 |
4 | 4 |
5 | 5 |
6 | 6 |
7 | 7 |
8 | 8 |
9 | 9 |
10 | 0 |
Joystick | Key |
---|---|
Left-Up | y |
Up | u |
Right-Up | i |
Left | h |
Center | j |
Right | k |
Left-Down | n |
Down | m |
Right-Down | , |
No. | Name | Key | Assigned input |
---|---|---|---|
1 | Fire1 | v | Dual Button - Red |
2 | Fire2 | b | Dual Button - Blue |
3 | Fire3 | f | Touch Sensor - CH0 |
4 | Jump | g | Touch Sensor - CH1 |
5 | r | Touch Sensor - CH2 | |
6 | t | Touch Sensor - CH3 |
- Windows
- English: M5Core Quick Start - Arduino Win
- Chinese (simplified): M5Core 的上手指南 - Arduino Win
- macOS
- English: M5Core Quick Start - Arduino Mac
- Chinese (simplified): M5Core 的上手指南 - Arduino Mac
- M5Stack Library by M5Stack
- ESP32 BLE Keyboard library by T-vK
- VL53L0X library for Arduino by Pololu
- Adafruit SGP30 Gas / Air Quality I2C sensor by Adafruit
- Adafruit MPR121 Library by Adafruit
- Download the ESP32 BLE Keyboard library (don’t have to extract after downloading)
- In the Arduino IDE, navigate to Sketch → Include Library → Add .ZIP Library...
- Select the file you just downloaded
- In the Arduino IDE, navigate to Tools → Manage Libraries...
- Type in a part of each library (i.e.,
VL53L0X
,Adafruit SGP30
, andAdafruit MPR121
) in the text field in the top right corner, choose the right library and press the install button - Repeat the second step for all required libraries
- Regarding the VL53L0X library, please install the one by Pololu, not by Adafruit.
- If you want to install the latest stable ESP32 SDK, please put the Stable release link described in the Arduino core for the ESP32 project's document and install the esp32 board package instead of the M5Stack board package. Please don't confuse this with the M5Stack library; we definitely need the library.
- The included MFRC522 I2C Library is from the RFID_RC522 example in the public domain, originally developed by arozcan based on the findings of the pioneers and modified by M5Stack.
- To avoid the noise problem regarding the A button on the M5Stack, the discussion between @mikasa231 san and @lovyan03 san on Twitter helped us.
- The technique for detecting that an RFIF tag has been removed was implemented by referring to the example proposed by uluzox and modified for cooperative multitasking.