» Menu
» My latest @ Flickr
Aurora Borealis - Tampere, Finland 2013-03-17 20130304-1705-DSC_3810 [Browse]
» My latest @ YouTube
» Links

Serial Servo Controller

I needed a serial servo controller to few projects but I didn"t find any suitable source codes for the ATmega8 that could have been compiled with avr-gcc. One option would have been to use the built-in PWM in the ATmega8 but I didn"t get one code to work so the project went down for a while.

I didn"t want to buy a ready made servo controller because I think they are a bit over priced. One evening I got an idea how I might be able to make a working controller for big amount of servos with one microcontroller and I managed to build a working code on a simulator program (VMLAB). All the timings looked to be good with the simulators analyzer, but after I moved the code to its real environment (to a real AVR) it just didn"t work and the servos just went crazy.

The project went down again for a while but then I built the parallel port logic analyzer and I was able to nail down all the bugs from the source code and I got all the timings and pulse durations right. After that all the servos worked like a charm and I got to continue expanding the controller software. So far it has my own servo control protocol and with a simple switch command it understands Mini SSC and Parallax servo controller protocols. There are also support for the Polulu and Lynxmotion controller coming and I'm also working on a support for Motion program's step motor commands so it could control the servo motors also.

A (crappy quality) video from the early stages of the servo controller, it only had my own protocol in it at that moment so I controlled it from a terminal program by writing the commands by hand.


And another video after adding the simple Mini SSC protocol so I could use the controller with all the existing software that support that mode. In the video I'm testing it with a pan&tilt base with a webcam attached to it and RoboRealm running on the computer, outputting servo positions in Mini SSC II mode. The sounds played from the computer are from the Portal game. I made a script to the RoboRealm that looks for the brightest spot (I used a flashlight to test it out) and tries to center it to the screen. When in search mode the sound "Where are you?" is played and when the spot is found and centered the "There you are!" is played.


The VBscript code I used with RoboRealm is below. It searches for a white "blob" and after it comes in to the webcam view the center of gravity (COG) variables come available and the script adjusts the servos so the blob's center of gravity coordinates are in the center of the view.

[RoboRealm VBScript]

Source codes below. The 14052008 version has only 3 servos configured at the moment, next version will have plenty of more. There is nothing special in the schematic so far, just an ATmega8 with a 14 MHz crystal and one servo per configured output pin and serial lines through a MAX232 converter to the PC. I'll post both schematics and a PCB after I do them with Eagle. After I get some parts I'll design a new version that will use 74HC595 shift registers as servo data outputs so it will use less pins on the AVR and is easier to scale to bigger amount of servos.

» AK Serial Servo Controller, 14-05-2008