Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Servo Controll... In reverse?

Status
Not open for further replies.

savage

New Member
Hi,

Just one quick question, and one more difficult one...

Looking at https://www.imagesco.com/articles/picservo/03.html Is that pretty accurate as far as controlling Servo with a PIC?

Based on the 4MHz Crystal, how do I know that sleep 18 in the asm will give me a period of 18ms ?

Ok, so now that is all sorted out, and I have my PIC controlling the position automatically of the Servo. To make it easy, let's say the PIC sends the Servo from Position 0 to 180 or anywhere in between.

If I want to control this manually now?? I cut the power to the Servo, the Servo remains at what ever position the PIC left it in. Manually turning the Servo, how can I read what position the Servo is at??

Thanks,
 
savage said:
Hi,

Just one quick question, and one more difficult one...

Looking at https://www.imagesco.com/articles/picservo/03.html Is that pretty accurate as far as controlling Servo with a PIC?

Based on the 4MHz Crystal, how do I know that sleep 18 in the asm will give me a period of 18ms ?

It's not assembler, it's BASIC, and the 18mS delay will be plenty accurate enough.

Ok, so now that is all sorted out, and I have my PIC controlling the position automatically of the Servo. To make it easy, let's say the PIC sends the Servo from Position 0 to 180 or anywhere in between.

If I want to control this manually now?? I cut the power to the Servo, the Servo remains at what ever position the PIC left it in. Manually turning the Servo, how can I read what position the Servo is at??

You don't, there's no output from a servo (except the mechanical one), when you power back up the servo will move itself to whatever position the program tells it to. You also shouldn't reply on turning the PIC off and the servo staying where it is, servo's aren't designed to do that.
 
Wow, that was helpfull.

So with the 4Mhz crystal, how do I know that 18 is enough? How is it calculated?

And yes, I know I can't read a value from a Servo, and no, I'm not powering down the PIC, I'm powering down the Servo just like I typed the first time...

Guess I'll have to come up with something machanical to read the position...
 
savage said:
Wow, that was helpfull.

So with the 4Mhz crystal, how do I know that 18 is enough? How is it calculated?

The BASIC program should specify what the clock frequency is, and produce delays accordingly. 18 is chosen because servos run on a 20mS repetition, with the active pulse being between 1mS or 2mS - so 18 and 2 make 20mS. The 20mS isn't critical, so the 19mS for a minimum pulse doesn't matter.

And yes, I know I can't read a value from a Servo, and no, I'm not powering down the PIC, I'm powering down the Servo just like I typed the first time...

Guess I'll have to come up with something machanical to read the position...

Why do you need to do that?.
 
4 Servos controlled by 1 Pic. All 4 Servos (mostly) will be kept in sync.

In certain conditions, 1 or more of the Servos will be switched off and needs to go to idle (position). In other circumstances, the levers attached to the Servos will have to be controlled manually, instead of automatically.

Think for example hmm.. A throttle handle.

1) You can control the throttle manually by adjusting the position of the lever (here, I need to read the position), or
2) The throttle can be automatically controlled by something else (in my case a pic), in which case I need to move the lever to the corresponding condition....

Practical example... Throttle levers on a airplane?
 
You wouldn't normally force a servo mechanically, it's not going to help it last very well - for your throttle example I would suggest a clutch between motor and lever, so the clutch slips if you push the throttle manually. You then need a feedback device on the throttle itself, so you don't need a servo to power it, just a motor/gearbox - the feedback device on the throttle then becomes the feedback part of a servo system - but externally, not in a single unit.
 
A servo is controlled internally by that type of feedback system; if you open one up you'll find a potentiometer, by which it measures its own position. To read the position of the servo, probably the easiest possible way would be to simply run an extra wire into it to directly measure the potentiometer output. What nigel says is entirely true though, the servo is probably not going to last long, especially if you use one of the ones with plastic gears instead of metal gears. If you're trying to build a high-quality system, a clutch-type setup as nigel suggests is probably a much better bet, but if you're just trying to throw something together that doesn't have to last forever, measuring the servo pot is probably the easiest and cheapest solution.
 
That has crossed my mind yes... Re my reference to 'something machanical', it was precisely refering to a external or seperate module to read the position... It should be relatively easy to do with a couple of sensors, or even a POT...

If the Servo is switched of, and you do NOT manually turn the Servo over it's min/max turn rate, surely it can't really cause damage?? Remember the enclosure for the throttles will have to automatically be able to turn 0 to 90 degrees... I'm thinking of making the enclosure so that the Servo can only turn 5 to 85 degrees (and obviously program the PIC as such as well). Thus, it will be impossible to over turn considering that you will hit the end of the enclosure 5 degrees before the over turn point of the Servo?
 
Hmm Evandude... Good point. I wasn't thinking about the gears... :(

I am talking very low RPM here for operational use... But point taken. Will have to spend some more time with the thinking cap on infront of the drawing board. Atleast I can control the Servos now :)
 
Can you tell us more why can't you do the manual lever adjustment via the PIC using up/down buttons instead of manually moving the servo unit output lever?

You may have to first disable the software servo auto adjustment loop first.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top