M5 stack library for cybergear
"Remember, with great torque comes great responsibility."
- Arduino for ESP32
- M5Stack Basic V2.7
- Xiaomi Cybergear
- M5Stack Basic V2.7
- LAN Module W5500 with PoE V12 or CANBus Unit(CA-IS3050G)
- XT30(2+2)-F
- Grove Cable
This software requires a specific CAN to USB module. The official documentation recommends YourCee's USB to CAN module, which supports the serial protocol with a frame header of 41 54 and frame tail of 0D 0A, but this is not readily available, so we searched Aliexpress for an alternative. ※ Note that this will not work for general modules.
Tested(for reference):
- Clone MCP_CAN_LIB and cygergear_m5 to Arduino Library directory.
cd ~/Arduino/libraries
git clone https://github.com/coryjfowler/MCP_CAN_lib.git
git clone https://github.com/Locoduino/RingBuffer.git
git clone [email protected]:project-sternbergia/arduino-CAN.git
git clone https://github.com/project-sternbergia/cybergear_m5.git
-
Open cybergear_m5/examples/control_mode_example.ino with Arduino IDE
Put this file in the same folder as control_mode_example.ino (for Arduino IDE)
-
Build and write firmware to M5Stack
Check cybergear behaviour using M5 stack.
- Middle Button - Change Control Mode (Position Mode -> Speed Mode -> Current Mode)
- Right Button - Increase control value
- Left Button - Decrease control value
This example use two cybergears for leader and follower. Before you test this example, please change cybergear can id as follows. After that write cybergear_m5/examples/cybergear_bilateral.ino to m5 stack throughout Arduino IDE.
- leader cybergear : 0x7F
- follower cybergear : 0x7E
MIT