USB Robotic Arm Control Python Module
A simple to use Python module for controlling USB robotic arm devices on Linux PCs, including the Raspberry Pi.
Robotic Arm Compatibility
The only model currently compatible is the Velleman KSR10 with USB inteface board. In the United Kingdom it is sold exclusivly at Maplin. If it looks like the arm in the image above, it should work.
How to use
USBArm will be available on PyPi shortly. Instructions will follow.
Follow this method if you want to install it manually.
First of all, we need to make sure that PyUSB is installed. You can download PyUSB from Sourceforge. Once extracted just run
sudo python setup.py install in the pyusb directory to install PyUSB. You'll need to install libusb for it to work. Just use your distriutions package manager such as apt, yum, rpm, etc.
We now need to download the module. You can find the latest version at
https://raw.github.com/inversesandwich/USBArm/master/usbarm.py. You can now use this with your project. You will need to move it to the same directory for it to work.
Using with Python
Once installed, you can now create a Python script using your favorite text editor/IDE in the same folder as the script you just downloaded. Then use the following commands to import the module and connect to a robotic arm.
import usbarm usbarm.connect()
It's as simple as that! Now we need to tell the arm what to do. To send a command, we use the following code:
'command' tells which part of the arm to move, and 'duration' is how long the command runs for. The duration can either be an interger or a float.
The commands that you can use are;