I recently thought up a great project idea that involved controlling motors from a PC. I’ve done some experimenting with an Atmel USB interface in the past, but stopped when I hit a bug in the open source toolchain. It was frustrating spending hours debugging only to find out the compiler wasn’t handing an instruction correctly.
This time I wanted to build a prototype fairly quickly and increase the budget to do so. Moving motors from a computer has been done many times before and it has been broken up into modular components. So, I only had to determine what I wanted to move and get that connected to one of many types of PC ports.
The type of motor I wanted to start with was a servo. So, I did some searching on the web and located a reasonably priced Pololu Servo controller that receives commands over an RS-232 DB9 port. Now, since most modern PC’s don’t have serial ports, I purchased a cheap USB to Serial adapter, the TU-S9. The adapter would also be useful for other projects since the serial interface is fairly basic. Since I already had a servo from Parallax, that was all I needed.
![]()
Parts:
- USB-Serial adapter: TRENDnet TU-S9
- Serial Servo Controller: Pololu 8 Servo Serial Controller
- Servo Motor: Parallax Standard Servo
The TU-S9 is a nice adapter since it is built with the PL-2303 chipset and is supported on most Linux distros. Once you plug it in your PC, you should see ‘/dev/ttyUSB0′ appear. This worked without problems on my Ubuntu Netbook Remix distro.
The servo controller is nice, but I initially had some problems with getting the configuration right. I started with a modified test application with a tcl UI (created for the 16 servo controller). When that didn’t work, I moved on to a Python test script. The servo’s didn’t budge with it either. The only thing that worked was a .Net test application on an old Windows PC. It was odd since running the Python script on that same PC wouldn’t work, even when the transfer signals were identical for both.
Since I didn’t have the source code for the .Net test app, I couldn’t find out what serial configuration could be different between the other applications. At one point, I simply pulled out the default DTR/RTS jumper and gave it a go. This ended up being the problem. The .Net app must have handled the RTS line properly so that it didn’t reset the controller. Wow! I wish I tested the other RS-232 lines!
In the end I was able to whip together a simple python demo script (see below) that moves the servo to various positions. Feel free to use it, I got inspiration from a previous test script.
Continue reading Servo Controller Driven over a USB-Serial Adapter
