Main Site Documentation

Sending PWM signal to servo restarts the fez domino


#1

I have a servo (SM-S3317S) connected to my fez domino connected to pin Di5

Parts link http://www.sparkfun.com/products/10189


PWM servo = new PWM((PWM.Pin)FEZ_Pin.PWM.Di5);
while (true)
{
                
    var buttonState = _button.GetState();
    if (lastState != buttonState && buttonState == FezComponents.Button.ButtonState.Pressed)
    {
        Debug.Print("ButtonPressed");
        //_servo.SetPosition(5);
        // 0 degrees. 20ms period and 1.25ms high pulse
        servo.SetPulse(20 * 1000 * 1000, 1250 * 1000);
        Thread.Sleep(1000); //wait for a second
        // 90 degrees. 20ms period and 1.50ms high pulse
        servo.SetPulse(20 * 1000 * 1000, 1500 * 1000);
        Thread.Sleep(1000); //wait for a second
        // 180 degrees. 20ms period and 1.75ms high pulse
        servo.SetPulse(20 * 1000 * 1000, 1750 * 1000);
        Thread.Sleep(1000); //wait for a second
    }

    lastState = buttonState;
    Thread.Sleep(50);
}

[The code is from the Beginner Guide ebook]

As soon as I press the button the servo starts to move but restarts the fez domino immediately afterwards.

I have also tried some other drivers on fezzer but they all have the same affect.

If I connect the same servo to my arduino then it functions as expected.

Any ideas?


#2

check the operating voltage of the servo, it is 4.8 to 6.0

the uart voltage from fez is about 3.3


#3

sorry i meant the pwm intead the uart :slight_smile:


#4

Probably the servo is drawing too much power form the USB cable. Try to add external power, even better, power the servo separately.


#5

Hi Rolf. You not want to hook up servo directly to cpu pin. You need a servo controller. The stall current (like when you grab it or the control surface stops) on a std servo can be 1+ amps and damage your fez - addition to the fact the volts are not high enouph. For a single servo testing, I would say using something like a small logic level converter, but even the sparkfun one is rated <1 amps afaict. So I would get a controller and disconnect your servos until you get the controller.

Serial servo driver $20.00

GHI Serial Servo controller site $25.00
http://www.ghielectronics.com/catalog/product/166


#6

You don’t need to buy a servo controller. FEZ has pwm, why buy a servo controller then?

As long as the servo(s) is/are powered from an external supply it’s alright. You can hook up as many servos to fez as you like. (as long as you don’t run out of PWM pins :smiley: )


#7

You actually can hook servos up directly to the FEZ, as long as they are on separate power supplies.

There is no need for a controller, as long as current for the servos is not sourced from the FEZ’s Vregs.


#8

Hmmm, I did read (somewhere) that servo’s take up a lot of power and it was recommended to use external power supply if you use more than one servo.

I was really hoping that I would not need to add an external power supply. Looks a slightly complicated for a newbie like me. Anyway, I will give it a shot … I will let you know when I blow up my fez :wink:

Thanks for the quick response everyone.


#9

Was thinking more in terms of power issue. Sounds like he is maxing the 5v regulated 5v/800mH at getting a temp or PTC reset. Also, what is the story on servo signal pin. Is it trying to draw too much current >100mh?. What about back EMF? So using the reg on the controller solves those issues and frees up pwm ports in a fairly cheap and clean way and gives you grow room.


#10

Signal from the servo is pretty clean IME. Again, no need for a dedicated controller unless you use up all the available PWM ports.


#11

Indeed. Power them from an external power supply and you are good to go.
If you would however like flexibility and the ability for custom firmware, take a look at the SSC32 servo controller:

http://www.lynxmotion.com/p-395-ssc-32-servo-controller.aspx