How do you keep track of the position of the servo

edit: [extracted from Wich servo use for controlling a needle valve - #26]


I have a question about this for a personal project that I'm working on.

How do you keep track of the position of the servo? When running a valve, I don't see how you could implement limit switches. I also have questions in my mind about how accurate position tracking can be if you're just keeping track of time that power is applied in each direction.

Servos have electrical feedback for position.

OK, the one in his link only has 3 wires (red, black, white). I assumed red and black for power and the white for the PWM. I take it these have a special protocol that makes the white wire bi-directional for reading and writing?

It sounds like you don’t know anything about how servos work. Google it and then ask questions if you still don’t get it.

Nope, never used one before. That's why I was asking here since that's what this topic thread was on.

Sorry, I don't use Google, but thanks anyway.

No problem. Use you’re normal way of learning new concepts then or just remain ignorant.

2 Likes

Wow, after seeing your posts in other forums here, you really should quit patting yourself on the back. Save it for Halloween and don't forget to say trick or treat next time. You contributed absolutely nothing useful with your responses. Why you spend so much effort patting yourself on the back is mind boggling.

1 Like

Participants are required to do a bit of their homework here. Are you expecting someone to Google the answer for you because you don’t want to use Google ?

If it’s not a 360° servo - You tell the servo where to go (the PWM signal indicates the position). So your code knows what has been asked…

1 Like

It is

that this hasn't been split.... Please check the forum rules, particularly this part.

I just moved it as a standalone request

1 Like

Thanks for me and the standalone requester.... :smiley:

Other search engines are available.
Or so I'm told.

2 Likes

If you’ll study the Arduino Servo Library documentation a little bit, I’m confident that if that doesn’t answer your questions then at least you’ll be prepared to ask some intelligent questions.

1 Like

You should be aware that there are (at least) two meanings of the word "servo". In Arduino-ese it is often taken to mean the type of servo that was originally designed for radio controlled models. These have a motor and a gear train and a potentiometer for internal position feedback, and a chip that does the control. You feed them power and a pulse train, usually pulses from say 1 - 2ms, and they take up an output position that depends on the pulse length. Internally they generate a pulse of a length controlled by the pot and compare it with the input pulse. Made by the million and very cheap. Output shaft rotation usually limited to about 270 degrees by the pot. There are also versions that used to be called "sail winches" that have several turns of output to control model yacht sails (originally) but could potentially be used to drive a valve needing several turns - say a needle valve. In such a case there could be a further gear reduction from the output to the potentiometer, or a multi-turn pot (though they are usually expensive).

Generically a servo is a system with an actuator (usually a motor), a sensor to measure the actuator position, and a controller that compares the actual position with a demanded position and drives the actuator to force the error to zero. So you could have a gear motor to drive your needle valve and a suitable sensor on the valve, such as a pot. But from my memory of needle valve, usually as you close the valve the required torque gets very large as you tighten a screw, so you might also need a torque sensor to see when the valve closes and stop the motor - or you could just let it stall. Quite a tricky problem to combine proportional movement with properly closing the valve I should think.

Modern "servos" though, such as used extensively in CNC machines, generally use optical or magnetic encoders to sense position, which are much more precise and don't wear out.

I’m guessing this topic arose from OP’s interest in this topic:

where it was discussed how a needle valve could be operated to control the cooling water flow in a distillation column.

That discussion prompted the interest in this topic:

where the use of a multi turn servo was proposed to operate the needle valve.

OP then asked how servos were controlled, hence this topic.

The distillation topic OP suggested that controlling a water pump via PWM and as the discussion progressed it was suggested that perhaps controlling a valve might be a better approach. The topic is ongoing.

The topic that spawned this topic centered around using a multi turn servo to operate a needle valve. That topic is also ongoing.

My thought is: if the needle valve can be operated in its middle range and it is not necessary for it to be full on or full off, then a multi turn servo with the torque available to turn the valve stem might be the solution. If however it is necessary to completely close or open the valve to get the flow control needed then another approach that included a way to sense the stalled positions at the extremes would be required.

The correct design for operating a needle valve with a motor, is to use a spline coupling that can slide and follow the needle valve shaft up and down. That way the valve is fixed in position and the controlling motor is fixed in position.

That makes total sense.

I guess if I was doing the project I’d use a stepper motor with an L6470 type controller chip that is capable of sensing the stalled condition automatically.

Perfect, except you have to determine zero each time you power up. But a very small amount of time.

A short search didn’t find a splined shaft assembly that would adapt easily for this solution. With stem travel on the order of 5-10mm, a timing belt drive might allow for the misalignment.

Doesn't anyone MAKE anything anymore?