DSPRelated.com
Forums

stepper motor control for Focus and Zoom lens

Started by Unknown December 29, 2004
I am working on a video camera design and am facing problems with the
control of the lens position using stepper motors that comes with the
lens assembly. The stepper motors are driven by motor driver chip which
is a current controlled 64-step micro step drive. I do not know the
system parameters due to which I can not model the system. The only
feedback that I have is the change in the CCD sensor output due to
change in the lens position. However the change in sensor output is
also due to the other reasons i.e. scene change etc. Thus the steppers
motor are driven in open loop.

I am not sure if focus/zoom lens in camera are driven in open
control in commercial cameras. I am wondering if they use A/D to
measure phase current to determine the state of the motor i.e. its
final position etc. due to which they are determine stall/overdrive
condition and take appropriate measure. (I have seen this idea in
several documents on the web). I am feeling that due to not being able
to control the zoom and focus motors, I am having problem in zoom
tracking i.e. maintaining focus which moving the zoom lens. I believe
the accuracy of the stepper motor may not be sufficient for this
application. Then the question comes to mind that why not use DC motor
if feedback (servo control) is used. That is puzzling me and for that
reason am not sure if feedback is necessary in this application. Using
feedback will require me to change my hardware and increase the system
cost.

I will appreciate insight from those who have experience and
understand the problem better.

Thank you,
Awais

awais.malik75@gmail.com wrote:
> I am working on a video camera design and am facing problems with the > control of the lens position using stepper motors that comes with the > lens assembly. The stepper motors are driven by motor driver chip which > is a current controlled 64-step micro step drive. I do not know the > system parameters due to which I can not model the system. The only > feedback that I have is the change in the CCD sensor output due to > change in the lens position. However the change in sensor output is > also due to the other reasons i.e. scene change etc. Thus the steppers > motor are driven in open loop. > > I am not sure if focus/zoom lens in camera are driven in open > control in commercial cameras. I am wondering if they use A/D to > measure phase current to determine the state of the motor i.e. its > final position etc. due to which they are determine stall/overdrive > condition and take appropriate measure. (I have seen this idea in > several documents on the web). I am feeling that due to not being able > to control the zoom and focus motors, I am having problem in zoom > tracking i.e. maintaining focus which moving the zoom lens. I believe > the accuracy of the stepper motor may not be sufficient for this > application. Then the question comes to mind that why not use DC motor > if feedback (servo control) is used. That is puzzling me and for that > reason am not sure if feedback is necessary in this application. Using > feedback will require me to change my hardware and increase the system > cost. > > I will appreciate insight from those who have experience and > understand the problem better. > > Thank you, > Awais
If the stepper is not overloaded or driven too fast, it is reasonable to assume that one pulse produces one step. You may need some way to establish a reference position, but not always. Focus can sometimes be achieved by adjusting the focus motor to maximize the video's high-frequency content. Out-of-focus blur is similar to the result of a low-pass filter. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Jerry Avins wrote:
> > If the stepper is not overloaded or driven too fast, it is reasonable
to
> assume that one pulse produces one step. You may need some way to > establish a reference position, but not always. Focus can sometimes
be
> achieved by adjusting the focus motor to maximize the video's > high-frequency content. Out-of-focus blur is similar to the result of
a
> low-pass filter. > > Jerry > -- > Engineering is the art of making what you want from things you can
get.
>
=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF= =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF= =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF Agree. I am not familar to camera design. But I have done a stepper motor controller in throttle system for Liquefied Petroleum Gas cars 2 years ago. I used open control for the stepper motor. the position of stepper motor should be counted by CPU. But, to count it, you could initilize the motor, such as run it to the max position and look it as 0xFF, or 1x focus position (I guess this position can be ensured by mechanical design, right?). I believe stepper motor is best in this project than any other motors. servo motor is tooooooo expensive to be used in camera, I mean economic camera. Industrial sewing mechines(around $1300) use servo motors. but the servo motor and its controller costs $1000. Kenny
Kenny wrote:

> Jerry Avins wrote: > >>If the stepper is not overloaded or driven too fast, it is reasonable > > to > >>assume that one pulse produces one step. You may need some way to >>establish a reference position, but not always. Focus can sometimes > > be > >>achieved by adjusting the focus motor to maximize the video's >>high-frequency content. Out-of-focus blur is similar to the result of > > a > >>low-pass filter. >> >>Jerry >>-- >>Engineering is the art of making what you want from things you can > > get. > > ����������������������������������������������������������������������� > > Agree. > I am not familar to camera design. But I have done a stepper motor > controller in throttle system for Liquefied Petroleum Gas cars 2 years > ago. > > I used open control for the stepper motor. the position of stepper > motor should be counted by CPU. But, to count it, you could initilize > the motor, such as run it to the max position and look it as 0xFF, or > 1x focus position (I guess this position can be ensured by mechanical > design, right?). I believe stepper motor is best in this project than > any other motors. > > servo motor is tooooooo expensive to be used in camera, I mean economic > camera. > Industrial sewing mechines(around $1300) use servo motors. but the > servo motor and its controller costs $1000. > > Kenny
I think the costs you mention are too high. Novices have trouble with sewing machines because the machines can need high torque to start and then run away if the control isn't backed off sharply once they do. I fixed that for a young friend by using a toy PM motor as a tach and closing a sloppy velocity loop around the existing series motor. The retail cost of parts for the one-off was less than $20 at the time. What a difference it made! Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
awais.malik75@gmail.com wrote:

> I am working on a video camera design and am facing problems with the > control of the lens position using stepper motors that comes with the > lens assembly. The stepper motors are driven by motor driver chip which > is a current controlled 64-step micro step drive. I do not know the > system parameters due to which I can not model the system. The only > feedback that I have is the change in the CCD sensor output due to > change in the lens position. However the change in sensor output is > also due to the other reasons i.e. scene change etc. Thus the steppers > motor are driven in open loop. > > I am not sure if focus/zoom lens in camera are driven in open > control in commercial cameras. I am wondering if they use A/D to > measure phase current to determine the state of the motor i.e. its > final position etc. due to which they are determine stall/overdrive > condition and take appropriate measure. (I have seen this idea in > several documents on the web). I am feeling that due to not being able > to control the zoom and focus motors, I am having problem in zoom > tracking i.e. maintaining focus which moving the zoom lens. I believe > the accuracy of the stepper motor may not be sufficient for this > application. Then the question comes to mind that why not use DC motor > if feedback (servo control) is used. That is puzzling me and for that > reason am not sure if feedback is necessary in this application. Using > feedback will require me to change my hardware and increase the system > cost. > > I will appreciate insight from those who have experience and > understand the problem better. > > Thank you, > Awais >
Clarify for me: You are not seeing the image go out of focus as you zoom out, are you? Most commercial zoom lenses provide automatic zoom tracking by moving a pair of lenses in a relatively complicated pattern that keeps the focus constant as the zoom is moved, with a separate focus lens to adjust focus. If you are having trouble with the focus changing as you zoom out then you either need to adjust your back focus, which is usually done by shimming the lens away from the detector (and hope that you don't need any negative shims -- they're hard to come by), or you are trying to maintain focus while zooming in (which can be shown to be somewhere between way difficult and impossible without automatic help), or you have a weird/defective lens. Going out of focus when you zoom in is normal. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Tim Wescott wrote:

  ...

> Clarify for me: You are not seeing the image go out of focus as you > zoom out, are you? Most commercial zoom lenses provide automatic zoom > tracking by moving a pair of lenses in a relatively complicated pattern > that keeps the focus constant as the zoom is moved, with a separate > focus lens to adjust focus. > > If you are having trouble with the focus changing as you zoom out then > you either need to adjust your back focus, which is usually done by > shimming the lens away from the detector (and hope that you don't need > any negative shims -- they're hard to come by), or you are trying to > maintain focus while zooming in (which can be shown to be somewhere > between way difficult and impossible without automatic help), or you > have a weird/defective lens. > > Going out of focus when you zoom in is normal.
Tim, Some terminology is is order. By definition, a zoom lens maintains focus when the effective focal length is altered, provided the back focus is properly set. (Many CCD cameras have a screw adjustment for back focus. Many camera operators don't know what the screw is for or where it is.) As you pointed out, focus is more critical at longer focal lengths, so even though it looks OK at wide angle, it may not be if zoomed out. The way to test the back focal distance is by zooming in. Variable-focus lenses that aren't designed to hold focus when the focal length is changed are called "vari-focal", not "zoom". Vari-focal lenses are most useful when they are to be used at a fixed focal length not known at the time of purchase. (Not to be confused with those spectacle lenses that distort shapes.) Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
I wanted to thank all of you taking interest in the problem.

I can control both the speed of the motor as well as the peak phase
current so that appropriate motor torque is developed to move the load
(i.e. the lens). My objective to move the stepper motor without
stall/overshoot so that my software position counter and the actual
position of the stepper motor is the same. (If not I get tracking
problems in my zoom tracking operation.) At the same time I want to
move the stepper motor as fast as I can to minimize the total time
taken by Auto Focus and setting up my position frame of reference at
the startup. Due to Open Loop operation I am not sure how can I
optimize the solution. Even if the stepper motor stalls/overshoot, I an
not sure how to detect it without a direct feedback.

Currently I am trying to optimize the parameters so that I get
repeatible results with very little variance. My lens assembly has a
Hall Sensor which tells me if my lens has reached the center of its end
to end distance. This sensor helps me setup my frame of reference for
position tracking. I am statistically trying to minimize the variance
of my end to center distance computation. I can get repeatible results
with little variance but I am not sure if this tells me anything about
the stall/overshoot. Maybe that non-ideal behaviour is also repeatible
with very small variance.

Secondly, by zoom tracking I mean trying to keep the image/video in
focus while moving the zoom lens. This involves moving the focus lens
by the correct amount (determined by lookup table and some
interoplation) to keep the image in focus. There are techniques
described in the literature to do this. My primary concern is to
optimize the performance without a direct way to detect  a
stall/overshoot. I am trying to statistically characterize the motor
behaviour so that I can control it reliably. I can start with slow
speed and low peak current and adjust them with respect to some
criteria (Currently I was trying to minimize variance when I move motor
from position 1 to position 2 - end to center). I will appreciate some
thoughts on the approach and will appreciate guidence if I am missing
something or my approach is incorrect.

Thanks,
Awais



Tim Wescott wrote:
> awais.malik75@gmail.com wrote: > > > I am working on a video camera design and am facing problems with
the
> > control of the lens position using stepper motors that comes with
the
> > lens assembly. The stepper motors are driven by motor driver chip
which
> > is a current controlled 64-step micro step drive. I do not know the > > system parameters due to which I can not model the system. The only > > feedback that I have is the change in the CCD sensor output due to > > change in the lens position. However the change in sensor output is > > also due to the other reasons i.e. scene change etc. Thus the
steppers
> > motor are driven in open loop. > > > > I am not sure if focus/zoom lens in camera are driven in open > > control in commercial cameras. I am wondering if they use A/D to > > measure phase current to determine the state of the motor i.e. its > > final position etc. due to which they are determine stall/overdrive > > condition and take appropriate measure. (I have seen this idea in > > several documents on the web). I am feeling that due to not being
able
> > to control the zoom and focus motors, I am having problem in zoom > > tracking i.e. maintaining focus which moving the zoom lens. I
believe
> > the accuracy of the stepper motor may not be sufficient for this > > application. Then the question comes to mind that why not use DC
motor
> > if feedback (servo control) is used. That is puzzling me and for
that
> > reason am not sure if feedback is necessary in this application.
Using
> > feedback will require me to change my hardware and increase the
system
> > cost. > > > > I will appreciate insight from those who have experience and > > understand the problem better. > > > > Thank you, > > Awais > > > Clarify for me: You are not seeing the image go out of focus as you > zoom out, are you? Most commercial zoom lenses provide automatic
zoom
> tracking by moving a pair of lenses in a relatively complicated
pattern
> that keeps the focus constant as the zoom is moved, with a separate > focus lens to adjust focus. > > If you are having trouble with the focus changing as you zoom out
then
> you either need to adjust your back focus, which is usually done by > shimming the lens away from the detector (and hope that you don't
need
> any negative shims -- they're hard to come by), or you are trying to > maintain focus while zooming in (which can be shown to be somewhere > between way difficult and impossible without automatic help), or you > have a weird/defective lens. > > Going out of focus when you zoom in is normal. > > -- > > Tim Wescott > Wescott Design Services > http://www.wescottdesign.com
I am really NOT very familiar with the cameras therefore I am not sure
if I am using the right terminology. I can explain in simple words how
the set of lens work. I can independently move focus lens and zoom lens
which are assembled in a lens barrel with a mechanical iris (By lens I
mean the optical thin glass and not  the whole assembly). During zoom
operation I move the zoom motor either to Tele  End or Wide End. The
image will go out of focus as the image plane will not fall on the CCD
sensor. Thus the focal length has changed and therefore to achieve
focus, the focus lens has to be moved appropriately so that the image
plane falls on the CCD sensor. I am not sure if is called "vari-focal
lens".

Awais

awais.malik75@gmail.com wrote:

> I am really NOT very familiar with the cameras therefore I am not sure > if I am using the right terminology. I can explain in simple words how > the set of lens work. I can independently move focus lens and zoom lens > which are assembled in a lens barrel with a mechanical iris (By lens I > mean the optical thin glass and not the whole assembly). During zoom > operation I move the zoom motor either to Tele End or Wide End. The > image will go out of focus as the image plane will not fall on the CCD > sensor. Thus the focal length has changed and therefore to achieve > focus, the focus lens has to be moved appropriately so that the image > plane falls on the CCD sensor. I am not sure if is called "vari-focal > lens". > > Awais
Is the lens -- the whole screw-in assembly -- described as a zoom lens or a variable-focus lens? If zoom, then you need to adjust the spacing between the shoulder of the lens mount and the image collector so that when an image is in focus at the longest focal length it remains in focus as the focal length is reduced. If, no matter how it is adjusted, you need to refocus whenever you change the focal length, you'll have to live with the extra work. You should be able to find an open-loop stepper protocol that is fast enough and doesn't skip. That protocol may require an initial ramp up but probably not a ramp down. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
"Jerry Avins" <jya@ieee.org> wrote in message 
news:33ojdeF3uq7rjU1@individual.net...
> Tim Wescott wrote: > > Tim, > > Some terminology is is order. By definition, a zoom lens maintains focus > when the effective focal length is altered, provided the back focus is > properly set. (Many CCD cameras have a screw adjustment for back focus. > Many camera operators don't know what the screw is for or where it is.) > > As you pointed out, focus is more critical at longer focal lengths, so > even though it looks OK at wide angle, it may not be if zoomed out. The > way to test the back focal distance is by zooming in. > > Variable-focus lenses that aren't designed to hold focus when the focal > length is changed are called "vari-focal", not "zoom". Vari-focal lenses > are most useful when they are to be used at a fixed focal length not > known at the time of purchase. (Not to be confused with those spectacle > lenses that distort shapes.) >
Hello Jerry, In the photography world, the term parfocal is used to denote zoom lenses that maintain focus (ideally exact) while zooming. Also the term zoom itself just means that the focal length can be changed by simply turning or push-pulling a ring or some other simple control and focus is mostly maintained. In the days of manual focus cameras, parfocality was very important, but with auto focus cameras, strict parfocality isn't required. The camera simply refocuses while zooming. In the manual focus days, many photographers would focus the lens at a long focal length and then zoom it to a shorter length for the picture. Only works if the lens is parfocal. Examples of parfocal and nonparfocal zoom lenses may be found in the lines offered by Canon and Nikon. The design just depends on what is necessary and what seems to be important. My old manual focus Nikkor zooms are parfocal and constant aperture (useful for manual cameras). One of my newer autofocus zooms (professional grade) is not parfocal - Nikon actually places several marks on the along the focusing scale, so as to aid in focusing when using different focal lengths. I find this useful in night time photography where the light level is too low for the autofocus system to work properly. This is handly for photos of the nightsky. My other Nikkor AF zooms are parfocal. Now the big thing today in lens designs is the idea of a "digital" lens - i.e., one that is useful for digital cameras. The most important thing here is to have a large back vertex focal length. (Telecentric is nice not not usually availible) This is especially important with wide angle lenses. So far the sensors are not good at accepting the light from a large set of angles without problems. The micro lenses help, but more is needed. Film has a real advantage here. For example my 20mm Nikkor lens yields excellant pics with film, but on a digital body, leaves a lot to be desired. The corners are very blurry - think about the light arriving at the antialias filter with a lot of coma. This happens since the filter is not at the focal plane. A short back vertex focal length makes the problem very apparent. Clay