I like to attach more than 3 motors to my Lego computer. I think that regular R/C car servos are the most attractive ones because of their compact construction and low price. These motors are controlled by PWM signals.
For that purpose, I developed an adapter based on a cheap ATtiny2313 microcontroller. It provides an I2C input and 10 PWM outputs for regular modelcraft servo motors. There is also an activity indicator LED which can be very helpful for troubleshooting. The led blinks once during power-on and then flashes whenever the device gets addressed by the I2C bus. If you have already used the Philips PFC8574 (8 digital I/O) or PCF8591 (4 analog inputs), you will love my servo controller because it works in the same way.
Lejos example program: http://stefanfrings.de/servocontroller/ServoControllerTest.java
How to program the I2C interface:
Send a message of 1-10 bytes to the address 0x1E (if all address inputs are not connected). Each byte defines the PWM pulse width for one servo output.
0= switch off
30 = most left position
95 = center position
160 = most right position
Do not drive servos against their hard limits for longer time because that might damage them. Depending on the servo manufacturer, the PIN assignment may differ. The usual wire colours are:
GND = black or brown
Battery (+) = red, Voltage is usually 6V
PWM signal = orange, yellow or white
Cable connection to the NXT computer:
red = GND (no error!)
green = VCC
yellow = SCL
blue = SDA
The white and black wires are not needed. This is the analog input which is still available for whatever you want to use it.
By the way, a very similar product is available for 50 dollars on http://www.mindsensors.com
. My selfmade controller costs only 5 dollars.
Please tell me if you like this.