Author Topic: About servo control.....  (Read 2051 times)

0 Members and 1 Guest are viewing this topic.

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
About servo control.....
« on: January 19, 2012, 09:40:24 AM »
Hi All,

I am using servo motor with uC called propeller the are like blinking LED tested at all max and min delay but it not working well vibrating......
I am using 5V supply and GND to uC GND control pin to out port of uC..
Plaese tell what to remember while using servo!!

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: About servo control.....
« Reply #1 on: January 19, 2012, 11:22:17 AM »
What is frequency of PWM that You are using?
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: About servo control.....
« Reply #2 on: January 19, 2012, 11:42:00 AM »
I was not using PWM it was simple on/off output like blinking of LED with delay and wait..

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: About servo control.....
« Reply #3 on: January 19, 2012, 02:10:26 PM »
OK, for how long pin is ON and for how long pin is OFF?
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: About servo control.....
« Reply #4 on: January 19, 2012, 09:26:17 PM »
Hi again,

I have change the duty cycle from sec to m Sec then microsec....

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: About servo control.....
« Reply #5 on: January 20, 2012, 01:43:03 AM »
By changing size of pulse (s, ms, us) You changed frequency and not duty cycle.

Most servos run @ 50Hz which is 20ms cycle. If You want to have 50% duty cycle:
Code: [Select]
for(;;;)
{
      set(PIN1);
      delay_ms(10);
     
      clear(PIN1);
      delay_ms(10);
}
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: About servo control.....
« Reply #6 on: January 20, 2012, 02:25:57 AM »
Quote
By changing size of pulse (s, ms, us) You changed frequency and not duty cycle.

That mean it require PWM...!!
and what is inside a servo circuit what use of it??

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: About servo control.....
« Reply #7 on: January 20, 2012, 02:58:06 AM »
That mean it require PWM...!!
It doesn't have to be hardware PWM, You can simulate PWM by using delay() command, however for delay command to work properly, You must know and define clock speed. What uC are You using?

and what is inside a servo circuit what use of it??
I don't understand Your question.
« Last Edit: January 20, 2012, 02:59:51 AM by newInRobotics »
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: About servo control.....
« Reply #8 on: January 20, 2012, 03:02:01 PM »
Hi,

Quote
By changing size of pulse (s, ms, us) You changed frequency and not duty cycle.
That would have changed duty cycle as well.


That mean it require PWM...!!
and what is inside a servo circuit what use of it??
A servo requires PDM (Pulse Duration Modulation). You may call it PWM, but with PWM you expect something like a 0..100% duty cycle, while in PDM you have a basic repetition rate (frequency) and a varying pulse duration/width.

The circuit inside a servo translates the servo pulses to position information, looks at the actual position information (from the potentiometer on the output axle) and controls the motor to move to the wanted position.

The servo pulses should have a repetition speed of around 20ms (50Hz), but quite some tolerance is accepted. The pulses is specified to 1.0ms to 2.0ms, although several servo manufacturers screw up the standard, so some go down to around 0.5ms and some go to around 2.8ms - but if you feed a servo a pulse that is either wider or more narrow than what it accepts, it will do its best to commit suicide by stripping its gears trying to push through the physical end stops, so keep within the 1.0ms to 2.0ms for starters. Also don't try to make the repetition speed much faster, or you'll ruin the servo a well.

If you find it easier, just make the inter-pulse pause ~ 18..19ms and then keep the pulse between 1.0ms and 2.0ms.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: About servo control.....
« Reply #9 on: January 20, 2012, 08:17:42 PM »
Quote
By changing size of pulse (s, ms, us) You changed frequency and not duty cycle.
That would have changed duty cycle as well.
How's that? Duty cycle is ratio between width of HIGH and LOW signals, so no matter if widths are 2s and 18s, or 2ms and 18ms, or 2us and 18us, duty cycle is still the same - 10%.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: About servo control.....
« Reply #10 on: January 20, 2012, 08:37:32 PM »
Hi,

Quote
By changing size of pulse (s, ms, us) You changed frequency and not duty cycle.
That would have changed duty cycle as well.
How's that? Duty cycle is ratio between width of HIGH and LOW signals, so no matter if widths are 2s and 18s, or 2ms and 18ms, or 2us and 18us, duty cycle is still the same - 10%.
Admittedly, RITESH29 wrote "I have change the duty cycle from sec to m Sec then microsec....", but you obviously caught the gist of it the same way I did (probably because you don't measure duty cycle in time units), judging from your remark "By changing size of pulse (s, ms, us) [...]".

So, if it was the pulse length he changed, but kept the pause length (since he didn't mention it) it would change the duty cycle as well as the frequency - an assumption on my side of course and while we could get it cleared up with RITESH29, I think we agree on the general aspects and just interpreted the statements differently :)
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: About servo control.....
« Reply #11 on: January 21, 2012, 02:22:37 PM »
So, if it was the pulse length he changed, but kept the pause length (since he didn't mention it) it would change the duty cycle as well as the frequency [...]
Now I get it  :D
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline Pogertt

  • Full Member
  • ***
  • Posts: 60
  • Helpful? 3
  • Pogertt
Re: About servo control.....
« Reply #12 on: January 22, 2012, 05:18:19 PM »
Changing the value of 1500 at the end of the tHa line of code to 500 will drive the servo to 0 degrees.  Changing the value to 2500 will move the servo to 180 degrees.

This code comes from the parallax web site.
http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/servo/List/0/SortField/4/ProductID/101/Default.aspx


Code: [Select]
{{ CenterParallaxServo.spin
For centering Parallax Continuous Rotation Servo
or holding Parallax Standard Servo at 90° position.
Sends a 1.5 ms pulse approx every 20 ms }}

CON
_clkmode = xtal1 + pll16x                 ' System clock → 80 MHz
_xinfreq = 5_000_000                      ' Using 5 MHz external crystal oscillator
servoPin = 0                              ' Servo signal to this I/O pin-change if needed

PUB CenterServo | tInc, tc, tHa, t

ctra[30..26] := %00100                    ' Configure Counter A to NCO
ctra[8..0]   := servoPin

frqa := 1
dira[servoPin]~~

' Set up cycle and high times
tInc := clkfreq/1_000_000
tC   := tInc * 21_500
tHa  := tInc * 1500
t    := cnt                               ' Mark counter time

repeat                                    ' Repeat PWM signal
  phsa := -tHa                            ' Set up the pulse
  t += tC                                 ' Calculate next cycle repeat
  waitcnt(t)                              ' Wait for next cycle


« Last Edit: January 24, 2012, 11:40:44 AM by Pogertt »
Mmmmmmmm....Cookies

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: About servo control.....
« Reply #13 on: January 27, 2012, 10:20:33 PM »
Hi,

Thanks for the code, i will try it..!!

Offline RITESH29Topic starter

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: About servo control.....
« Reply #14 on: April 01, 2012, 10:55:49 AM »
Hi again,

I have notice inside servo there was a 3terminal motor, can you please tell what type of motor is that???

 


Get Your Ad Here

data_list