How can I get a normal 9g servo to work with a lego EV3?

I'm working on an assignment that requires me to use only the Lego EV3 and no other programmable microcontrollers. I'm also required to program the EV3 using the proprietary Lego mindstorm software. I could do this in 10 minutes for $5 using Arduino, but instead I need to use a $300 Lego brick that's only designed to work with $50 servo motors.

I'm on a tight budget and can't afford the Lego servos, but I have some $2 standard 9g micro servos. I've seed this module in my research:8 Channel Servo Controller for NXT or EV3. It looks like it is possible, but I need to understand what circuitry is in this thing so that I can make my own for far less money than buying it. I only need one channel, but if I can just as easily make a 4 channel one I might as well.

I'm just having a hard time finding proper documentation on this stuff.

GustavoMcSavy:
I'm working on an assignment that requires me to use only the Lego EV3 and no other programmable microcontrollers. I'm also required to program the EV3 using the proprietary Lego mindstorm software.

So your project cannot involve Arduinos in any way ?

srnet:
So your project cannot involve Arduinos in any way ?

Yeah, I know this is the Arduino forum, but wasn't sure where else to ask and I figured someone on here would have some knowledge to offer. I may be able to sneak in an ATMega 328p can call it a servo driver, but I'd rather not bend the rules.

GustavoMcSavy:
Yeah, I know this is the Arduino forum, but wasn't sure where else to ask and I figured someone on here would have some knowledge to offer. I may be able to sneak in an ATMega 328p can call it a servo driver, but I'd rather not bend the rules.

Maybe try a Google search on 'Lego Mindstorms forum' ?

Get this book.

I don't see what difference there could be between a Lego servo and an other servo.
Servo supplies and servo signals are standarised, at least for common/small servos.
Leo..

Wawa:
I don't see what difference there could be between a Lego servo and an other servo.
Servo supplies and servo signals are standarised, at least for common/small servos.
Leo..

They aren't just plain servo motors:

http://www.philohome.com/motors/motorcomp.htm

I didn't see servos on that page, just motors.

srnet:
Maybe try a Google search on 'Lego Mindstorms forum' ?

I can't find any active forums. The most recent posts I've seen on the ones I've found are months, or years old and I can't figure out how to make an account.

Wawa:
I didn't see servos on that page, just motors.

Yeah, none of the Lego motors are servos. They are "geared motors with feedback control".

You should be able to interface a servo motor, but the programming will be tricky. More often I have seen hacks that use the Lego peripherals, but replace the "programming block" with an Arduino.

http://icube-avr.unistra.fr/en/index.php/Hacking_the_Lego_EV3#Hacking_Lego.27s_PWM_module

The PWM section might be helpful, since the control signal for standard servos is a ~50Hz PWM with ~10bit resolution and 7.5% - 12.5% duty cycle.

(Check my math though :smiley: )

lg, couka

couka:
http://icube-avr.unistra.fr/en/index.php/Hacking_the_Lego_EV3#Hacking_Lego.27s_PWM_module

The PWM section might be helpful, since the control signal for standard servos is a ~50Hz PWM with ~10bit resolution and 7.5% - 12.5% duty cycle.

(Check my math though :smiley: )

lg, couka

This is what I was hoping, just use the normal motor PWM signal for the servo. I don't really need much more that 3 bit precision. The frequency will probably be closer to 1kHz though, will that be a problem?

I just hooked up a servo to an arduino with just a normal PWM signal and moved the duty cycle around. I can only get it to move between 56% and 100%, but that's only about 1/6th of a turn.

GustavoMcSavy:
This is what I was hoping, just use the normal motor PWM signal for the servo.

That's not what I said.

GustavoMcSavy:
I don't really need much more that 3 bit precision.

Since you only use 5% (==1/20th) of the whole duty cycle range, you need a pwm with 20x more resolution than you think. So that's an additional 4-5bits.

GustavoMcSavy:
The frequency will probably be closer to 1kHz though, will that be a problem?

That's not going to work. Most servos will probably accept 45-55Hz, many even a much broader range, but the the absolute ON-time in milliseconds is important.
Even if the servo could handle the frequency, you cannot reach 2ms On-time with 1kHz PWM.

GustavoMcSavy:
I just hooked up a servo to an arduino with just a normal PWM signal and moved the duty cycle around. I can only get it to move between 56% and 100%, but that's only about 1/6th of a turn.

You probably used a 490Hz PWM
That's an ON time between about 1.17ms (56%) and 2.04ms (100%)
Acceptable is 1.0ms (0° position) - 2.0ms (180° position)

I don't know why the servo moved only 1/6th of a rotation instead of ~180°, but then again, the servo is probably not specified to work at 490Hz PWM at all.

lg, couka