I have a Arduino motor shield connected to XL, L and M motors and can control the speed with PWM (Pulse Width Modulation). I made my own connector by cutting a Lego PF connector in half and wiring up the two inner connectors to "pins" that are easy to connect to a breadboard.

When I connect those two pins to the PF Servo Motor that comes with the Crawler, well, nothing happens no matter what pulse I send (Arduino handles the pulses . . I just set a "direction" pin and a value between 0 and 255 . . . and PWM or not the net effect is that with a voltmeter you see voltages between about -9 Volts and 9 volts, same as when you measure from the IR receiver).

Anyway, what am I missing? What is different about PWM on a servo motor?

  • 1
    That doesn't quite seem as a real question so far... (but I'm fairly confident you can reformulate once you have the answer)
    – Joubarc
    Feb 20, 2013 at 20:34
  • Sorry man I was in a rush! Panic! I'll fix it after my presentation tonight. And, I do have the answer so I'll post that too. Sometimes in asking the question and having to think about it you come up with the answer on your own.
    – tooshel
    Feb 20, 2013 at 23:26
  • 1
    Well it's ok to ask and answer your own question but you'll certainly want to rewrite the question so that it looks like one.
    – Joubarc
    Feb 21, 2013 at 7:57
  • @Joubarc Okay, it's fixed. You can further change it if you want (you're a moderator!) but if you have other suggestions I'll fix it further. And I should add some pictures . . . describing these things is difficult and a picture would make it way easier. I just hope this kind of question is relevant here . . . I was going to post in the electronics SE too but figured it out before I got to that.
    – tooshel
    Feb 21, 2013 at 17:51
  • Editing questions to make them better isn't limited to moderators, quite the contrary - everyone is welcome to contribute in that way, too. That said, the question & answer looks fine to me now.
    – Joubarc
    Feb 21, 2013 at 18:54

2 Answers 2


According to Philo's detailed analysis of the servomotor, it takes its commands from the C lines but needs to be powered as well:

Being a Power Functions range member, it is fully integrated with this system, and receives its commended position through C1/C2 lines, and its power from supply lines. On a normal motor, C1/C2 duty cycle directly control motor speed, here they set the angular position of the shaft.

This makes sense since there's electronics involved and these need to be powered by a regular, reliable power supply which is exactly the purpose of the +9V and Ground wires. The same holds for the IR receiver (although that one ignores the C1/C2 lines completely).

For more information on the PF wiring, you should also check Philo's presentation of the Power Functions system.

  • I did a bit more reading and most servo motors are a three wire affair and that's what got me thinking I was missing a wire. I didn't add my pin wires to all 4 wires on the pf connector because for all the other motors they are not used and they just get in the way. Luckily I had parts to make a new connector . . . although RIP to one of my Lego LEDs :(. And these links are wonderful reads I hadn't seen before so thanks!
    – tooshel
    Feb 21, 2013 at 22:27
  • Just a thought, you may want to sacrifice extension cables instead of leds.
    – Joubarc
    Feb 22, 2013 at 9:42
  • 1
    Oh, I've sacrificed plenty of extension cables . . . but I ran out! And not even the Lego Store carries them.
    – tooshel
    Feb 22, 2013 at 19:46
  • @tooshel necro-comment: the Lego Store seems to carry extension cables now at a somewhat reasonable price compared to normal Lego prices.. I don't feel too bad about cutting one of them up as I get two usable wires out of each Jul 10, 2015 at 1:44

Turns out the problem is that Servo motors need at least THREE wires. Two for the PWM and one for full power. I made a new connector (and I can attach a picture if anyone is interested . . . just don't have one handy right now) that had all four of the wires from the Lego brick connected to breadboarding pins and then I wired the two new wires to +9 and ground. That did the trick! As soon as it powered up I could hear the servo motor moving to center. Then, I sent pulses with the Arduino and I once again had control of the steering!

  • How did you end up sending the pulses? I couldn't get the servo to respond to neither analogWrite() nor the Servo library's write(). From some Googling, I got the impression that this is because Arduino's built-in PWM frequency is 500 Hz while the PF servo expects 1150 Hz. I'll try "manual" PWM to get the frequency that's needed. Also, it's still not clear to me whether the PWM is on both C1 and C2 or just on whichever is not LOW.
    – Ates Goral
    Jan 18, 2015 at 4:33
  • @AtesGoral Wow! It's been a long time since I looked at this. All of my code is on github if that helps. github.com/tooshel/androdino/tree/master/arduino Another notable problem I had was the 9 volts from the Lego power pack would end up as about 6 volts by the time it went though the Arduino Motor Shield so I had to rig up an extra Lego power pack with only 3 batteries and aluminum foil for the other three, and make another custom cable that put the two batter packs in serial. Yeah, it was crazy. Thank goodness for sbrick!
    – tooshel
    Jan 19, 2015 at 17:06
  • Oh my goodness! I hadn't heard about SBrick. I think I'm going to order one soon :) In the meantime, I'm still trying to solve my problem with Arduino because I'm basically doing it as an electronics learning exercise instead of powering up an actual model. I'll see if the voltage drop is the cause of the problem. Thanks!
    – Ates Goral
    Jan 19, 2015 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.