A problem that I didn't really solve is the power consumption: I don't know the current that runs through the motor. It seems to be low enough not to cause any problems, but I don't know how high it will get when the servo is blocked. YOU HAVE BEEN WARNED, I don't feel responsible for USB-ports catching fire... :-/
There are three parts included in the distribution: The firmware for an ATmega8 microcontroller, a commandline-client that can be run under Linux, and the circuits needed to build the device.
This project is based on my USB-LED-Fader, which itself is based on the PowerSwitch example application by Objective Development. Like those, it uses Objective Development's firmware-only USB driver for Atmel's AVR microcontrollers.
Objective Development's USB driver is a firmware-only implementation of the USB 1.1 standard (low speed device) on cheap single chip microcomputers of Atmel's AVR series, such as the ATtiny2313 or even some of the small 8 pin devices. It implements the standard to the point where useful applications can be implemented. See the file "firmware/usbdrv/usbdrv.h" for features and limitations.
Building and installing
The circuit contains only a few standard components. There's no special USB-chip involved.
The installation is described in the documentation.
Connect the device to the USB-port. If it isn't already, the servo will move to the 0-position.
Then use the commandline-client as follows:
angle: The angle you want to set the servo to. 0 is full left, 255 is full right.
Get the status of the servo:
This will tell you the angle the servo is currently put to.
Current servo angle: 42
Set a new angle:
The device from behind
Behind the scenes
usb-servo set 23
This sets the servo to the angle 23. 0 is full left, 255 is full right, so with 23 the servo will be almost on the left side.
Test the device:
This function sends many random numbers to the device. The device returns the packages, and the client looks for differences in the sent and the received numbers.
Demo application xservopointer
This is a pure fun thing, nobody will need it. That was reason enough to write it...
To use it, you have to position the servo centered above the screen (with a little tweaking in the source, you can change that position). Then, you attach a pointer to the servo and start the application.
You'll never ever have to search for your mouse cursor in the future. The pointer on the servo will always show you where to search.