Step Motor Module

Step Motor Module
The step motor module is aimed to provide an interface to control the function of a step motor. Thus, it is necessary to understand how step motors behave and should be addressed. Definitions used in this webpage have been extracted from Wikipedia. Please refer to this website for further information.

Figure 1: Location of Step Motor Module in Design

What is a step motor?
A stepper motor (or step motor) is a brush-less DC electric motor that divides a full rotation into a number of equal steps. The motor's position can then be commanded to move and hold at one of these steps without any feedback sensor (an open-loop controller), as long as the motor is carefully sized to the application.

How does it work?
DC brush motors rotate continuously when voltage is applied to their terminals. Stepper motors, on the other hand, effectively have multiple "toothed" electromagnets arranged around a central gear-shaped piece of iron. The electromagnets are energized by an external control circuit, such as a micro-controller. 

The motor is moved by turning the shaft; so for it to turn, one electromagnet is given power, which magnetically attracts the gear's teeth. When the gear's teeth are aligned to the first electromagnet, they are slightly offset from the next electromagnet. So when the next electromagnet is turned on and the first is turned off, the gear rotates slightly to align with the next one, and from there the process is repeated. Each of those rotations is called a "step", with an integer number of steps making a full rotation. In that way, the motor can be turned by a precise angle.

How are they controlled?
As it has already been mentioned, the step motor is driven by a sequentially activate the electro-magnetic magnets within the motor. Such sequence can be produced in different forms. For the purpose of this project, it has only been considered 3 variations, though there are other possible implementations.

- Full Step (1 phase on): Activates sequentially one phase of the motor (one magnet at the time) to drive the motor
- Full Step (2 phases on): Activates sequentially one phase of the motor (two magnets at the time) to drive the motor
- Half Step: Activates sequentially one phase of the motor (shifting from two, to one, to two magnets) to drive the motor.

Figure 2 is intended to provide a graphical aid to understand the activation sequence described.
Figure 2: Step motor activation sequences


Thus, the information to select and build the step motor control module have been provided. Please, refer to the specifications of the step motor used to ensure the selection of the activation sequence.

(!) Bear in mind, that a complete sequence only involves the realization of a complete step (thus the name) so it does not necessary correspond to a complete rotation of the step motor. In order to calculate the actual rotation speed, it should be taken into account the number of steps of the step motor rotation.

Step Motor Module Design
Based on the sequences described previously, it possible to define which should be sequence/states that compose the control module. One representation of such states is shown in Figure 3
Figure 3: Angle codification accordingly to step motor driving

Therefore, the FSM that controls the step motor will haver more or less defined states depending on the driving mode of the step motor. The easy way would be to define singularly the state machine choosing one way to drive the motor. Nevertheless, it is possible to design the FSM so it is configured during the synthesis process (and match design requirements). For the purposes of project, the FSM selected for this design matches the Half Step drive of the step motor. The adaptation to either other mode is easy to accomplish following the descriptions provided. Thus, the FSM is constrained to the following states:
Figure 4: Steps and states for clockwise configuration

As it is shown in Figure 4, the Half Step FSM has a total of 8 differentiated states marking each one of the sectors (steps) the step motor can achieve. It is obvious that each coded step must be reached sequentially to perform the rotation accordingly. This first implementation uses the "Go" signal to change from one state to the other and trigger the rotation. Step signal should be implemented using a edge detector, to ensure smooth transitions between stages. It also provides a way to debug the system using push button. The sequence and codes associated to each state are represented in Figure 5.


Figure 5: FSM states transitions and output codes

All requirements for a step motor drive using Half Step configuration and clockwise rotation have been provided. It is necessary then to describe which are the processes that implement such FSM as a Moore construction. 

A new feature, advisable, to incorporate in the design would be the capability to change the rotation direction. Such modification incurs in the previously presented state machine. The addition of a new control signal (cw_ccwn) determines, in case of step = '1', which is the next stage to jump to. There are many possible ways to implement such feature, but it is proposed, as example, to use a multiplexer to select which is the next stage. By doing this, it is necessary to write "2" state encoding machines (one for clock wise and another for counter clock wise). 

Figure 6: Clockwise and counter clockwise modification

Then, the combination of Go and CW_CCWN determines which is the next state to jump to. Similarly, it could be used a signal to swap between different modes of function. This signal would select, for example between Full-Step function and Half-Step function. In this case, it would be wise to take into account that some states are shared between modes (other don't), so when a new step is triggered the machine should jump to the next appropriate state.

There are other features that could keep increasing the capabilities and complexity of the step motor module. Some features should be embedded within the design while others should be implemented as additional modules. The later are logically functions only relevant in some implementations and could be used in others scheme. Therefore, they become more useful as new components to the design.

Step Motor Module Add-ons
The first add-on feature, that might come into mind, is to add some control on the rotation speed of the motor. The system at which the step motor is connected to, might have a clock speed several times higher than the actual desired rotation speed. Thus, it is necessary to include some sort of clock divider to either feed a much slower clock frequency or to trigger the GO signal at a much lower rate (normally Power of 2 ratios). In either case, the construction is very similar

Figure 7: Down-counter for speed limitation

In Figure 7, it is shown a down counter which triggers/enables the step activation out of a set of determined clock cycles. Only when the motor has been activated and the bottom of the counter is reached, the GO signal is transferred to the Step Motor module to perform the step. Based on this design, it could be extended so different speeds can be selected and the motor is not tied to a single one. An analogy could be the gear box of a car that sets the transfer function between the engine and the wheels of a car.

A new input is added to the previously designed add-on so it is possible to transfer the speed configuration. The speed configuration is used then to set-up the down counter at different values. In this case, the configured speed represents a division factor of the maximum speed achievable by the Step Motor module. This ratio is shown in Figure 8, and if not otherwise coded (easier for the end-user) represents the achievable speeds normalized to the maximum speed.

Figure 8: Speed rate conversion

It is advisable, though, to use an intermediate en/decoding of the configured speed so the end user acknowledges a greater number as an increasing in the revolution speed and to provide a obvious smoother transition between the different speeds/gears. Once again, the codification of these speeds into the down-counter can be customized so different speed ratios can be achieved. But this is left for the reader to find out.



Subpàgines (1): Step Motor Module Project