# Servo motor control...

Status
Not open for further replies.

#### Ian Rogers

##### User Extraordinaire
Forum Supporter
my question was why not 1000/5 or 2000/5..?
See.... I don't understand.... What do you mean....

If you are trying to delay by 1Us then with a while(x--) ( this is test and decrement a word variable ). then its not possible in C..... I have shown that it takes 10 cycles in the while statement... That's too much time... If I pass 1000, ie 1mS, it would delay FAR too long... Why don't you just use the inbuilt delay functions, or write youur own in assembly.. I can't explain any further..

If you are asking why I'm using 1500 in the routine.... 1500uS is 1.5mS... CENTER POSITION... Look at Mr T's diagram...

#### koolguy

##### Active Member
See.... I don't understand.... What do you mean....
i was saying you are diving by 1500 why not 1000 or 2000..

Code:
A 20Mhz clock gives a .2nS clock cycle
10 * 2nS = 5uS
1500 / 5 = 300 ... dividing by 5 gives 300 iterations.

#### Ian Rogers

##### User Extraordinaire
Forum Supporter
i was saying you are diving by 1500 why not 1000 or 2000..

The delay routine divides ANY number thrown at it... I use 1500 because its the one I'm using in the code.

#### jpanhalt

##### Well-Known Member
Well, "industrial" is a bit overstatement. But, a modern servo is a digital servo. What Ritesh has is a "traditional" analog servo. Digital servos are more accurate and faster. I would stick to the standard 50 Hz control signal with analog servos. I don't know the "speed limits" of either servo. Looks like 300 Hz is standard for digital servos.

I think there was confusion about Ritesh's servo and that was resolved yesterday with Ian. The proximity of your comment to Ian's made it appear that you were also promoting 1.9 KHz for "modern" hobby servos. I think it is obvious why that won't work with the universally used data format for such servos. But, being always open to new things, I asked for your examples. That matter, I believe, is now closed.

Regular analog servos do work above 50 Hz as mentioned. I have some "modern," 2-uS-deadband, digital servos* that I will test when I get time (8 uS is the more common deadband). Although servos can be made to operate with a faster repeat rate, there is little advantage in doing so. One such advantage is being able to use the PIC built-in PWM generator, particularly if you do not need very fine control. It is also said that the refresh rate, especially slower rates, affects the speed with which the servo reaches its assigned position. But, there are much better and more precise ways to control servo speed.

Although digital servos are newer and have some advantages over analog servos, I think it is a mistake to assume they are "better" and will eclipse analog servos. One of the disadvantages of digital servos is their high idle current. Where weight may be a premium, such as some sailplanes, analog servos have an advantage. Another, probably lesser matter is noise. Digital servos tend to hunt and make more noise when idling.

John

*Like this one: **broken link removed**

#### misterT

##### Well-Known Member
The proximity of your comment to Ian's made it appear that you were also promoting 1.9 KHz for "modern" hobby servos.

Yes, I went along with Ians suggestion because I've heard that some servos can operate at surprisingly high rate (well, obviously 1.9Khz is way too high for analog servo), and because it is easy to test, and because too high update rate does not break the servo so it is safe to test. I have never tested the limits though. Too bad Ritesh struggles to get any proper (known) signal form out of the PIC.

#### koolguy

##### Active Member
The delay routine divides ANY number thrown at it... I use 1500 because its the one I'm using in the code.
Yes it will divide why 1500 is used at default, b'coz to set servo at center...?

#### Ian Rogers

##### User Extraordinaire
Forum Supporter
Yes it will divide why 1500 is used at default, b'coz to set servo at center...?
The servo I'm using here I'm throwing 1520 at it and the servo sits at +0.81 degrees Close enough...

#### JimB

##### Super Moderator
This problem is not inherent in India. Many of the nations in Asia have the same problem. We are using a lot of the classic old "British System" education and still adhering to that.

At the risk of derailing this thread even more, India became independant from Britain in 1947, Malaya became independant in 1957 (I think).
What have you guys been doing in the past 50/60 years?

As a product of the old "British System" of education as practiced in the UK in the 1950s and 1960s, it worked reasonably well for me, and many others.

JimB

#### koolguy

##### Active Member
I have seen that at the place of ADC i was using manually 0, 512, 1024 it was to total 90* and when i use this code is work for 180* perfect..

while(1){
number=number*3;
RC2=1;
DelayUs(number+ 700);
RC2=0;
__delay_ms(10);
}

#### Brian Griffin

##### Member
At the risk of derailing this thread even more, India became independant from Britain in 1947, Malaya became independant in 1957 (I think).
What have you guys been doing in the past 50/60 years?

As a product of the old "British System" of education as practiced in the UK in the 1950s and 1960s, it worked reasonably well for me, and many others.

JimB

Yeah, that. But, ugh, I can't feel like explaining about that past 50/60 years. It worked pretty good in the UK but not the rest of those former colonies.

Not to derail the topic, can't the OP use an oscilloscope? Perhaps spend a 15-20 minutes in a lab to borrow an oscilloscope? Back when I don't have them, I used the lab first.

#### Vizier87

##### Active Member
At the risk of derailing this thread even more, India became independant from Britain in 1947, Malaya became independant in 1957 (I think).
What have you guys been doing in the past 50/60 years?

As a product of the old "British System" of education as practiced in the UK in the 1950s and 1960s, it worked reasonably well for me, and many others.

JimB

Yes you're right. 1957. Anyway I think with Ritesh it's quite a lot about his phrasing the questions. MisterT, I understand your feelings. Perhaps you should PM EM and let him decide on how the discretion on approving members here goes.

I hope I'm not an annoyance to ETO, since I'm an Asian (Chinese). I have contributed in small areas i.e sensors and I learnt LOADS from here. I literally finished my projects just through asking around in this forum. However, it is very rare to see fellow Malaysians post here though, since most of the students don't really do much projects at the first place.

Cheers.
Vizier87

#### ghostman11

##### Well-Known Member
i am with LG on this one, i have read this thread from start to finish and like many others towards the end more and more detailed info gets thrown in often out of frustration in trying to make a OP understand something. if Ritesh had got it straightaway (wich he could of as all the info was there that he needed) then Mr T wouldnt have have posted the pic of servo theory, that is just one example in this thread alone. also both pommie and LG posted a link to a great bit of working code for pic 18 chips.
now what no one gets to see is the people who are stuck and not members here who do the whole google first approach and end up on this thread, BINGO bags and bags of info on servo's this thread like many others is getting a little like an informal wikipedia article except easier to follow.
i understand the frustration but i am also aware of the value a thread like this will have in the future for people you will never see or hear of or know about, but ultimately will get a project up and running without asking anyone a single question simply because of the level of detail that gets posted simply because one OP just does not read properly or dosnt get it and is really wanting it done for him. but that same OP is actually building a thread that will help countless others you will never know about.

i dont have the patience some of you guy's have i would have given up long long ago but i am greatly pleased you continue beyond where most give n as you are doing a service to many others so a big thank you on there behalf

regards
Jason

#### koolguy

##### Active Member
See.... I don't understand.... What do you mean....

If you are trying to delay by 1Us then with a while(x--) ( this is test and decrement a word variable ). then its not possible in C..... I have shown that it takes 10 cycles in the while statement... That's too much time... If I pass 1000, ie 1mS, it would delay FAR too long... Why don't you just use the inbuilt delay functions, or write youur own in assembly.. I can't explain any further..

If you are asking why I'm using 1500 in the routine.... 1500uS is 1.5mS... CENTER POSITION... Look at Mr T's diagram...

Why on load the servo motor vibrate??

#### Ian Rogers

##### User Extraordinaire
Forum Supporter
Your loading it too much.... They are powerful little devices but they have limits... If they can't get to the position they are asked to... they will start to jerk and vibrate...

#### koolguy

##### Active Member
I had made very litle load for robotic gripper made from little length and wt plastic sheet below it rating operating at 6v 1Am power smps

#### large_ghostman

##### Well-Known Member
maybe when the gripper is closed your asking the servo to grip past the point its fully closed, does the current draw go up when it closes and jerks?
BTW i dont know much just guessing :d

#### Ian Rogers

##### User Extraordinaire
Forum Supporter
maybe when the gripper is closed your asking the servo to grip past the point its fully closed, does the current draw go up when it closes and jerks?
BTW i dont know much just guessing :d
Its a good guess.... If the motor is at the extreme it can hunt a little.... I think this is a quality thing... Good quality servo's will still hunt but the movement will be less...

#### jpanhalt

##### Well-Known Member
Why on load the servo motor vibrate??
"Vibrate"? I have a fair bit of experience with the class of servo being used. When stalled by too much load or by the internal rotation stops, I would describe their behavior as buzzing (OK, very low level vibrate). There is negligible movement of the splined output shaft -- not what I would call hunting.

Ritesh, can you describe in more detail the behavior? Maybe post a video?

One potential source of gross vibration/hunting might be the power supply. These little servos can draw quite a bit of current when stalled. Have you checked the power supply with your oscilloscope during this?

John

#### Ian Rogers

##### User Extraordinaire
Forum Supporter
Have you checked the power supply with your oscilloscope during this?

Ha..Ha..Ha.. Seriously.... Sorry Ritesh I don't mean to be harsh.... But Helping you is better than Corrie sometimes....

#### koolguy

##### Active Member
Here is the video............

Status
Not open for further replies.

Replies
0
Views
2K
Replies
9
Views
3K
Replies
10
Views
4K
Replies
6
Views
769
Replies
4
Views
3K