Xiaomi CyberGear Micromotor clashes with the M5Stack

Hey, techies! Ready for a feast of torque and creativity? Today, we're going to take you on a journey to explore the fantastic linkage between M5Stack Basic V2.7 and Xiaomi's Cybergear to instantly 'move' your projects!
 

H/W Components (ESP32 + CAN Transceiver Unit)

Xiaomi CyberGear Micromotor

Xiaomi CyberGear Micromotor

View Product
M5Stack LAN Module W5500 with PoE V12

M5Stack LAN Module W5500 with PoE V12

View Product
M5Stack Basic V2.7

M5Stack Basic V2.7

View Product
CANBus Unit

CANBus Unit

View Product

 

How to use Official GUI tool

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.
YourCee USB-TTL/RS232/RS485/CAN Serial Communication Module

YourCee USB-TTL/RS232/RS485/CAN Serial Communication Module

View Product
 

How to run a sample

Arduino IDE

  1. 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 git@github.com:project-sternbergia/arduino-CAN.git
git clone https://github.com/project-sternbergia/cybergear_m5.git
  1. Put this file in the same folder as control_mode_example.ino (for Arduino IDE)
  2. Build and write firmware to M5Stack

 

Sample Code

control_mode_example.ino

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
 

cybergear_bilateral.ino

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

Leave a comment

Your email address will not be published. Required fields are marked *

Register for our newsletter

Get the latest information about our products and special offers.