Program for stepper motor interfacing with pic16f877a
The project was created with a six-wire unipolar stepper motor in mind but may work with other stepper motors with some modifications. Generally, there are three ways to move a stepper motor.
Basically, each of the wires of the stepper motor is connected to a transistor switch to allow more current through the motor. A pulse from the microcontroller turns on a transistor and effectively shorts the connected wire to ground.
Since the common pin is tied to the positive supply which is separate from the microcontroller supply , the microcontroller pin must be low to make a stepper motor wire high. It takes one step at the time and the size of each step is equal to the other. There are three excitation modes of a stepper motor; wave drive , full driveand half drive. In wave drive mode, only one winding is energized at a given time, whereas in full drive mode, two phases are energized at the same time.
The number of steps, however, are same in both wave and full drive modes. Half drive mode combines both wave drive and full drive i. The easiest way of interfacing a stepper motor with a microcontroller is via ULN transistor array chip. This IC has seven Darlington transistor drivers and is used for high current torque motors. The speed of the stepper motor can be increased or decreased via Proteus as well.
The window on the right will appear on the screen. This gives the size of a single step which is equal to 1. You can vary the number ofsteps as well as the step angle using Proteus, the effects of which will be visible during simulation. The above code represents the working of a stepper motor in full drive mode.
Electromagnets are energized one at a time. When one electromagnet is energized with the help of an external driver circuit or a microcontroller, the rotor shaft turns in such a way that it aligns itself with the stator in a position which minimizes the flux opposition. That means the electromagnet attracts the gear teeth by which the electromagnet is offset from the rest of the electromagnets. Because of this, when the next electromagnet is turned on, the first electromagnet gets turned off which results in the gear teeth getting attracted to the second electromagnet.
Thus the rotor is made rotating in steps which are an integer determined by the angle of movement in each step. According to the winding arrangements of the electromagnetic coils in a two-phase stepper motor, they are classified as unipolar and bipolar stepper motors. In the unipolar stepper motor which works with one winding with a center tap per phase, each section of the phase winding is turned on for each of the magnetic field direction.
Since unipolar stepper motors are quite easy to operate, these are highly preferred among hobbyists. In a bipolar stepper motor, there is a single winding per phase.
This makes the driver circuit lot more complicated while reversing the magnetic poles which in turn reverses the current in the winding. Usually, an H-Bridge arrangement is used to do this task. One can also purchase simpler driver chips to make the task less complicated. A unipolar stepper motor works only in positive voltage. That means it has only one polarity. The upper and lower voltage levels are positive.
For example, upper voltage level 5V and lower voltage level 0V. A unipolar stepper motor requires a wire in the middle of each coil to allow current to flow through.
In full step operation each step has a movement of 1. This is made possible by energizing either single of stator winding or two phases. Since the two phases are energized at the same time in the dual phase operation, torque and speed are greater in this kind of operation while the single phase operation requires a lower amount of power from the driver circuit.
This mode of operation requires a small amount of power. In dual phase mode, the motor operated in both phases get energized at the same time. This mode provides more torque and high-speed performance. But this mode requires twice the amount of power used in one step mode. The rotor moves through half the base angle in a single step which results in improved torque than single phase full step operation.
0コメント