Engineers Garage

  • Projects and Tutorials
    • Circuit Design
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Components
    • Contributions
  • Articles
    • EG Blogs
    • Insight
    • Invention Stories
    • How to
    • What Is
    • News
      • EE Design News
      • DIY Reviews
      • Guest Post
      • Sponsored Content
  • Forums
    • EG Forum Archive
    • EDABoard.com
    • Electro-Tech-Online
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • Video
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering

Micro controller based Automatic Stepper Motor Terminals Sequence Identifier

December 1, 2020 By Ashutosh Bhatt

The stepper motor has two types based on internal winding and constructions.

1. Unipolar type stepper motor and

2. Bipolar type stepper motor

Diagram of Bipolar Stepper Motor

Fig. 1: Diagram of Bipolar Stepper Motor

In bipolar type stepper motor there are two stator coils and their four terminals are provided for interface to rotate the motor. So bipolar stepper motors are having 4-wire interface always as shown in the following figure.

Diagram of 8-wire, 5-Wire and 6-Wire Interface of Bipolar Stepper Motor

Fig. 2: Diagram of 8-wire, 5-Wire and 6-Wire Interface of Bipolar Stepper Motor

While in unipolar stepper motor there are four stator coils. So there are total 8 wires (two for each coil) are provided for interface. There are 3 different interfaces for unipolar stepper motors. Please refer the figure given below.

1. 8 wire interface – all 8 terminals of 4 coils are provided for interface as shown 1st 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 2nd in above figure, one terminal of each coil (1, 3, 5 and 7) is shorted and taken out as common terminal thus it gives one common and four coil terminals (A, B, C, and D) total 5 terminals.

3. 6 wire interface – four coils are divided into group of two coils. One terminal is taken out common from group of two coils thus gives two common terminals (CMN1 and CMN2)and four coil terminals so total 6 terminals.

Prototype of Automatic Stepper Motor Terminals Sequence Identifier

Fig. 3: Prototype of Automatic Stepper Motor Terminals Sequence Identifier

We all know that to rotate stepper motor the pulses has to be applied to its coil terminals in proper sequence. If pulses are not applied in proper sequence to its coil terminals, the motor will just vibrate – does not rotate. Like to rotate unipolar stepper motor with 5 wires, the pulses are applied to its four coil terminals A, B, C and D as per given table.

Table listing pulse status for Automatic Stepper Motor Terminals Sequence Identifier

Fig. 4: Table listing pulse status for Automatic Stepper Motor Terminals Sequence Identifier

Note: the common terminal is connected to +Ve terminal of supply. In above table 0 means low logic – terminal is given 0 V so current can pass through coil.

That means the pulse has to be given to coil 1 – terminal A first, then coil 2 – terminal B and like wise. If pulses are not given in this sequence ABCD, ABCD, ABCD,…… then motor will not rotate.

So it is required to know terminal sequence of stepper motor to rotate it properly. The question is
How can we know correct and exact terminal sequence?

In most of the stepper motor, external wires of coil terminals are colour coded and they are provided by manufacturers in form of datasheets or operating manual or any related document. Also from the stepper motor make and model number one can get this information from online resources and material.

Image of Automatic Stepper Motor Terminals Sequence Identifier

Fig. 5: Image of Automatic Stepper Motor Terminals Sequence Identifier

But what if everything listed above is unknown? No make and model number of stepper motor, no any document or datasheet, no standard colour code of wires,  etc nothing. Means the stepper motor is completely unknown.

In that case, one has to find out terminal sequence by doing experiments manually. There is a manual procedure to do this. In this procedure, one has to apply pulses to different motor terminals manually using power supply (or battery) by connecting coil wires to +Ve and –Ve terminals of supply and observe whether its rotation progresses or it just vibrates back and forth. But it is very time consuming, tiresome and tedious process. Because first, one has to take paper and pen and list out different sequences. Then apply pulses as per listed sequences manually by connecting wires to +Ve and –Ve terminals of supply. Not only that but he has to observe stepper motor vary carefully that whether it rotates or not because if stepper motor has small step angle like 0.90o, 0.18o, 0.75o etc, then it is almost impossible for human eye to decide whether motor is rotating or vibrating.

So is there any solution to this problem? Yes, the solution is to make this process automatic. And the project given here is based on the same concept that it automatically identifies correct coil terminal sequence and gives you the result within minute. It uses micro controller ATmega32 that generates different pulse sequences and applies to motor terminals and when motor rotates two complete revolutions it gives terminal sequence. It displays the result on LCD that the correct sequence for terminals of motor is this. So let us see how to build this nice, interesting and very useful project.

CIRCUIT DESCRIPTION

As shown in above figure, the circuit is build using micro controller ATMega32, motor driver chip ULN2003A, opto interrupt sensor MOC7811 and 16×4 alphanumeric LCD.

• LCD data pins D0 – D7 are connected to ATMega32 port PORTA and control pins Rs and En are connected to PORTD pins PD1 and PD0 respectively. RW pin of LCD is connected to ground to enable LCD write

• One 1 KΩ pot is connected to LCD pin 3 to vary its contras

• Four LEDs are connected to PORTB pins PB4 – PB7 in common cathode configuration with current limiting resistors of 1 KΩ as shown

• Lower PORTB pins PB0 – PB3 pins drives stepper motor through current driver chip ULN2003A. These pins are connected to inputs of ULN chip and outputs of ULN chip are connected to four coil terminals of unknown stepper motor

• Common terminal of stepper motor is given +Ve supply of 5 V

• Opto interrupt sensor MOC7811 is fixed in such a way that the strip attached to motor shaft passes through the gap of sensor when motor rotates

• The internal IR LED of sensor is forward biased through current limiting resistor of 330Ω so it is always ON. Internal photo transistor is connected to 5V supply through 1 KΩ pull up resistor

• The sensor output is inverted and amplified by one more NPN transistor of 2n2222A type. The collector output of this transistor is connected to external interrupt input pin INTR (PORTD pin PD2) of ATmega32

• One 8 MHz crystal is connected to crystal input pins (XTAL1 and XTAL2) to provide internal clock to micro controller

• Reset input pin is pulled high using 1KΩ pull up resistor and one push button is connected to provide manual reset to micro controller

Image of Automatic Stepper Motor Terminals Sequence Identifier

Fig. 6: Image of Automatic Stepper Motor Terminals Sequence Identifier

CIRCUIT OPERATION

The micro controller generates different pulse sequences. It tries all possible combinations for pulse sequences. Because motor has 4 coil terminals there can be total 24 (4! = 4x3x2x1) possible combinations for pulse sequences. Out of these 24 combinations, for 12 combinations motor will rotate clockwise and for other 12 combinations, it will rotate counter clockwise. So the micro controller has to try out 12 pulse sequence combinations for motor coil terminals A, B, C and D.

First, it will apply first pulse sequence ABCD – means 1st pulse to A, 2nd pulse to B, 3rd pulse to C and 4th pulse to D and again 5th pulse to A likewise. It will display the message on LCD as “trying sequence 1 as A  B  C  D 1  2  3  4”.

If motor starts rotating and when it completes one revolution the strip passes through sensor gap that will generate an interrupt and micro controller counts this interrupt as 1 revolution of motor. If motor completes 2 revolutions, that’s it! Bingo!!!!! The coil terminal sequence is A is first coil, B is second coil, C is third coid and D is fourth coil. The LCD shows the message as “correct coil terminal sequence for motor is 1-A  2-B  3-C  4-D”.

But if motor does not rotate and just keep on vibrating, after 5 second when the timer goes off, the micro controller switches to next sequence ABDC means 1st pulse to A, 2nd to B, 3rd to D and 4th to C.

The LCD shows the message again.

Similarly after every 5 second, if motor does not rotates and completes 2 revolutions within 5 seconds, the micro controller applies next sequences. Thus it tries out all 12 following sequences.

1. A B C D
2. A B D C
3. A D B C
4. A C B D
5. A C D B
6. A D C B
7. B A C D
8. B A D C
9. C A B D
10. C A D B
11. B C A D
12. C B A D

Thus in 1 minute (5 sec x 12 sequences = 60 sec = 1 minute) micro controller applies all 12 sequences from which in one sequence, the motor will start rotating and completes two revolutions and we will get the exact coil terminal sequence.

After applying all 12 pulse sequence, if still motor does not rotate that means motor coil is internally damaged and that’s why it is not rotating. So the micro controller decides the motor is faulty and displays message on LCD as “all the possible sequence tried motor is faulty”.

Thus the given project not only identifies coil terminal sequence but also finds out motor is in working condition or not.

Project Source Code

###


#include par

#include par

#include par

par

unsigned int intr_counter=0,seq_counter=1,timer_int_count=0,new_seq_flag=0,stop_flag=0;par

par

void lcd_senddata(unsigned char data)par

 {par

 tab _delay_ms(2);par

tab PORTD=(1<

###

 


Circuit Diagrams

Circuit-Diagram-Automatic-Stepper-Motor-Terminals-Sequence-Identifier

Project Video

Related Articles Read More >

How to build an IR remote-operated RGB LED strip using Arduino
A Bluetooth-controlled datalogger robot
How to build an automatic watering system for plants using Arduino
wireless sensor network
Wireless Sensor Network example using Arduino

Featured Tutorials

  • Capacitive Touch Controlled Robot using X-Bee Module
  • Keypad Controlled RF based Wireless Robot
  • A Bluetooth-controlled datalogger robot
  • Keypad Controlled And Industrial Gas Monitoring Wireless Robot
  • Joystick Controlled Wireless Robot
  • CAN Protocol – Understanding the Controller Area Network Protocol

Stay Up To Date

Newsletter Signup

EE Training Center Classrooms

“ee

“ee

“ee

“ee

Recent Articles

  • How to build an IR remote-operated RGB LED strip using Arduino
  • Maxim launches automotive-grade secure authenticator for enhanced vehicle safety
  • Samsung offers compact, WiFi-enabled VRF air-conditioning systems
  • Nexperia launches industry’s first 80-V RET family for high-voltage circuits
  • The Amazing World of Robotics and its Promising Future
...

RSS EDABOARD.com Discussions

  • Rippe current rating of aluminium electrolytic capacitor is very low.
  • Start-up resistor for offline flyback suffers overvoltage..but is it OK?
  • Why disabled autoCsEnable in SPI doesn't allow CS gpio control in EFR32FG14
  • Spice correlation issue
  • Mic preamp and Tx on MAX260x

RSS Electro-Tech-Online.com Discussions

  • new to Ardunio but trying to compile
  • Any Ideas As to why circuit keeps breaking
  • 12v zvs induction heater
  • First time using MOSFETs project
  • Engine Temperature using an AD590 on the Oil Pressure Wire to the engine
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2021 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Circuit Design
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Components
    • Contributions
  • Articles
    • EG Blogs
    • Insight
    • Invention Stories
    • How to
    • What Is
    • News
      • EE Design News
      • DIY Reviews
      • Guest Post
      • Sponsored Content
  • Forums
    • EG Forum Archive
    • EDABoard.com
    • Electro-Tech-Online
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • Video
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering