I want to control Lego Technic Servo Motor 88004.

The way it works is - Lego has a 4 cable connector. Two of them supply power (+9V & GND) and the other are optionally +9V and they are called C1 and C2.

Servo turns right or left max 90 deg when you supply PWM to either C1 ("left") or C2 ("right"). (or the other way round, but it doesn't really matter)

That basically means that what I need is a 9V PWM and be able to supply it to either C1 or C2. What is more the frequency has to be 1150 Hz.

Now the question is how do I achieve this goal?

I'm already using the L298N motor controller and happen to have one engine slot free.

1) If I can supply PWM from Arduino to "LNA" input in L298N - will it also cause the output to be PWM? Because L298N has a transistor I have a feeling that the output is also going to be PWM unless there's something else there i.e. capacitor

Even if it's not does that matter at all - meaning is it going to still work?

2) How do I produce PWM with 1150 Hz from Arduino? My Arduino is 16MHz so I suppose that it should be possible to switch output with order of magnitude smaller frequency.

If what I'm trying to do makes no sense please try to point me to the right direction.

  • I'd be surprised if some web searching didn't turn up existing mentions of driving these motors from an MCU, perhaps even your Arduino's ATmega. Even if you want to work it out yourself, this could be advantageous to research first as a cross-check on your beliefs about the signal properties. Oct 17, 2015 at 15:09
  • My guess it that C1 and C2 will work just fine with only 5Volt.
    – Gerben
    Oct 17, 2015 at 15:10
  • The search did not return any instruction on how to drive the servo. There's a lot of articles about motors. Everything that I'm writing is based on research I did.
    – kubal5003
    Oct 18, 2015 at 14:16
  • @gerben yes, but you can't do 90 deg and I'm worried about the max 5 mA current
    – kubal5003
    Oct 18, 2015 at 14:17

1 Answer 1

  1. Yes, the output will be a pwm. You can see it from the schematics.
  2. you have few options, with different precision and complexity:
    1. Configure one of the PWM HW blocks
    2. Do it by sw in a loop
    3. Use a timer to trigger a sw function - but it might be simpler to just configure the PWM HW block.
    4. Use some existing library that will implement one of the methods I listed

I would recommend Option 1: it's not so difficult, you will learn something of the AVR internals and it will be the solution with the least overhead. You can have a look at this tutorial. There are also many others floating around.

  • Igor thank you very much for your answer! One more thing that bothers me - I suppose that when I'll be applying voltage to C1 then C2 should probably be floating and vice versa. If I simply connect C1 and C2 to outputs from L298N then the second one is going to be pulled to ground. I'll do some research to confirm if pulling the second one to ground is dangerous or not, but supposing it is - what would be the simplest option to avoid it? Using some kind of demultiplexer?
    – kubal5003
    Oct 18, 2015 at 15:40
  • If you leave it floating, chances are that it can pickup some noise. Checking the circuit is always he best course of action. If you are worried about shorts, you can use a pull-down resistor, instead of connecting directly to ground. Oct 18, 2015 at 15:45
  • According to this: youtube.com/watch?v=i_4d-XsgdA0 youtube video I can safely pull one of them to ground :) That means that using the motor bridge should be sufficient to be able to operate the servo :) About option 1 - the closest I can get to 1150 Hz is 1kHz but maybe I don't need to be precise about the frequency. Time will show..
    – kubal5003
    Oct 18, 2015 at 16:57
  • If they work like the L298N (and that's a big if), they might even support the extra modes: both to ground for free spinning motor, both high for emergency arrest (the motor locks in place, beware of the current/voltage spikes). Oct 18, 2015 at 17:03

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.