Using the Lynxmotion Smart Servos (LSS) with a Raspberry Pi !

Posted on 02/08/2019 by rguimond
Steps completed / 5
Press to mark a step as
completed or click here to complete all
Components you will need
Select missing items to add them
to the cart or select all
Introduction

Using Lynxmotion's new Smart Servos with a Raspberry Pi is quite easy thanks to the LSS Python library. Here we'll guide you through the step by step process of how to set up your Raspberry Pi to boot up and immediately control the LSS motors.


Let's start by setting up the Raspberry Pi:

 

  • Connect the Raspberry Pi to the LSS Adapter Board using a USB cable, and then connect the Lynxmotion Smart Servo to the LSS Adapter. 

The Raspberry Pi can be powered by a 5V micro USB supply (for more information on Raspberry Pi power supply). The LSS needs a separate power supply. It can be powered through the XT60 connector on the adapter board with a 6V to 12V power supply. Take a look in the LSS Wiki for more information on LSS power specifications .

  • Power the LSS Adapter using a wall adapter (preferable) or an LSS compatible battery pack. This is ideally done via the XT60 connector.
  • Power the Raspberry Pi using a compatible USB wall adapter (you can use a battery in the future, but for testing it's always best to have unlimited power)

The library is available for download on Lynxmotion's GitHub page, though you can install it directly from the Raspberry Pi:

  1. Open LXTerminal that can be found in the taskbar

  1. Type (or copy and paste) the following then press enter:

git clone https://github.com/Lynxmotion/LSS_Library_Python.git

  1. The Python library and examples can now be found in /home/pi/LSS_Library_Python/src

  1. Open example_sweep.py with Thonny (double click the example_sweep.py file)
  2. Make sure you modify the code as shown in the picture below.
  3. Uncomment but do not delete (just remove the "#" in front) the following line:

CST_LSS_Port = "/dev/ttyUSB"

  1. Comment (Add an "#") to the line below it.

  1. Click the "Run" button to run the example; the servo should rotate back and forth.

If you want your Raspberry Pi to run the code as soon as it is powered on, here's a quick guide:

  1. Open the LXTerminal as above
  2. Type the following : sudo nano /etc/profile
  3. Scroll to the bottom and add the following line : sudo python /home/pi/LSS_Library_Python/src/example_sweep.py 
  4. Type “Ctrl+X” to exit, then “Y” to save followed by “Enter” twice.
  5. To test if this has worked reboot your Pi using : sudo reboot

That's it! You can now use the Lynxmotion's smart servos with your Raspberry Pi. If you want to use standoffs to mount the LSS Adapter on top of the Raspberry Pi (or below), the LSS adapter's four hole mounting pattern line up with the Raspberry Pi's four mounting holes. However, it is important to mention that the Raspberry Pi's holes are of a smaller diameter than the LSS Adapter, so choose standoffs and screws accordingly. 

If you have any questions leave them in the comments and we will be happy to help. We will update the post to confirm this works well with the Raspberry Pi model 4.

Flag this post

Thanks for helping to keep our community civil!


Notify staff privately
It's Spam
This post is an advertisement, or vandalism. It is not useful or relevant to the current topic.

You flagged this as spam. Undo flag.Flag Post