- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
- Labels:
-
PSoC 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is the period 20ms? or frequency 20Hz?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The specs for those kind of servos usually say: pulse repeated every 20 to 40ms non-critical, pulse width between 1.0 and 2.0 ms where 1ms is left stop, 2ms is right stop.
Usually having a PWM with a fixed frequency and changing the pulse-width as needed.
To care for the side effects might be necessary: the datasheet says
- Side Effects:
- Writing the PulseWidth register, while the counter is active, changes the duty cycle of the output. This may cause the output to glitch or change inadvertently.
Pulses not in the range of 1-2ms will be interpreted as failure and (depending on the servo model) a neutral position is used.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ref material
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
the frecuency it´s 50 Hz and the period it´s 20 ms
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your selected period is 50ms, not 20 when looking into your source.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks bob you´re rigth, i put the wrong value in the period i put 19999 and no longer vibrates and works perfectly
thanks to all
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your are always welcome!
Happy coding.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you have a servomotor Hitec... The servomotor works a 10 ms. So, you should use a 10khz in a PWM8, for example.
Next step, the servomotor works a left movement if you suministry 0.5ms of WidthPulse, works neutral(90 degrees) in a 1.5ms, and works a right with 2.5ms. This is the Hitec´s servomotors.
Excuse me, if you don´t understand my English 😞 . I learned English slowly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
From the Hitec website -
- Q. What signal do servos require to operate?
A. All Hitec servos require a 3-4V peak to peak square wave pulse. Pulse duration is from 0.9ms to 2.1ms with 1.5ms as center. The pulse refreshes at 50Hz (20ms).
Regards, Dana.