DYNAMIXEL Motor Control Using Python+pyserial+windows+VSCode


I want to control XM540-W270-T/R servo using python serial library+U2D2+VSCode+Windows.

I am very very new with the python and dynamixel.

I want to send HEX data to the motor. I have write a small code it can send HEX data to U2D2. But can’t receive data or can’t rotate the motor.

import time
import serial
from time import sleep

send_rec = serial.Serial(
baudrate = 1000000,

while True:
data_1 = b’\xFF\xFF\xFD\x00\x01\x09\x00\x03\x74\x00\x00\x02\x00\x00\xCA\x89’

data_2 = '\xFF\xFF\xFD\x00\x01\x04\x00\x55\x00\xA1\x0C'
b = send_rec.write(b'data_1')
a = send_rec.write(b'data_2')
x = send_rec.readline()

Could you please help me on this issue? I just want to send some data packet over pyserial communication and receive over pyserial communication.

I need just a simple educational stuff, I don’t need “DYNAMIXEL_SDK”. Because, I think its confusing.

Thanks, Simon

Note: I think, I made a mistake, when I chose to use DYNAMIXEL servo for my university ROBOT project. Because, very very less educational stuff available on internet. Some example/sample code can’t find “dynamixel_funtion.py” file in dynamixelSDK. It doesn’t work.


XM540-W270-R - (Quantity over 50 pc)

DYNAMIXEL Controller:


Software Interface:

python serial library+U2D2+VSCode+Windows.

I would definitely recommend the use of the DYNAMIXEL SDK python library for this. Otherwise you will need to implement a lot of low level functions required for proper communications with DYNAMIXEL actuators.

Dear Jonathon,

Thank you very very much for your response.

I am a student at an University in Japan, “I want to learn about this motor from very low level”.

If it is possible, could you please give a simple example that, how to write HEX Packet data to Servo for educational purpose? for example, PING or LED_Blink or Rotation. Any small example will help me to learn lot about this actuator.

If it is not possible, could you please take a look at below screen short. I have tried to use python DYNAMIXEL SDK.

  • But, I received an error [TxRxResult] There is no status packet!. I am using, vsCode+python+U2D2+windows 11+extarnel power supply from oscilloscope.

I think there is communication error. I really appreciate any advice or suggestions.

On the other hand, I have also tried to run, sample python example code from ROBOTIS website, but it says, “there is no dynamixel_funtion.py file or function”.

DYNMIXEL SDK is very confusing, on ROBOTIS website one type code but, on gitHub its completely deferent code with different function. I understand, it is possible to achieve goal with different code. But, I don’t understand why they have created all this mess confusion.

Please try to understand, me and my team, we are students not professional. Could you please give us any advice?

Thanks in advance,



For Windows installation have you seen these Robotis videos?

Seemed to have more details but it is using the Atom IDE so perhaps you can adapt it to VSCode? I adapted it to plain IDLE and it was working OK for me.


For a reference on low level packet generation for DYNAMIXEL servos, I’d recommend that you take a look at the source code for the DYNAMIXEL SDK.

Hopefully that should give you a good start on how to implement your own solution for your learning.