Speed control of a LSS servo motor using a Raspberry


I require your help regarding a problem I’m encountering.

Description: i trying to make a PID corretor to control the servomotor’s speed using a raspberry . the LSS.py library does not give me much liberty to control the spped the only functions given are move and move relative … there is no function move PWM or something similar . any help ?

Hardware concerned: Raspberry, LSS servo motor

Software concerned: Python

Troubleshooting steps already taken: i made a PID to correct position at first but it did not give me the result i wanted as i want to control the speed .

Additional information:

Thank you so much in advance for your help!

1 Like

@derbel199 Welcome to the RobotShop Community! Spotted your ticket and noticed you had posted here as well.

You are correct that the Python library does not include that functionality. However, the LSS communication protocol is meant to be human readable and as such, you can send serial commands to the servo via Python fairly easily provided you have the right COM port, Baud rate and command structure. You can read more about the protocol here:
The command you are looking for is called the " R aw D uty-cycle M ove", or RDM action command.

There are others here who have succeeded in creating PID using this command and we’ll post links to any such threads we find below which may be of interest to you.

At your service if you have any additional questions.


Some posts with similar topics. If their work is of any interest, you can always do an @username with follow-up questions.


can some of the tech team implement the Raw Duty-cycle Move function in python so i can add it to the lss.py library and therefor use it directly . that would be of a great help .


Understood that this would be beneficial, but the team has current priorities and needs to keep to a timeline. We will be happy to include your suggestion when considering future development / maintenance.

A “library” is not necessary to send commands to the servo - you only need to send the serial command to the servo at the correct baud rate, and to the right COM port.

Note above that there are other users who are working on similar projects, and others who, though they may not have started the thread, have commented they are also working on it as well.



Hi @derbel199!

You could add these lines to the lss.py library:

def moveRDM(self, duty):
return (genericWrite(self.servoID, “RDM”, duty))


def wheelRPM(self, rpm):
return (genericWrite(self.servoID, lssc.LSS_ActionWheelRPM, rpm))

Then you can use it like:

myLSS = lss.LSS(5)

which would be the same as sending #5RDM512 (50% duty cycle)

myLSS = lss.LSS(1)

which would be the same as sending #1RDM256 (25% duty cycle)

I hope that helps :grinning:


hi @geraldinebc15 , the function moveRDM does not work and the error is :
invalid character in identifier . i think we should add something in the lss_const.py . the problem is in the string “RDM” i guess

Hmm, that seems strange.

I haven’t tested RDM but I created other functions the same way before and they have worked for me

Try typing all the characters by yourself (especially the “”) and make sure the indentation is there

It should look like this

NOT like this

I hope that makes sense :grin:


i have been able to create a function that takes two parameters speed (deg per sec ) and the position (deg*10) . it workes just fine and the result is satisfying . now , comparing my function to the move function that takes as parameter just the position and sets by its own the speed and the stiffness … i noticed that the frequency of the loop in the move function is higher and that the speed has been configuered to be 15 deg per sec and -15 deg per sec (in case of moving in the opposite way of the clock move) . so to satisfy my curiosity , i would like to discover how the move function has been built internally , the PID corrector and the set of the stiffness and speed … i would appreciate if you could send me the script of the move function .
thank you

1 Like

Unfortunately any information related to the firmware used within the servo is not open source.