7 Replies Latest reply on Oct 14, 2012 12:01 PM by JoMe_264151

Problem to control servo motor

Hi everybody!!

actually i´m working to control a servo motor i read that the frecuency is 20 hz and the duty cycle is 1,1.5 and 2 ms
i´m using pwm16:

parameter pwm16
clock = 1,000,000
period= 49,999
duty cycle = 999-> 1ms->0°
1499-> 1.5ms -> 90°
1999 -> 2ms -> 180°

but the servo doesn´t work correctly don´t go to the correctly position and keeps vibrating and i don´t understand why,so if someone help me i´m really be glateful
i put my code if someone can check it

• 1. Re: Problem to control servo motor

I have some ref material I can send you, but it is 13M in size, so I need

your email address. Mine is danaaknight@gmail.com

Regards, Dana.

• 2. Re: Problem to control servo motor

thanks a lot!!  my gmail is mobrfco@gmail.com

• 3. Re: Problem to control servo motor

Your calculations seem to be correct, so let us see a bit more and post your project here, so that we all can have a look at.

To do so, in designer 5.3 ( I hope you already updated to, if not, do it right now) do

Build -> Clean Current Project

File -> Archieve Project (minimal)

and then upload the resulting archive here.

Happy Zipping

Bob

1 of 1 people found this helpful
• 4. Re: Problem to control servo motor

Ref material forwarded this morning.

Regards, Dana.

1 of 1 people found this helpful
• 5. Re: Problem to control servo motor

It seems that a lot of servos works at 20mS period. Not sure if the is the case, have a look.

1 of 1 people found this helpful
• 6. Re: Problem to control servo motor

Hi bob

here is my code it is simple beacause first i want control corectly the servo and then do an aplication
my servo is  a mg995, a friend prove with  an arduino and worked corectly so i decided control in psoc.

• 7. Re: Problem to control servo motor

Can you try to reduce the period to 19999 giving the required 20ms for the servo.

Another issue might be the power supply: the PSoC supply and the servo should be different sources only connected by GND.

Bob

1 of 1 people found this helpful