Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: RITESH29 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!!
-
What is frequency of PWM that You are using?
-
I was not using PWM it was simple on/off output like blinking of LED with delay and wait..
-
OK, for how long pin is ON and for how long pin is OFF?
-
Hi again,
I have change the duty cycle from sec to m Sec then microsec....
-
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:
for(;;;)
{
set(PIN1);
delay_ms(10);
clear(PIN1);
delay_ms(10);
}
-
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??
-
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.
-
Hi,
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.
-
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%.
-
Hi,
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 :)
-
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
-
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 (http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/servo/List/0/SortField/4/ProductID/101/Default.aspx)
{{ 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
-
Hi,
Thanks for the code, i will try it..!!
-
Hi again,
I have notice inside servo there was a 3terminal motor, can you please tell what type of motor is that???