Dynamixel protocol with Simplefoc

Hello!

I share here a little piece of code I did to make a library that can be plugged to SimpleFoc using a Dynamixel Protocol.
Since the SimpleFoc is a nice project, shared and opensource, I prefer to release this code as GPL.
Also I’m not a hardcore coder and this is a WIP so please be kind :slight_smile:

Here is the link : https://github.com/robotsmith/SimpleFocDXLCore
Feel free to use, reuse, modify, enjoy.

Cheers!

4 Likes

This is interesting. I had a look at the video and didn’t quite get it. What is the physical layer of the protocol?

Well, Video is a bit messy I think ^^
The protocol is based on halfduplex UART.
It contains kind of memory direct access with CRC.

The main interest here is to have daisy chained servomotors with a robust protocol.
Also the Dynamixel is quite used and you have a lot of master compatible hardware.
This is quite used in educational robotics :stuck_out_tongue:

1 Like

Why not CAN? Daisychaining uart especially in a noisy environment is not robust.

CAN is clearly the best of course.
The idea here was to have a know protocol for hobbyist. Also usually it use the half duplex RS485, in TTL the solution is also cheap compared to an additional chip for CAN.
We use dynamixel in some project I needed something compatible with that.
Also I don’t have in my knowledge a generic CAN protocol, opensource well known.
I’m fully aware that is not the optimal solution! :stuck_out_tongue: Just a pragmatic one for me.

There is one I’m using but requires a can controller. Upside is that it’s generic, that is, works on any MCU using generic SPI, so you use generic SPI to send/receive CAN. SPI is very widely supported, unlike CAN which is very MCU specific.

You can daisychain as many as you want.

I’ve limited it to 125kbps with impedance end resistors for best noise control but you could go up to 1mbps with good wires and no resistor.

Nice!
But sure I did design for my work some board with CAN. But one of the problem was we had to create fully new protocol to communicate. And Today I don’t know any generic protocol, well known that exist.
Correct me if I’m wrong but Odrive use Odrive protocol, tinymvr use his own protocol, etc…
No one use a generic protocol, I think it’s clearly missing (sadly).
Would be cool, also way off my reach, to have a generic protocol to communicate between any device. I guess it might be outdated and things like Luos strategy is interesting.

By generic protocol you mean application level protocol not the physical/first layer like CAN or UART?

Yes, application level ones do not exist. I wrote my own, too. Not a big deal, I need something very simple like direction, speed, torque, angle, temperature, error, etc. in a simple payload, with a few unique motor/device identifiers.

Yep I meant application level protocol :slight_smile:
But well, for arduino hobbyist that is not that simple I believe :stuck_out_tongue:
I usually working with arduino coders that are not sharper as you are and using arduino for hardware purposes.

1 Like

I can see the Dynamixel thing being pretty handy!

If starting from scratch you maybe wouldn’t use it, but lots of robots have existing code for Dynamixel and this might be an easy way to upgrade those.

@Valentine are you using CANopen - Wikipedia or something else?

I’m not familiar with CANOpen. I’m using CAN 2.0B and CAN FD as supported in silicon by the controller, that’s the whole point of using a controller and not worrying about the protocol. You solve all the messed up coding CANBus issues with a simple chip and two wires.

Plus you also side-step all licensing and CANBus HAL crap bullsh*t with the chip manufacturers.

1 Like

Hi @Sam, thanks for the answer.

oO You mean as Dynamixel device not as master? Do you have example? I only found one example Dynaban opensource firmware that seamed to me complex to connect with SimpleFoc. Or maybe I didn’t understand your explanation ^^

Thanks!

1 Like

I meant if you have an existing robot all set up & using Dynamixels, you might want to upgrade the hardware to BLDC/SimpleFoc without having to change all your code.

1 Like