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.
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.
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 )
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
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.
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: