System and method for controlling a motor

A system for controlling a motor may include a motor driver circuit for driving a camera motor. A memory capable of storing a plurality of parameters for controlling the camera motor may also be included. A set of parameters from the memory may be chosen to be applied to driving the motor. A motor control module may receive a signal from the control logic module, apply the chosen set of parameters to driving the camera motor, and command the motor driver circuit to drive the motor in accordance with the applied set of parameters. The parameters may be chosen based on desired behavior of the system and various other stimuli.

FIELD

This disclosure relates to circuits, systems, and processes for controlling a motor and, in particular, for controlling a camera lens motor.

BACKGROUND

Various types of motor controllers are used to control motors. Motor controllers may drive the motor by providing power to motor coils within the motor in various sequences in order to control operation of the motor. Simple control of a motor includes starting, stopping, and reversing direction of a motor. However, many motor applications require more sophisticated control over motors. For example, a camera lens having an auto-focus mechanism may require precise timing and positioning of the motor during focusing operations. Such systems may also require that the motor is controlled in different ways depending upon the circumstances. For example, a camera designer may want the focusing motor for a camera lens to behave one way when the camera is used to take still pictures, and another way when the camera is used to take videos.

In systems that require complex or precise motor control, motor controllers may employ more complex control algorithms to provide greater control over motor movement. For example, Proportional-Integrator-Differential (PID) controllers combine a signal representing the current position of the motor, with a signal representing the integral of the position of the motor, and a signal representing the differential of the position of the motor, in order to provide fine control over the motor as the motor moves. The function of such algorithmic controllers can be fine tuned with coefficients, e.g. constant data values that become part of the equation for controlling the motor.

SUMMARY

The present disclosure provides systems and methods for controlling a motor.

In an embodiment, a system includes a motor driver circuit for driving a camera motor and a memory capable of storing a plurality of parameters for controlling the camera motor. A control logic module configured to determine a set of the plurality of parameters to apply to driving the motor, and to generate a signal indicating which set to apply may also be included. The system may also comprise a motor control module configured to receive a signal from the control logic module, apply the set of perameters to driving the camera motor, and command the motor driver circuit to drive the motor in accordance with the applied set of parameters.

The control logic module may be further configured to determine the set of the plurality of parameters to apply based on: a mode of camera operation, a change in position of the camera motor caused by external stimulus, a distance for the camera motor to move, or a combination thereof.

In an embodiment, a method for controlling a camera motor comprises the steps of: storing a plurality of parameters in a memory for controlling a motor driver, determining a set of the plurality of parameters to apply to the motor driver to achieve a desired operation behavior of the motor; changing the operational behavior of the motor driver by applying the set of parameters to the motor driver; and driving a motor with the motor driver according to the applied set of parameters.

The method may further comprise determining the set of the plurality of parameters based on: a mode of camera operation, a change in position of the motor caused by external stimulus, a distance for the motor to move, or a combination thereof.

Like numbers in the drawings denote like elements. Connectors within circuit or block diagrams may represent single wires, buses, or other types of connections between blocks. A single connector line should not be construed to limit the type of connection to a single wire.

The figures, including the flowcharts and block diagrams, are provided for exemplary purposes and are not intended to limit the scope of this disclosure. Although the figures depict diagrams and flowcharts with particular numbers of blocks connected in particular arrangements or sequences, these are examples only. Other arrangements and sequences are within the scope of this disclosure.

DETAILED DESCRIPTION

Before describing the present invention, some introductory concepts and terminology are explained. As used herein, the term “magnetic field sensing element” is used to describe a variety of electronic elements that can sense a magnetic field. The magnetic field sensing element can be, but is not limited to, a Hall effect element, a magnetoresistance element, a magnetotransistor, or a resolver, for example.

A spinning motor can act like a generator. The electromotive force produced by the spinning motor may be referred to as back-EMF. Signals produced by this back-EMF can be measured to determine the position and speed of the motor. For example, the magnitude of the back-EMF signals may be directly proportional to the speed of the motor. In some instances, these signals can be measured without the need for an external sensor. In these so-called “sensorless systems,” the back-EMF signals may be fed back directly from the motor into an input of the motor driver circuit.

Different types of Hall effect elements can also be used to measure position and speed of the motor. These Hall effect elements include, for example, a planar Hall element, a vertical Hall element, and a circular vertical hall (CVH) element. As is also known, there are different types of magnetoresistance elements, for example, a semiconductor magnetoresistance element such as Indium Antimonide (InSb), a giant magnetoresistance (GMR) element, an anisotropic magnetoresistance element (AMR), a tunneling magnetoresistance (TMR) element, and a magnetic tunnel junction (MTJ). The magnetic field sensing element may be a single element or, alternatively, may include two or more magnetic field sensing elements arranged in various configurations, e.g., a half bridge or full (Wheatstone) bridge. Depending on the device type and other application requirements, the magnetic field sensing element may be a device made of a type IV semiconductor material such as Silicon (Si) or Germanium (Ge), or a type III-V semiconductor material like Gallium-Arsenide (GaAs) or an Indium compound, e.g., Indium-Antimonide (InSb), or another compound semiconductor materialInGaAsP, or high mobility material, for example GaN.

As used herein, the term “signal” is used to describe an electronic characteristic, analog or digital, that can change over time. In contrast, as used herein, the term “value” is used to describe a digital electronic value that tends to be static, or that tends to change from time to time. However the terms signal and value can be used interchangeably.

As used herein, the term “demand” or “demand signal” is used to describe any electronic signal, analog or digital, that controls an amount of power applied to a motor. For example, as the demand signal changes, the amount of power applied to a motor may also change.

As used herein, the terms “software” and “firmware” may refer to computer readable instructions, stored in a volatile or non-volatile computer readable storage medium (such as a hard drive or memory). For the purposes of this application a computer readable instruction may be carried out in a circuit (electronic circuit) and does not require a “computer”. The computer readable instructions, when executed by a processor or circuit, may cause the processor or circuit to perform operations and/or processes described below. The terms “software” and “firmware” may also refer to other types of instructions such as microcode, machine-code, scripts, pseudo code, or any type of computer readable instruction set that can be stored in a computer readable storage medium and executed by a processor or circuit.

This disclosure describes various circuits, systems, methods, and the like for controlling a motor. These circuits, systems, and methods may be implemented in hardware, in software, or in a combination of hardware and software. The circuits, systems, and methods may, for example, be implemented in whole or in part by an integrated circuit, by a discrete component circuit, by software instructions stored in a computer readable storage medium and executed by a computer processor or other circuit that can execute software instructions, or by a combination thereof.

Referring toFIG. 1, a system10for controlling a motor may include a motor controller12coupled to a processor14and a motor16. In an embodiment, the motor controller12may be an integrated circuit, and may be implemented on one or more silicon dies or chips. The silicon chips may be incorporated into a single package, or into multiple packages as desired.

Processor14may be any circuit or system that can communicate with and control motor controller12. In an embodiment, motor16may be a camera lens motor. For example, motor16may be a motor that focuses a camera lens that controls an aperture of a camera lens, etc. In other embodiments, motor controller12can control other types of motors including, but not limited to, a motor for controlling a valve, a motor for controlling precision positioning systems (e.g. for controlling a printer, a plotter, a precision robotic arm, a motor in an electronic pick and place machine, etc.), or for controlling motors in other actuator systems.

Motor controller12may include digital circuitry, analog circuitry, or a mix of digital and analog circuitry for driving the motor16. Motor controller12may also include processors and software code.

As shown, motor controller12may include a communications module18coupled to processor14. Communications module18may be a serial or parallel bus communications module that can send commands to and receive command from processor14. In an embodiment, communications module18may be an I2C module, a serial port, an SMBus module, a parallel port, or any other type of serial or parallel communication module.

Communications module18may also be coupled to memory20. Memory20may be a volatile or non-volatile memory that can store data. For example, memory20may be a RAM, a ROM, a met of registers, a FLASH, an EEPROM, or any other type of memory that can store data. In an embodiment, memory20may be a register set that can be written and read by other system components quickly. In an embodiment, memory20may be part of the same integrated circuit as the other circuits and blocks that comprise motor controller12. Memory20may also be a separate integrated circuit that is in the same package as the other circuits of motor controller12, or memory20may be in a separate package that can be coupled to motor controller12.

Motor controller12may also include an EEPROM and controller22. EEPROM/Controller may be a non-volatile memory that can store and retain data when motor controller12is unpowered. Memory20may access EEPROM/Controller22via memory bus24. In an embodiment, memory20may access data stored in EEPROM/controller22when motor controller12first starts up, or during operation of motor controller12. EEPROM/Controller22may include circuitry to program or re-program the contents of the EEPROM via programming signal23and/or memory bus24.

In an embodiment, memory20, EEPROM/Controller22, or any other memory module included in motor controller12may store data that can be used to control the way motor controller12drives motor16. For example, memory20may store coefficients that can be applied to circuits such as filter36and motor control module32within motor controller12to change the way motor controller12controls motor16. This process will be described below in greater detail.

Motor control12may include a control logic module26. Control logic module26may be a circuit or processor capable of controlling operation of motor controller12. Control logic module26may be coupled to memory20and capable of reading and writing data to memory20. Although not shown, control logic module26may also be coupled to and able to read and write from EEPROM/Controller22and/or any other memory module within system10. Motor control module26may also be coupled to motor driver circuit28, digital-to-analog converter (DAC)30, motor control module32, analog-to-digital converter34, and filter36.

Motor drive circuit28may be a circuit configured to drive motor16by energizing and providing power to the coils of motor16. As shown, motor drive circuit28may include an output driver control module36and an H-bridge38. The output driver control module may control switching of the transistors within H-bridge38so as to energize or do-energize the motor coils. By energizing and do-energizing the magnetic coils of motor16in various patterns and sequences, output driver control module36may cause motor16to start, stop, accelerate, decelerate, and/or change directions.

The interface40between motor driver circuit28and motor16may be a two-wire interface, as shown. Interface40may also comprise other types of motor interfaces including, but not limited to, a four-wire, five-wire, six-wire, eight-wire, or other type of motor interface. Interface40may be a single phase, double phase, three-phase, four-phase, or any other type of interface depending upon the type of motor. In an embodiment, interface40may be any type of BLDC motor interface.

Motor control module32may comprise circuitry for controlling operation of motor16. For example, circuitry within motor control module32may send signals, commands, or instructions to motor driver circuit28that control how motor driver circuit28drives motor16. These signals may include instructions such as which direction to drive motor16, a desired motor speed, a desired motor acceleration, etc. The motor driver circuit28may then drive the motor16in accordance with the instructions received from motor control module32.

In an embodiment, signals sent between motor control module32and motor driver circuit28may be analog signals, digital signals, or a combination of analog and digital signals. DAC30may, in an embodiment, convert at least some digital signals from digital to analog signals as those signals are sent from motor control module32to motor driver circuit28.

Motor controller12may also include a magnetic field sensor42, which may detect the position and/or speed of motor16and produce a signal43representative of the position and/or speed of motor16. Sensor42may be a Hall-effect sensor comprising one or more Hall-effect elements, a magnetoresistive sensor comprising one or more magnetoresistive elements, a giant-magnetoresistive sensor comprising one or more giant-magnetoresistive elements, a back-EMF sensor to detect back-EMF signals from motor16, etc. Sensor42is shown on the left side ofFIG. 1for ease of illustration. In an embodiment, sensor42may be positioned on or near motor16so that sensor42can detect the speed and position of motor16.

Amplifier44may be coupled to receive motor position signals from sensor42. Since the amplified motor position signals may include noise or other undesired signal elements, motor controller12may also include filter36.

In an embodiment, filter36may be a digital filter including, but not limited to, an FIR filter, an IIR filter, or the like. Filter36may also be configurable. For example, if filter36is an FIR or IIR filter, filter36may receive filtering coefficients from control logic module26that control the operation of filter36. When applied to filter36, these coefficients may change the transfer function of filter36. The coefficients may also change the type of filtering performed by filter36. For example, the coefficients may cause filter36to act as a low pass filter, a high pass filter, a notch filter, a band filter, or a combination thereof. In an embodiment, the coefficients may be stored in memory20and/or EEPROM/Controller22.

As shown inFIG. 1, motor controller12may implement a feedback control loop for controlling motor16. For example, the position of motor16as detected by sensor42may act as a feedback signal for controlling motor16. The position signal may be processed by filter36, converted to a digital signal by ADC34, and fed into motor control module32. Motor control module32may then instruct motor driver circuit28to drive motor16in accordance with the received feedback signal.

In operation, control logic module26may alter the way motor control module32and filter36operate by providing coefficients to motor control module32and filter36based on various factors. These factors can include whether a camera (e.g. a camera in which system10is installed) is operating in still-photograph mode or video mode, for example.

Assuming that the camera is operating in still-picture mode, it may be desirable for the camera to focus the lens as quickly as possible. It may be acceptable for the lens to overshoot and subsequently return the optimal focus position so long as the lens can move to the optimal focus position in the least possible amount of time. Accordingly, if the camera is operating in still-picture mode, control logic module26may provide coefficients to filter36and motor control module32that cause motor driver12to move motor16to the optimal focus position in the least amount of time, and which may allow for overshoot of the motor's position.

Now assuming that the camera is operating in video mode, it may be desirable for the lens to reach the optimal focus position more slowly, so long as the lens reaches the optimal focus position without any overshoot. Accordingly, if the camera is operating in video mode, control logic module26may provide coefficients to filter36and motor control module32that cause motor driver12to move motor16to the optimal focus position without overshoot.

Control logic module26may also select coefficients based upon a distance the motor must move to reach the optimal focus position. For example, if the motor must move a short distance, control logic module26may program motor control module32and/or filter with a particular set of coefficients to optimize the movement over a short distance. Alternatively, if the motor must move a longer distance, control logic module26may program motor control module32and/or filter36with another set of coefficients to optimize the movement over a longer distance. Different sets of coefficients may be programmed into motor control module32and/or filter36based on the total distance that motor16must move, and whether motor16must move a short distance, a long distance, or any intermediate distance.

Many application specify overshoot in terms of a percentage of the total movement of the motor. However, in lens autofocus applications, overshoot may be specified as a fixed number of microns. For example, an autofocus application may require the lens to reach its final position as quickly as possible and with less than X microns of overshoot regardless of the distance traveled by the lens. Therefore, if the lens travels a large distance, the motor controller may be required to move the lens with a proportionally smaller percentage overshoot than when the lens travels a small distance. Accordingly, control logic module26may apply a different set of coefficients tailored for each of these scenarios.

Control logic module26may also choose coefficients based on whether the position of motor16was changed due to external forces or stimuli. For example, if motor16is the focusing motor for a camera lens, and external forces cause the camera lens and lose focus or otherwise displace the camera lens, motor controller12may detect such movement and cause motor16to re-focus the lens. Such external forces may include a person turning the camera lens so that it is no longer focused, dropping the camera so that the lens moves out of focus, or any other external stimulus that can move the lens out of focus. As motor controller12re-focuses the lens, control logic module26may select coefficients tailored to re-focusing the lens and apply them to filter36and motor control module32.

Control logic module26may also modulate coefficients based on the position of the motor and/or the magnitude of a motor movement. Modulating the coefficients may comprise computing the coefficients so the coefficients are tailored for a specific motor movement. For example, memory20may include one or more sets of base coefficients, which can then be modified or further processed by control logic module26based on the type of motor movement requested, as well as modification coefficients which are stored in memory20.

FIG. 2is a block diagram showing control logic module26, memory200, filter36, and motor control module32. In an embodiment, memory200may be the same as or similar to memory20, EEPROM22, or other types of memory (seeFIG. 1). The signal202is an output of motor control module32that may be provided to DAC30or output driver control module36inFIG. 1.

As shown inFIG. 2, memory20may comprise sets of coefficients204,208, and210. Although three sets are shown, memory20may store more or fewer sets of coefficients as required. Memory20may also store coefficients individually, rather than in sets, if desired. The coefficients stored in memory20may be applied to motor control module32and/or filter36to control or affect the way motor control module32and/or filter36operate.

Control logic module26is shown having three inputs: a signal220representing a camera mode, a signal222representing a current position of the motor (e.g. the current position of the motor as detected by sensor42), and a command signal224. The command signal may comprise one or more pins or signals that can be used to control the motor16. For example, command signal224can include signals instructing control logic module26to move, stop, drive, or reverse the motor16. In an embodiment, command signal224comprise a signal that instructs control logic module26to apply a particular set of coefficients to filter36and/or to motor control module32. For example, the command signal224can be used to override the camera mode signal220and/or the motor position signal222and force control logic module26to apply a particular coefficient or set of coefficients, if desired. In an embodiment, control signal224may be provided by an external device or component, such as processor14for example. Control logic module26may also have other inputs that can determine, in whole or in part, which coefficients to apply to filter36and/or motor control module32.

Control logic module26may also have other inputs it can use to determine which set of coefficients to apply. These inputs may include, but are not limited to: an effort signal representing how hard the motor16is being driven, an orientation signal that indicates the physical orientation (position, direction, rotation, etc.) of the lens with respect to a fixed reference such as gravity, an ambient temperature signal, an IC or motor temperature signal, etc.

Control logic module26may include logic (e.g. circuits, software, etc.) to determine which coefficients to apply based on the signals220,222, and224.

In an embodiment, motor control module32may be a Proportional-Integral-Derivative (PID) motor controller. A PID motor controller is a negative feedback controller that calculates an error between a measured value (e.g. the position of motor16as measured by sensor42) and a desired value (e.g. a desired final position of motor16). The PID controller includes three parameters, illustrated inFIG. 2as integrator module212, differential module214, and proportional module216.

Each of these modules212,214, and216may be programmed with one or more tuning coefficients or tuning parameters. For example, the output of the motor controller may be expressed as:

u⁡(t)=Kp⁢e⁡(t)+Ki⁢∫0t⁢ⅇ⁡(T)⁢ⅆT+Kd⁢ⅆⅆt⁢ⅇ⁡(t)
where u(t) is the output signal202, e(t) is the error between the position of motor16and the desired position, Kp is the tuning coefficient for the proportional term, Ki is the tuning coefficient for the integral term, and Kd is the tuning coefficient for the derivative term. The discrete representation of this would be used in digital systems. Changing these tuning coefficients can change the way motor controller12drives motor16. For example, one set of coefficients may cause motor controller12to drive the motor so that it reaches its final position in the shortest time, another set of coefficients may cause motor16to reach its final position without any overshoot, and other sets of coefficients may cause motor16to move in various other ways.

Although described as a PID controller, motor control module32may comprise any other type of motor controller that employs coefficients. As described above, coefficients are data that can be programmed into a motor controller (or filter) to modify the way the motor controller (or filter) operates. Accordingly, motor control module32may be any type of motor controller that can be programmed with data to change the way motor control module32controls motor16.

In an embodiment, filter36may be a digital filter that utilizes coefficients, such as a finite impulse response (FIR) filter or an infinite input response (HR) filter. If filter36is an FIR filter, filter36may have an output function similar to or the same as the following:

y⁡[n]=∑i=0N⁢bi⁢x⁡[n-ⅈ]
where x[n] is the input signal (i.e. the measured position of the motor), y[n] is the filtered output signal, N is the filter order, and biis a set of filter coefficients, i.e. the tap weights, of the FIR filter. As the equation shows, a single FIR filter may have a set of N coefficients bi.

Similarly, if filter26is an HR filter, filter36may have an output function similar to or the same as the following function:

y⁡[n]=1a0⁢(∑i=0P⁢bi⁢x⁡[n-ⅈ]-∑j=1Q⁢aj⁢y⁡[n-j])
where y[n] is the output signal, x[n] is the input signal, P is the forward feedback filter order, Q is the feedback filter order, the series biis set of feed-forward filter coefficients, and the series a is the set of feedback filter coefficients (with the coefficient a0being the first coefficient in the set). As the equation shows, a single HR filter may have a set of Q coefficients aiand a set of P coefficients bi.

By changing the coefficients ai and bi, the transfer function of filter36can be changed. Accordingly, control logic module26may apply one or more coefficients from memory20to filter36in order to change the operation of filter36under particular circumstances. For example, the input filter can be used to change the way the system responds to a changes in lens position. If for example, an RC filter is used, programming the filter to have a longer time constant can help reduce the overshoot of the system.

Filter36may also comprise other types of filters and may have different types of coefficients. For example, filter36may be a ramp filter or an analog RC filter where the R or C value is controlled by a coefficient that can be programmed into a register.

Based on the inputs220,222, and224, control logic module26may determine which set204,208,210of coefficients to apply to motor control module32and filter36. For example, control logic module26may apply a different set of coefficients depending on whether signal220indicates that the system10is operating in a video mode or a camera mode, based on whether signal224has issued a command for motor16to move, based on a difference between the final position and the current position of motor16, based on whether the motor has been moved by an external stimulus, or a combination thereof. In general, control logic module26may be programmed to apply a set of coefficients to motor control module32and filter36based on any combination of input signals.

In an embodiment, based on the input signals220,222,224, control logic module26may apply the coefficients by reading the coefficients from memory20(or another memory such as memory22inFIG. 1), and program the coefficients into registers or memory locations within filter36, integrator module212, differential module214, and/or proportional module216.

Referring now toFIG. 3, a flowchart of a method300for controlling a motor is shown. In block302, it is determined wither the system is stable, i.e. whether the motor16is stable, in an expected position, and not moving. If yes, method300may proceed to block304to determine whether the system10is in a video camera mode or a still-photo camera mode. If the system10is in a video camera mode of operation, method300may proceed to block306and select a table (or set) of coefficients for video operation from, for example, memory20(SeeFIG. 2). If the system10is in a still-photo camera mode, method300may proceed to block308and select a table (or set) of still-photo camera coefficients from, for example, memory20. Method300may then proceed to block310.

In block310, method300may determine whether a command signal requesting a change in motor position was asserted. If not, method300may proceed to block312to modulate the coefficient (or coefficients) based on the current position of the motor. If so, method300may proceed to block314and modulate the coefficient (or coefficients) based on the magnitude of the requested position change, and then proceed to block312. Modulating the coefficients may include computing the coefficients, or otherwise modifying the coefficients for the particular motor movement. Method300may then proceed to block316.

In block316, method300may determine whether a coefficient change is needed. For example, method300may determine that the coefficients should be changed if the coefficients chosen and modulated in previous blocks are different from the coefficients that are currently applied to motor control module32and/or filter36(seeFIG. 2). If not, method300may proceed to block316to allow movement of the motor (i.e. to drive the motor to a new position using the already-applied coefficients). If so, method300may proceed block318.

In block318, method300may determine if the integral term (i.e. the output of integrator module212inFIG. 2) should be reset. For example, the integrator term in a PID controller may need to be reset under certain circumstances such as a new movement of the motor16, a new coefficient being applied, after a predetermined amount of time has passed, etc. If the integral term needs to be reset, method300may proceed to block320. If not, method300may proceed to block322an update the coefficients by, for example, applying the coefficients from previous blocks to motor control module32and/or filter36as described above. Once the new coefficients have been applied, method300may proceed to block316.

Method300shown inFIG. 3is an exemplary method and is not intended to define or limit the scope of the disclosure. In various embodiments, blocks in method300can be modified, removed, replaced, rearranged, and/or reordered within the scope of the disclosure.

FIG. 4shows a system10afor controlling a camera lens. A magnet400may be attached to a camera lens402. Motor controller12, which may comprise filter36(not shown inFIG. 4) and motor control module32(not shown inFIG. 4), may be coupled to motor404. In this example, motor404may be a coil which, when energized, creates a magnetic field that interacts with magnet400to move lens402up and down. The position of the lens can be sensed by motor controller12as shown by feedback signal406. Processor14may communicate with motor controller12via an I2C bus, for example, to issue commands and otherwise control or receive information from motor controller12. In order to control camera lens402, motor controller12may employ the methods and systems, including programming of coefficients, described above.