Stepper motor has two types based on internal winding and constructions.
1. Unipolar type stepper motor and
2. Bipolar type stepper motor
Fig. 1: Bipolar stepper motor diagram
In bipolar type stepper motor there are two stator coils and their four terminals are provided as interface to rotate the motor. Therefore, bipolar stepper motors always have a 4-wire interface as shown in the following figure.
Fig. 2: Interface diagram of 8-wire, 5-wire and 6-wire bipolar stepper motor
While in unipolar stepper motor there are four stator coils. Therefore, there are a total of 8 wires (two for each coil) provided for interfacing. There are 3 different interfaces for unipolar stepper motors. See the figure below.
1. 8-wire interface – all 8 terminals of 4 coils are provided for interfacing as shown first in the above figure. A1-A2 for coil 1, B1-B2 for coil 2, C1-C2 for coil 3 and D1-D2 for coil 4.
2. 5-Wire Interface – As shown in the figure above, one terminal of each coil (1, 3, 5 and 7) is shorted and removed as the common terminal, providing one common terminal and four coil terminals (A, B , C and D) total of 5 terminals.
3. 6-wire interface – four coils are divided into groups of two coils. A common terminal is removed from the group of two coils, resulting in two common terminals (CMN1 and CMN2) and four coil terminals, totaling 6 terminals.
Fig. 3: Automatic Stepper Motor Terminal Sequence Identifier Prototype
We all know that to rotate the stepper motor, pulses must be applied to the coil terminals in the correct sequence. If the pulses are not applied in the correct sequence to the coil terminals, the motor will only vibrate – not rotate. Just like rotating a 5-wire unipolar stepper motor, pulses are applied to the four coil terminals A, B, C and D as per the table provided.
Figure 4: Table listing pulse status for automatic stepper motor terminal sequence identifier
Note: The common terminal is connected to the +Ve power terminal. In the table above, 0 means logic low – the terminal receives 0 V so that current can pass through the coil.
This means that the pulse must first be given to coil 1 – terminal A, then to coil 2 – terminal B and so on. If the pulses are not given in this sequence ABCD, ABCD, ABCD,… then the motor will not rotate.
In most stepper motors, the outer wires of the coil terminals are color coded and are provided by the manufacturers in the form of data sheets or operating manuals or any related documents. Also from stepper motor brand and model number one, you can get this information from online resources and materials.
Fig. 5: Image of the automatic stepper motor terminal sequence identifier
But what if everything listed above is unknown? No brand and model number of the stepper motor, no documents or datasheets, no standard wire color coding, etc., nothing. It means that the stepper motor is completely unknown.
In this case, you need to find out the terminal sequence by doing experiments manually. There is a manual procedure to do this. In this procedure, it is necessary to apply pulses to the different motor terminals manually using the power supply (or battery), connecting the coil wires to the +Ve and –Ve power terminals and observing whether its rotation progresses or just vibrates back and forth. back. But it is a very long, tiring and tedious process. Because first you need to take a pen and paper and list different sequences. Then, apply pulses according to the sequences listed manually, connecting the wires to the +Ve and –Ve terminals of the power supply. Not only that, but he must watch the variation of the stepper motor carefully, whether it rotates or not, because if the stepper motor has a small step angle like 0.90o, 0.18o, 0.75o etc., so it is almost impossible for the human eye to decide whether the motor is rotating or vibrating.
So, is there any solution to this problem? Yes, the solution is to automate this process. And the project presented here is based on the same concept that automatically identifies the correct sequence of coil terminals and provides the result within minutes. It uses an ATmega32 microcontroller that generates different sequences of pulses and applies it to the motor terminals and when the motor rotates two complete turns it gives sequence to the terminals. Displays on the LCD the result that the correct sequence for the motor terminals is this. So let's see how to build this cool, interesting and very useful project.
CIRCUIT DESCRIPTION
As shown in the figure above, the circuit is built using ATMega32 microcontroller, ULN2003A motor driver chip, MOC7811 opto-interrupt sensor and 16×4 alphanumeric LCD.
• Data pins D0 – D7 of LCD are connected to PORTA port of ATMega32 and control pins Rs and En are connected to PORTD pins PD1 and PD0 respectively. LCD RW pin is connected to ground to allow LCD recording
• A 1 KΩ potentiometer is connected to pin 3 of the LCD to vary its contrasts
• Four LEDs are connected to PORTB pins PB4 – PB7 in common cathode configuration with 1 KΩ current limiting resistors as shown
• PORTB lower pins PB0 – PB3 drive the stepper motor through the ULN2003A current driver chip. These pins are connected to the inputs of the ULN chip and the outputs of the ULN chip are connected to the four coil terminals of the unknown stepper motor.
• The common terminal of the stepper motor receives +Ve supply of 5 V
• The MOC7811 optical interrupt sensor is fixed in such a way that the strip fixed to the motor shaft passes through the sensor gap when the motor rotates
• The sensor's internal IR LED is forward biased through a 330Ω current limiting resistor, so it is always on. The internal phototransistor is connected to the 5 V supply through the 1 KΩ pull up resistor
• The sensor output is inverted and amplified by another NPN transistor, type 2n2222A. The collector output of this transistor is connected to the external interrupt input pin INTR (PORTD PD2 pin) of the ATmega32
• An 8 MHz crystal is connected to the crystal input pins (XTAL1 and XTAL2) to provide internal clock to the microcontroller
• The reset input pin is pulled high using a 1KΩ pull up resistor and a button is connected to provide manual reset to the microcontroller
Fig. 6: Image of the automatic stepper motor terminal sequence identifier
CIRCUIT OPERATION
The microcontroller generates different pulse sequences. It tries all possible combinations for pulse sequences. Since the motor has 4 coil terminals, there can be a total of 24 (4!=4x3x2x1) possible combinations for pulse sequences. Out of these 24 combinations, for 12 combinations the motor will rotate clockwise and for other 12 combinations, it will rotate counterclockwise. Therefore, the microcontroller must test 12 pulse sequence combinations for terminals A, B, C and D of the motor coil.
First, it will apply the first pulse sequence ABCD – means 1st pulse for A, 2nd pulse for B, 3rd pulse for C and 4th pulse for D and again 5th pulse for A in the same way. It will display message on LCD as “trying sequence 1 as ABCD 1 2 3 4”.
If the motor starts to rotate and upon completing one revolution the strip passes through the sensor opening which will generate an interruption and the microcontroller counts this interruption as 1 revolution of the motor. If the engine completes 2 revolutions, that's it! Bingo!!!!! The terminal sequence of the coil is A is the first coil, B is the second coil, C is the third coil and D is the fourth coil. The LCD shows the message as “the correct sequence of coil terminals for the motor is 1-A 2-B 3-C 4-D”.
But if the motor does not rotate and continues to vibrate, after 5 seconds when the timer goes off, the microcontroller switches to the next sequence ABDC means 1st pulse for A, 2nd for B, 3rd for D and 4th for C.
The LCD shows the message again.
Similarly, every 5 seconds, if the motor does not rotate and completes 2 rotations in 5 seconds, the microcontroller applies the next sequences. Thus, it tests all 12 following sequences.
1. | A | B | W | D |
two. | A | B | D | W |
3. | A | D | B | W |
4. | A | W | B | D |
5. | A | W | D | B |
6. | A | D | W | B |
7. | B | A | W | D |
8. | B | A | D | W |
9. | W | A | B | D |
10. | W | A | D | B |
11. | B | W | A | D |
12. | W | B | A | D |
So in 1 minute (5 seconds x 12 sequences = 60 seconds = 1 minute) the microcontroller applies all 12 sequences from which in one sequence the motor will start rotating and complete two revolutions and we will get the exact sequence of the terminals of the coil.
After applying the entire sequence of 12 pulses, if the motor still does not rotate, it means that the motor coil is damaged internally and that is why it is not rotating. So, the microcontroller decides that the motor is faulty and displays the message on the LCD as “all possible sequence of the attempted motor is faulty”.
Thus, the project in question not only identifies the sequence of coil terminals but also finds out whether the motor is running or not.
Project source code
###
#includepair #include pair #include pair pair unsigned int intr_counter=0,seq_counter=1,timer_int_count=0,new_seq_flag=0,stop_flag=0;par pair void lcd_senddata(unsigned char data)par {pair tab _delay_ms(2);par tab PORTD=(1< ###
Circuit diagrams
Circuit Diagram-Automatic-Stepper Motor-Terminals-Sequence Identifier |
Project video