You are on page 1of 7


Step Motor Control System by means of Human Machine Interface and Programmer Logic
J.C. Quezada(1), E. Flores(2), J. Bautista(3), A. López(4)
Universidad Autónoma del Estado de Hidalgo, Escuela Superior de Tizayuca, Tizayuca, Hidalgo, México
Universidad Autónoma del Estado de México, Valle de Teotihuacán, Estado de México, México
Centro de Investigación y de Estudios Avanzados del IPN, Departamento de Ciencias Computacionales, D.F.,

Abstract: Step motors are widely used in motion
control systems and they require the driver to provide
high precision in pulses synchronization in order to
obtain high precision in motor speed and thus in the
mechanisms motions, including rotation direction of
the set step motor-mechanism. In this work a control
system for a step motor is designed and implemented
on a test bank; the system consists of a GUI (Graphical
User Interface) to interact with the operator. The HMI
(Human-Machine Interface) has been designed on
proprietary software and considers, to the operator,
rules for control and monitoring of system conditions.
The HMI is interconnected with a PLC (Programmable
Logic Controller) in which the control rules and system
protections are implemented using Ladder Diagram
Language (or Ladder Logic, LL).
Key Words: Graphical User Interface, GUI; HumanMachine Interface, HMI; Ladder Logic, LL;
Programmable Logic Controller, PLC; Step motor.

1. Introduction
At industry, many manufacturing systems and
continuous processes use different types of motors (ACmotors, DC-motors and Step motors). Step motors are
commonly used for accurate motions of mechanisms
required by sophisticated machines and/or production
plants [1],[2]. The step motor control has been
traditionally carried out by using microcontroller
technologies, Field Programmable Gate Array (FPGA)
and Digital Signal Processing (DSP); however,
nowadays, industrial processes and machines are often
controlled through algorithms developed on
Programmable Logic Controllers (PLC) allowing to
modify them in an easy, quick and secure way before
new control requirements of the machines or plants
[3],[4]. PLC applications related to motors have been

primarily focused toward its startup and stopping
control and remote control by means of speed
controllers (“driver”). Logical programs developed in
PLC must guarantee the process reliability through
rules that allow to include “all” the risk possibilities as
much for people as for the plant (in this work, the step
motor) [6]. For this project the control logic has been
developed in Ladder Logic (LL) since it is still the most
used in PLC and therefore in process control [5],[6].
On the other hand, Human-Machine Interfaces
(HMI) at the present time are employed to represent in
an “identical” way the reality of the processes, allowing
the operators an interrelation between the physical
equipments of the plant with the virtual equipments of
Graphical User Interfaces (GUI) [7]. Besides, graphical
interfaces allow including events (mainly by means of
the computer’s mouse) in order to carry out control
actions and protection of the system equipments, as
well as “to read” the memory registers containing
information about the PLC variables and could using
their states to indicate, through color changes in virtual
equipments, the condition that those variables keep into
the real process and thus to facilitate to system operator
to make decisions [8].
This work shows to PLC as the step motor control
system and to HMI as the monitor through the designed
GUI. The system development is stated with a logic
about the “variables state-event to be realized:
protection and/or animation through color”.

2. Problem statement
In order to design the control algorithm, have been
considered the following aspects:
1. General requirements about the step motor control
system: variables to be controlled and/or monitored.
2. Employed control devices: HMI - PLC - Step motor.
3. The control algorithm development on LL.
4. GUI design for system control and monitoring.

as in this work. HS_VIRTUAL and SIST_D_F. The same variables TAG is used for stating points in the HMI development. The step motor control system is shown in Figure 2. Motor electrical circuit Step Table 1. Motor step sequence 1 2 3 4 White/ Black + + + + Orange Red - - - Blue - Yellow - %I CPU USB . The control system must have industrial security conditions. HMI – PLC variables addressing Address %I129 %M1 %M2 %M3 %M4 %M5 %M10 %M11 %M12 %M13 %M14 %M15 %Q17 %Q21 %Q22 %Q23 %Q24 %R35 TAG Description HS_FÍSICO Physical emergency stop HS_VIRTUAL Virtual emergency stop A_P_MOTOR Motor start up/stopping SIST_D_F In-Out system TIPO_CTL Control type: preset velocities – variable speed SENT_GIRO Motor rotation direction COND_SIST System conditions VEL_1 Preset speed 1 VEL_2 Preset speed 2 VEL_3 Preset speed 3 VEL_4 Preset speed 4 VEL_5 Preset speed 5 MOTOR Motor start up-stopping BOB_NAN “orange” coil BOB_ROJA “red” coil BOB_AZUL “blue” coil BOB_AMA “yellow” coil LEC_VEL Speed reading 2. in order to be manipulated and/or monitored and assigns them the same TAG or label. there are two subroutines with crossed contacts of the signal TIPO_CTL conditioned to only one at once is activated.PLC . Control type selection. . the motor startup-stopping signal A_P_MOTOR becomes zero.2. Control devices The GUI has been developed on software by means of a proprietary HMI installed on a PC. %Q PL C 2.[10] with capacity for modules endowed of inputs and outputs for 24 VCD digital signals. the timers’ output signal are inputs to a “counter” block with a preset value of four for four step control (Figure 5).RS485 Fuente HMI Basic system function is to control a six-wire two-phase step motor in high torque configuration. as well as for rotation change in both conditions. System requirements S t ep M o t o r Figure 2. must have of virtual type. and reads and writes data into the PLC register variables.3. For controlling the preset velocities a “timer” block is employed for determining each velocity (Figure 4). and the second one for controlling variable speed of the step motor. that is to say. TAG assignation is based on the Instrument Society of America (ISA) norm [12]. Control algorithm development Figure 3 shows the main control diagram. 2. The employed PLC is modular type [9]. and preset and variable velocities buttons. left-right. and system conditions (HS_FISICO. first subroutine is for controlling the preset velocities. HMI . preset-variable.Step motor Table 2. Variables statement and addressing in the PLC are shown in Table 2. respectively). the first algorithm line is related to the system security conditions: physical and virtual stop. Subsequently. however. Control stage have to involve an option to five preset velocities and an option to variable speed. in case of the inner signals of the PLC memory. rotation direction. and physical (of field) and virtual (on HMI) emergergency stop.1. Line two is proposed in order to make sure that at any system stopping. system inout condition. Orange White M Blue Red Black Yellow Figure 1. Digital inputs and outputs are addressed through %I and %Q respectively. also can manipulate analogical signals. they are addressed through %M for digital signals and %R for 16-bits registers [11]. “IN-OUT” selection.2 The step motor’s electric connection is shown in the next circuit (Figure 1) and the motor step sequence in the Table 1.

Equal comparative block Figure 3. Main algorithm Figure 7. the output of this block is employed in the energizing sequence of the coils. Timer block to variable speed .3 Figure 6. In Figure 7 the rotation direction sequence of the step motor is enabled through SENT_GIRO. Figure 5. as shown in Figure 7. It can be seen in Figure 6 that the equal comparative block is enabled by the signal selecting the control type TIPO_CTL. The variable speed control employs a timer block for which its desired value register is manipulated by means of the GUI. Line for a motor coil Figure 4. the real count value is taken out from the corresponding register in order to be compared through an equal comparative block (Figure 6). Counter block . Figure 8. as shown in Figure 8. Timer block From the counter block.

the step motor startup and stopping can be achieved if HS_FISICO. the same algorithm structure is used. Figure 11 presents the logic of events and actions corresponding to the speed selection 1 (VEL_1). in the PLC. Logic of HMI protections Changing the step motor rotation direction is independent from the speed control type being operated. GUI in edition .PLC . for selecting other options is the same procedure.3 0 O K RUN PO W ER SUPPLBATT Y 1 2 3 4 5 6A 71 82 3 4 5 6A 71 82 3 4 5 A 6 1 7 2 8 3 4 5 6A 71 82 3 4 5 6 7 8 B 1 2 3 4F 5 6B 71 82 3 4 F5 6B1 7 2 8 3 4 F5 B 6 17 28 3 4F 5 6B 71 82 3 4F 5 6 7 8 VAR Giro IZQ DER PRO G RAM M ABLE CO NTRO LLER 100. by means of the computer’s mouse. comparison and points sequence. HS_VIRTUAL and SIST_D_F are equal to zero. GUI design The developed GUI shown in Figure 9 presents the protection elements. and the following virtual elements (signals modified from the HMI or read from the PLC registers): emergency stop represented by means of a retentive emergency button. Figure 10 shows the GUI events diagram and the states of the variables. an analogical and digital speedometer. which guarantee that at change of control type and of motor rotation. are indicated. selector of control type preset-variable speed. 2. HMI .4 For counting. 300 RPM 0 PARO DE EMERGENCIA Velocidad 3 Velocidad 4 75 Based on the control rules. and buttons for increasing or decreasing the step motor speed in the variable speed control mode. PARO DE EMERGENCIA 000 TIPO_CTL VEL_1 = 1 VEL_2=VEL_3=VEL_4=VEL5=0 Velocidad 5 Figure 11. which at the same time carry out an action on the HMI points variables interrealted with the PLC data registers. five buttons for selecting preset velocities. selector of rotation left-right direction. which guarantee that in absence of electricity feed for the physical emergency stop. For step motor control at preset velocities.MOTOR A PASOS Tipo de Control DET GE Fa nuc PW R A SERI ES 9 0 . The HMI logic has been developed combining the programming of states of the variables with the programming of events conditioning an action. the step motor stops. button for startup-stopping of the step motor.4. about the system protections: HS_FISICO. the physical emergency stop through a security label (monitoring signal comes from field). Symbol ↑ indicates the execution. In the diagram. Logic of the preset speed control in HMI Figure 9.240 VAC 4 0 A 5 0 / 6 0 HZ + 2 4 VDC O UTPUT - B A T T E R Y Condiciones del Sistema Velocidades Predeterminadas I O FUERA Control de Velocidades DENTRO 0 Velocidad 1 Velocidad 2 150 225 0 A_P_MOTOR=0 Label “PARO DE EMERGENCIA” – oscillating in GUI HS_FISICO Label “PARO DE EMERGENCIA – hidden in the GUI 1 0 A_P_MB=0 Button “PARO DE EMERGENCIA” at GUI in red color HS_VIRTUAL Label “PARO DE EMERGENCIA” at GUI in green color 1 0 A_P_MB=0 At selector “FUERA” in red color and knob positioned in GUI SIST_D_F At selector “CONTROL” in green color and knob positioned in GUI 1 Figure 10. the actions for changing the state of a variable into the PLC memory and/or the element color in the GUI. selector of in-out condition. the sequence holds since the registers in the used blocks are the same and the containing information is taken out independently from the time in which the change of control type and of rotation direction are carried out. of an action on the GUI virtual instruments. Any of these three signals put the A_P_MOTOR at zero when they are activated. HS_VIRTUAL and SIST_D_F.

that is:  System security. and the emergency stop label corresponding to the physical stopping is not showed in the GUI. Figures 15 and 16 show the control system at preset velocities TIPO_CTL in 0. the step motor stays in red color. button and step motor in red color.5 1 TIPO_CTL Increasing %R31 Decreasing %R31 Figure 12. that is to say. In the case of variable speed control of the step motor. System testing Figure 14. the configuration is such that the changes in the corresponding timer block last 5 milliseconds (ms) each time the buttons of signal increment or decrement are pressed. Also. HS_FISICO = HS_VIRTUAL = SIST_D_F = 1. and with the left rotation direction SENT_GIRO in 0 at Figure 13. which allows having an accurate speed control. HS_VIRTUAL and SIST_D_F at 0 Figure 15. the system conditions at normal operation are showed. The HS_VIRTUAL is no longer active and the button is in green color. and  Step motor speed control. 3. in Figure 12 the HS_VIRTUAL is activated. and the motor and stop button in green color. and SIST_D_F is in out-position with red letters. . Figures 13 and 14 show the security tests of the control system. System operation with left rotation direction In Figure 14 it can be observed that HS_FISICO is activated through the label centered at the GUI. HS_FISICO at 0 Two types of tests were carried out to the step motor control system. The on-off switch of the step motor is activated and A_P_MOTOR = 1 is in wine color. while in Figure 15 SENT_GIRO is in 1 showing the message corresponding to the selector in green color and the knob in its corresponding position. Figure 13. Logic of the variable speed control The variable speed control type is manipulated by means of the HMI in order to increase or decrease the used register value of the timer block.

through programmed alarms. The maximum programmed speed of the system is 300 rpm for the variable speed control type.05 rpm Figure 20. and Figure 18 shows 85. Variable speed control – 1.6 as can be seen in Figure 17 where the digital indicator displays 1. also gives as a consequence the . Figure 16. Maximum speed of the step motor Figure 17.71 rpm.71 rpm New technologies for industrial processes automation commonly employ PLC for sequence control. however. Test bank of the speed control system of a step motor 4. Conclusions Figure 18. Variable speed control – 85. and HMI for variables monitoring and manipulation with animation in real time by means of GUI. as shown in Figure 19. Figure 20 presents a picture about the test bank where the speed control system of a step motor was implemented. The interval can be modified in the GUI design. System operation with right rotation direction Figure 19. The programming by events and actions implemented in the HMI allows support to the operators in the processes interpretation and in the early solution to problems and/or faults in the system.05 rpm.

Suesut. [11] Ge FanucTM. Nov 2005. [7] Mathiesen. he is pursuing his PhD. pp. He is currently a PhD candidate in the same specialty and Institution. He obtained his M. 20-22 Aug. Vol. Ernesto Flores obtained his MSc in Automatic Control specialty from the CINVESTAV-IPN of Mexico City. Sep 2006. MSc Flores has worked as a university researcher-professor in Control and Mathematics areas from 2004. V. Instrumentation Symbols and Identification. J. Jul 1992. 4th Edition. ASID 2009. Fabian. Vol. M. 2009.E. [9] W. . Elsevier. Automation Science and Engineering.: "Safety Verification of Programmable Logic Controller taking into account the Physical Dynamics . 99.328-331. 2005 and International Conference on Intelligent Agents. He is candidate to master in sciences by SEPI-IPN.. ETFA '06. pp. and Identification in Communication. S.. Mexico. PLC Serie 90TM . 1. 5. Mexico. Gámiz. and Yuan. Indergaard.: "Trial Implementation of a Wireless Human Machine Interface to Field Devices" Emerging Technologies and Factory Automation. pp.. 57. and Rhodes. Web Technologies and Internet Commerce.Application to Material Handling Robots" SICE 2003 Annual Conference . Mar/Apr 2002. 818.Sc.31. IEEE Conference on. Mexico. W. J.. 3rd International Conference on. S. 1992. M. His research interests include Electromechanical Systems Control.L.1-1984 (R-1992). Vol.. 8. Mexico. No. pp. pp. 6. Robotics. R.7. Mexico.. is an engineer in communication and electronics by ESIME-IPN. [2] Zhihuang Huang. Sep 2008. IEEE. 111. VOC. [10] Domingo. Lin Li. [8] Hall. The control algorithm and the logic of events and actions allow optimize the pulse sequence toward the step motor for a better speed control of this. E. K. 124. pp. Servomechanisms. Donghui Guo: "Design of stepping motor driving module for automatic microscope system" Anti-counterfeiting. 2003. Asdrúbal López Chau is an engineer in electronics and telecommunication by ESIME-IPN. 9-12.823. Cockerham. C. T. [6] Konaka.: Introducción a los Autómatas Programables. A. Grau. Manual de referencia GFK0467-SP. pp.. pp. [3] Ljungkrantz. [12] American National Standard. 135. 1997. Mexico. Currently. Microcontrollers.30/20/Micro. O. in Mechatronics Engineering in 2008 at TESE. is an engineer in electronics by the Technological Institute of Lázaro Cárdenas. Suzuki. nowadays he is working at the Universidad Autónoma del Estado de Hidalgo. and Martínez. Aug 2003.7 necessity of highly qualified personnel in applying those new technologies. Mexico. 2. 2002. Control and Automation. and Aakvaag. S. 50-54. 2002. working in the area of adaptive classification algorithms for high speed data streams. Juego de Instrucciones de la CPU. [5] Johnson. [4] Gulpanich. References [1] De Lucena. Security. Vol. He obtained his M. Jorge Bautista López. in computer engineering in 2000 at CIC-IPN.: "Stepping-Motor-Driven Constant-Shear-Rate Rotating Viscometer" Instrumentation and Measurement. He received his Engineer degree in Aeronautics from the IPN of Mexico. IEEE Transactions on . K. 2006. Kaiser. International Conference on. Authors Biography José Carlos Quezada Quezada. S.11. among others.. July 2008. 234-239. pp. Bolton: Programmable Logic Controllers.189-193.27. 2. No. at CINVESTAV-IPN..: "What's your color? [human-machine interface design]" Industry Applications Magazine. and Okuma. T. 2009. H. Tipsuwanporn. pp.Sc. 1338-1343. and Tirasesth. Vefling. His research is Instrumentation and Automation. Vol. ANSI/ISA 5. Dec 2009. H. 83-90.: "Implementation Programmable Logic Controller for THAILAND Industries" Computational Intelligence for Modeling. Ernesto Flores García. N.. 1st published. Working embedded systems with microcontrollers and programmer logic controllers. “Programmable Logic Controllers” Control Engineering.: “Formal Specification and Verification of Industrial Control Logic Components” IEEE Transactions. D. pp.. K. 2-10. Akesson.