I’ve got my Cybergear working in basic closed loop torque mode (no current sense). Thanks to @Candas1 for giving me a head start with the hardware specific gd32 code. I’ll start looking at current sense next and maybe write a can commander-like interface.
Velocity mode is hard to tune, particularly at low speed no load - I think that might be related to the gears. I have to remind myself that these velocity wobbles won’t be so bad on other side of the gears.
How would one connect multiple actuators on a single CAN line? Most CAN based actuators I’ve seen (Moteus, MyActuator) look like they have CANH and CANL input and output connectors to daisy chain the actuators. Splice an extra XT30 (2+2) cable in and terminate at the last actuator with a resistor?
That depends on the setup. For short connections you can also use star wireing, for longer ones daisy chain as you mentioned or whatever is electromechanicaly suitable. Important is though to have the termination properly, typically one resistor at either end, so exactly two.
On a related note, from my measurements/memory the cyberdog has a 240ohm resistor across canh/canl. Which implies to me that they might expect 4 cybergears on the bus. I know you are supposed to have two 120 ohms at either end but i don’t think it has to be that way.
My canbus setup is a 120ohm on my can/serial usb + 240 from cybergears which i think works out to be 80ohms. This world fine.
Splicing some cables seems reasonable, you have to make them anyway as I’ve never seen XT30 (2+2) connectors with cables for sale
Interestingly if you search Aliexpress for ‘cybergear’ now there are XT30 (2+2) connectors with cables that show near the top of the results.
Very nice, I was looking for these for a long time and never found them. Thanks for the advice.
Just in case, I created an English translation of Cybergear instruction manual in markdown with translated (most of) drawings here - https://github.com/belovictor/cybergear-docs/blob/main/instructionmanual/instructionmanual.md , feel free to open issues if you find mistakes or to propose a better translation. I also collected a small list of links about Cybergear as information about it is very fragmented though the drive is very interesting and I use it in my project https://github.com/belovictor/cybergear-docs/tree/main
Best regards,
Victor Belov
Thanks for compiling that! I’ve also been scouring Bilibili (like a chinese YouTube) and CSDN (like a Chinese Stack Overflow?) for CyberGear info. I’ve been gathering a list of GitHub and Gitee (Chinese GitHub) repositories referenced from these searches as well and can contribute if you want to add to your repository.
Wow, that’s really. a deep dive into unknown I would be glad to add those to my list. You can add an issue with links or give me some time to browse and categorise this myself. Thanks for sharing!
Best regards,
Victor Belov
This was motivated by me being too lazy to write a library to control the CyberGear with SocketCAN. In my searching I found libraries for ESP32 (both for the M5 stack, and utilizing the TWAI protocol, which will probably be more generally useful), Arduino and STM32. Ironically just as I gave up and started writing a SocketCAN library I think I just found one (in Chinese, of course). I’ll be testing it shortly but at this point I’m also already writing my own. Once I get all this crap organized I’ll be sending some links your way!
I created a python library that controls the motor using python-can and tested successfully on a Jetson Nano using the on-board CAN header via SocketCAN. Python-can supports a bunch of interfaces including PCAN, USB2CAN, SocketCAN and serial, so connectivity options are flexible.
I’m curious how everyone is planning to control these motors. Should I continue building out a python library? Write something in c/cpp? Are most people going to be using an Arduino/ESP32/STM32 instead?
I’m still working on a simplefoc replacement firmware for the cybergear. Will be controlling a couple of cybergears from esp32 or a jetson nano. I can control the motor over can from my linux laptop (using python-can). I’m currently banging my head on getting ADC/DMA working properly for the low side current sense. But as I’m learning loads I don’t mind if it takes me a few weeks/months. Closed loop already works (with on board as5047p).
My CAN interface will be different from xioami firmware, it would be super difficult to make it identical and I think it is a bit ugly/confusing anyway.
I’m pretty novice in this area, but I know is never to late to learn. Could you please share some info on how you used the Jetson to control the motors? I still waiting for my can controller to arrive from Aliexpress to use with arduino.
Thank you
I’m still working on my code for use with a Jetson. If you’re going to be using an Arduino I would check out this library: GitHub - DanielKalicki/Xiaomi_CyberGear_Arduino: Arduino TWAI library for Xiaomi CyberGear
In case this is useful to others. I read out all the registers in the 6EDL7141 driver after loading the stock xiaomi firmware without power-cycling in between.
0090 0000000010010000 FAULT_ST
0040 0000000001000000
0814 0000100000010100
0090 0000000010010000
0000 0000000000000000
0001 0000000000000001
0000 0000000000000000
0006 0000000000000110 DEVICE_ID
0000 0000000000000000 FAULTS_CLR
7008 0111000000001000 SUPPLY_CFG
0000 0000000000000000
0001 0000000000000001
0001 0000000000000001
0000 0000000000000000
0000 0000000000000000
FFFF 1111111111111111
00FD 0000000011111101
3206 0011001000000110
142E 0001010000101110
0101 0000000100000001
0000 0000000000000000
0064 0000000001100100
0800 0000100000000000
0000 0000000000000000 OTP_PROG
Looks like they’ve configured the DT_RISE and DT_FALL to low values (200ns) and the CS_GAIN to 20V/V. One thing I’m confused about is that the FUNC_ST register shows that DVDD is configured to 5V. Am i reading that right? I tested it on two of these motors, and I see the same thing. Does that mean there is some other circuitry to convert the 5V output of the driver IC to 3.3V?
They’ve also set VREF to 1/3 DVDD. When I read the currents with the ADC on the GD32, they are centered at around 2048 which is approx 1.65 V which is what you’d expect 1/3 DVDD to be if DVDD were in fact 5V and not 3.3V. So it looks like the driver is indeed configured to output 5V.
@Rajesh_Poddar - this is useful for me. I still haven’t managed to get current sense working and it may have something to do with how the 6EDL7141 configured or me setting up adc/dma. At the moment I’m reading noise from the adc of one of the current sense pins, slightly higher than 2048.
I haven’t got the readings aligned with the PWM peaks yet so it might be that too.
I’ve set the vref to 1/3 dvdd and set dead time to 200ns and csgain to 20v/v. I’ve also enabled the two cs amps associated with phase b and c.
It looks like the resolution of the current measurements as per Xiaomi’s debug tools is 0.040283 A which, if I’m doing the math right, translates to a current sense resistance of 1 milli-ohm.
Hi everyone not sure if this is the right place to post but I am quite lost. I’m very new to all this and I have been trying to connect my Cybergear motor to Arduino for a project.
My current setup includes:
Cybergear Actuator (Powered by (Li-Poly) Tattu 22.2 V 1550mAh battery) → I2C CAN-BUS Module based on MCP2551 and MCP2515 → SparkFun Thing Plus - ESP32.
I have been trying out the code from the github pages but they return errors or are beyond my comprehension.
I appreciate any help!
Thanks,
Bryan