Motor “from Xiaomi”

As you know, movement is life. And step-by-step movement is a reliable path to any goal (even if this goal is simply moving in a circle). So I, lazily moving along the endless feed of goods of the Chinese marketplace, came across an unusual gadget. This miracle of Chinese engineering is called “Xiaomi Cyber ​​Gear”, and you can't pass by these three words calmly if you live in 2024.

In fact, this is not even a gadget, but a component for Xiaomi Cyber ​​Dog. This robot dog is not as popular on YouTube and in Russia as products from Unitree, but apparently popular enough to sell spare parts for it. However, DIY enthusiasts, to which I count myself, may also be interested in this motor.

Let me just say right away that the price for one piece is about a hundred dollars and this is not what you want as an addition to a blinking LED. It seems that robotic arms, robotic legs and other expensive and powerful devices would be more suitable projects for using this miracle of technology.

They meet you in a box, and they see you off in a crate… In general, we are met by a beautiful cardboard box, like from a smartphone, not some antistatic bag. Inside the box there is Chinese propaganda, a QR code for WiChat with a cat-wife, radically black damping foam and the motor itself. Also black.

The first impression of it, in fact, like any Xiaomi gadget, is the impression of a very expensive, almost premium thing (in the photo I already grabbed this thing, sorry, I couldn’t resist).

The most important thing that can be said about this engine is that it is a stepper engine with a built-in encoder and controller, interaction with which occurs via a CAN bus at a speed of 1 Mbit. The engine is powered by 24 volts, the maximum pure revolutions are about three hundred per minute, the minimum is very slow. Details can be read in the reference booklet from the box.

Xie xie!

Xie xie!

The motor has its own companion app for Windows, from which you can send test commands to the motor, watch the sensor readings. From it you can also… update the motor's firmware. But I didn't bother with the app, since it's entirely in Chinese.

Another interesting fact. I found a socketcan-based motor driver on GitHub, it was written, unexpectedly, in Swift, at that moment I learned that Swift for the server exists and is quite alive. After a short rolling-in stage, I even liked it. There is a certain ease in it. However, we are not here today to talk about that.

Power supply and CAN bus

Power supply and CAN bus

The driver communicates with the engine via the CAN bus, allows you to control the speed in the engine mode “speed”, the angle of rotation and speed in the positioning mode “location”, also allows you to control the current in the “current” mode, but I have not tried it, perhaps this is for the robot dog and imitation of muscle work, and I had a different type of load.

The engine is very powerful, in my opinion, you can't stop it with your hands. The encoder is precise, but not very precise, you have to play “get me to the right condition” with it in several steps at different speeds. It reminds me of… but let's not talk about that.

I controlled the engine from RPi 4 + CAN hat (but it also works with a regular MCP2515 and with the built-in ESP32 can-driver). There, inside RPi, I wrote the code via VSCode Remote + Swift, as I said, everything turned out quite easy and convenient, the engine is already described by high-level classes and methods, I didn’t have to think about bytes at all. The code looks something like this:

let motorA = CyberGear.Motor(canID: 017, bus: canBusA)
try! motorA.runMode(.speed)
try! motorA.enable()

The video demonstrates a smooth increase in speed (in a loop and via Task.sleep(), sorry, good people)

The sound is most reminiscent of a trolleybus or an electric scooter, and apparently that's how it should be.

Overall, a very nice DIY component, modern and convenient. This is exactly the component in the project (which I will never tell about) with which there were no problems. Plugged it in and forgot about it. I recommend it.

Similar Posts

Leave a Reply

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