You are on page 1of 12

Variable Speed Control based on Multiplexing DC and

Stepper Motors
Williams Antonio Pantoja Laces, Ignacio Algredo-Badillo, Uriel Algredo-Badillo and
Miguel ngel Hernndez Lpez
University of Istmo, UNISTMO
Computer Engineering
Ciudad Universitaria S/N, C.P. 70760
Sto. Domingo Tehuantepec, Oaxaca, Mexico
wapantojalaces@gmail.com,algredobadillo@sandunga.unistmo.edu.mx,
mahluni2000@hotmail.com
http://www.unistmo.edu.mx/
National Institute for Astrophysics, Optics and Electronics, INAOE
Electronic Department
Luis Enrique Erro 1, C.P. 72840
Sta. Ma. Tonantzintla, Puebla, Mxico
algredo@inaoep.mx
http://www.inaoep.mx/
Abstract. The electronic systems have presented many advances, which enable
important developments, being used in most cases of the human life. In general,
a system based on microprograms is core of modern applications such as
designing automata. In this work, it is presented an digital system that controls
DC and stepper motors, which is part of a wheelchair that allows improving the
human quality of people with diminished capacity. The proposed system will
provide information about of examining and evaluating a model that enables
selecting an optimal configuration and improving power consumption.
Keywords: System Embedded, DC Motor, Stepper Motor, Microcontrollers,
MC8051, autonomous wheelchair
1 Introduction
The digital development with requirements to accomplish automatic control and
signal processing causes a constant improvement, motivating the research on
technological worldwide areas. These technological advances on control systems are
providing optimal applications in cars, washing machines, microwave ovens,
telephones, wheelchairs, games, TV, video, etc. This work focuses on designing and
development an control system for automatous wheelchairs. From the 90s, research
on autonomous wheelchairs has had remarkable momentums across the world. There
is a lot of people with diminished capacity and they have difficulties on several
2 Williams Antonio Pantoja Laces, Ignacio Algredo-Badillo, Uriel Algredo-Badillo
and Miguel ngel Hernndez Lpez
situations, because it is not exist many tools to improve their lifestyle, so it is
necessary to help them with their daily activities such as object manipulation and
displacement by using controlled and/or autonomous systems. The first works in this
field enabled detection capabilities and obstacle avoidance by using ultrasonic sensors
and video camera systems for mapping the environment and navigating through
hallways, rooms and doors. However, the available processing capacity was not
sufficient to obtain a fast and precise recognition of the acquired images, the quality
of video systems at this time was low, and the ultrasonic sensors, which emit
pulsating intermittent and noises, were less accurate than today. Currently, in the
development of wheelchair, stereo vision systems have been used, in addition to laser
telemeters and omnidirectional vision to improve the precision in the ability to
navigate autonomously and with greater security. To summarize, moving the
wheelchair and controlling the robotic arms require electrical motors; they are
elements very important because great part of the system functionality is linked to the
motors to provide a control with advantages on precision, security, stability, real time
processing and low power consumption.
This paper is organized as follows: In Section 2, it is described concepts on which
this work is based and related works about of microcontrollers-based applications on
wheelchairs, DC motor and stepper motors. In Section 3, the details about of the
designing and development of the proposed system are presented, in Section 4, the
results are examined, and finally, in Section 5, conclusions are drawn.
2 Digital Systems and Motors
The control of the motors has been implemented in various ways [1] [2], including
the use of embedded systems. An embedded system is something designed to perform
one or more dedicated functions, frequently in a computer operating in real time for
example taxi clocks, recorders, access control and many other more complex
applications.
The embedded systems have several differences when they are compared against
the computational systems, such as price, power consumption and number of
hardware elements. Additionally, embedded systems use a relatively small processor
and a small memory to reduce costs. The embedded systems can control many
peripherals such as DC (Direct Current) motors and stepper motors, which will be
useful in the application to design in this work. So, the presented control is based on
the microcontroller Intel 8031 (see Fig. 1a) operating in microprocessor mode (see
Fig. 1b) and using a digital-analog converter (DAC). The DAC0832 is an element that
receives digital input data in the form of a n-bit word and transforms it in analog
signals; concisely, each binary input combination is converted to output analogic
voltage.
The microcontrollers and the DACs are most commonly devices used in signal
processing systems, digital audio, video and multimedia. The device 8031 belongs of
the family 8051, and this last one has many members, where each one of them has
various presentations; the selection of a member or another type of microcontroller
Variable Speed Control based on Multiplexing DC and Stepper Motors 3
will depend on the requirements to satisfy. The 8051 comes in three main versions,
varying in: 1) internal ROM (8051), which is directly programmed by the
manufacturer, 2) EPROM (8751) that can be programmed by the user, and 3) without
PROM or EPROM (8031), when the program is externally selected. The mC-8051 is
based on 8-bit microprocessors, containing internally an 8-bit CPU, three input/output
ports, and one control port (it contains a serial port, two inputs for 16-bit
timer/counter, two inputs for external interruptions, signals for taking data from
external storage in RAM, and the signal for reading instructions stored in external
EPROM).

Fig. 1. The device INTEL 8031: (a) main signals and (b) mode processor.

Driving a DC motor, see Fig. 2a, is very simple and only needs to apply the voltage
across motor terminals. To change the direction of this motor, it is sufficient to
reverse the power and the motor will rotate in the opposite direction. However, using
these motors generates difficulties to develop applications when great precision
control is required, because DC motors cannot be positioned in a specific point and
only tend to rotate at a speed and in a specific direction that the supplied power
permits. Moreover, when implementing digital systems, algorithms or processes are
required to control them, which require more spatial and temporal elements.
Typically, the motors and controllers are designed in a way that the motor may be
in some fixed position or be rotated in a way or the other one. For some applications,
stepper motors offer the opportunity of a precise positioning. When selecting a
stepper motors, a number of parameters must be considered, which depends on the
application. For example, the repeatability of final positioning done by a stepper
motor depends on the geometry of the motor rotor besides the stepper motors come in
a wide range of angular resolutions. The coarsest motors typically turn 90 degrees per
step, while high resolution permanent magnet motors are commonly able to handle
few degrees per step. With an appropriate controller, most permanent-magnet motor
and hybrid motors can run in half steps and some controllers can handle smaller
fractional steps or microsteps in the same motors.
There are two varieties of stepper motors: permanent magnet and variable
reluctance. The variable reluctance motors usually have three (sometimes four) coils
4 Williams Antonio Pantoja Laces, Ignacio Algredo-Badillo, Uriel Algredo-Badillo
and Miguel ngel Hernndez Lpez
with a common terminal, while permanent magnet motors usually have two
independent coils, with or without center terminal. There are two basic coil
arrangements for the electromagnetic coils: unipolar and bipolar. By one hand, the
unipolar stepper motors, see Fig. 2(b), typically these motors have five or six wires,
and usually, one or two wires are connected with the center terminal of the coils. In
the other hand, bipolar permanent magnet, see Fig. 2(c), are constructed with exactly
the same mechanism as the one used on unipolar motors, but the two coils are more
simply wired without center terminals. Thus, the motor, itself, has a simpler control
circuitry but the driver needed to reverse the polarity of each pair of motor poles is
more complex. The utilization of the motors in movable and navigational systems is
important because the motors have the main function of position in the surroundings,
and in consequence, the final systems should be safe, stable and precise.

Fig. 2. (a) Representation DC Motor, (b) Unipolar Stepper motor and (c) Bipolar Stepper
motor.

The navigation system is a group of mechanical, electrical and electronic
components so it is important to control the motors, the next works described some
navigations systems. [3] Mentions an implementation to develop an autonomous
system able of mobilizing disabled paraplegics on a wheelchair, using a simple voice
command or instructions. The control system was based on a microcontroller PIC
16F877A (Microchip) as a command master, and two slave microcontrollers for the
implementation of voice recognition and management of the actuators. In [4], the
reported design is based on previous work of mobile robotics; it uses techniques such
as ultrasonic signal conditioning to control the operation of the engines, using the
wheelchair. The chair was designed from a business model as a platform, which has
incorporated a command module, ultrasonic sensing module, central processing unit,
power control for engines, input/output bus, and a set of user interfaces.
In the same way, [5] reports a DC motor driver for a dynamometer, which is based
on a microcontroller and power electronics. The DC shunt motor on the existing
dynamometer would benefit to the dedicated DC motor driver based on a full-bridge
DC-DC converter. The development of this project involved to model the
dynamometer, enabling that the architecture of the controller be capable of handling
the torque of the dynamometer to the desired input level. This model is used to code
an Atmel microcontroller, which is required to run and interface with the power
electronics, dynamometer and user. In [6], the authors examine and implement a
microcontroller-based adjustable speed drive system for a DC shunt motor. An IGBT
Variable Speed Control based on Multiplexing DC and Stepper Motors 5
(Insulated Gate Bipolar Transistor) switch is used in buck configuration to control the
armature voltage of the motor. The PWM signal controls the IGBT and is generated
from a Motorola 68HC11 microcontroller. The speed of the motor is measured by a
shaft encoder and directly fed to the microcontroller along with a speed reference
signal. Finally, the project referenced in [7] is based on the design and
implementation of a speed control for a DC motor, using a PIC16F873 and viewing
the operation on an LCD screen. The manipulation of speed is effected by a
potentiometer and its variations are done through pulse width (PWM). At initial
moment the motor turns, the LCD screen will display a message indicating that the
motor is moving.
Considering and revising the related work, several requirements are established,
which are used to propose the design of this work.
3 Proposed Design
The description of the proposed design is divided on two parts: general methodology
and proposed algorithm. The first part is constituted by design a motherboard
(minimal system) and the second revises the proposed algorithm and block diagram.
3.1 General methodology
Evaluating the ways that the various microcontrollers offer to unroll specific
applications is extensive because each has different characteristics. In this work, the
microcontroller 8031 is taken as base for the application because the characteristics
are very adequate for digital control systems, although the selected microcontroller
can change among different microcontrollers.
The proposed control system is based on the minimum system of the
microcontroller 8031, which is operating in processor mode to examine the minimal
system providing ideas about control signals. Previously, it is implemented on a
protoboard but the connection was unstable, because the simple movement of
components makes the system had reinforcement contact. For this reason, it is
necessary to deploy a PCB (Printed Circuit Board) and to solder it the components.
To perform this task, the circuit diagram was described by using tool Proteus 7.7 SP2;
this tool is a compilation for software designing and computer simulation, developed
by Electronics Labcenter, and constituted of two main programs: Isis and Ares.
A design methodology is important because the process is completely divided in
steps, using software and hardware tools. Each step generates digital files to be
processed on the next step.
Isis (Intelligent Input Schematic System) was used to connect the components
including a microcontroller, EEPROM memory, latch and so on. The software Isis
allows designing the diagram electrical of the circuit and has many different
components to implement it. Next, it is necessary to export the design from Isis to
Ares. Ares (Advanced Routing and Editing Software) is a tool which makes the
circuit connections in the form of layout; this layout can be in one or two layers of the
6 Williams Antonio Pantoja Laces, Ignacio Algredo-Badillo, Uriel Algredo-Badillo
and Miguel ngel Hernndez Lpez
printed circuit boards, which can be done automatically or manually. If automatic
routing is done, the time is saved and several efforts are present, however, usually the
generated designs are few efficient, because they cover more area. Moreover, there is
no control on the number of via (connections between two layers of circuit board) that
can be greater, sometimes the generated number of via should be not big, because it is
difficult to perform welding on both sides of the circuit board. These first steps are
shown in Fig. 3a.

Fig. 3. Flowcharts support system

After completing the final design, it is proceeded to generate files called Gerber;
they contain information about of the tracks of two layers of the board, labels, holes,
etc. These files are used by the tool Circuit CAM, which takes the last information
and generates a new file; this is done by the circuit board plotter machine called
LPKF ProtoMat S62. This machine is controlled by the Master Board program and its
Variable Speed Control based on Multiplexing DC and Stepper Motors 7
function is to operate with a file generated by Circuit CAM, which contains the
design. The processes that the machine executes are:
1. To trace the circuit final connections on the layers of the circuit board.
2. To drill the holes corresponding to the components, and
3. To cut the final PCB.
Finally, the necessary components are placed on the final board and then soldered.
The different components are connected on the protoboard and the last steps are
shown in Fig. 3b.
After of completing the motherboard, which contains the minimal system based on
MC8031, the next part of the control system is to design the algorithm. The proposed
algorithm is coded in assembly language, so it is used a tool called MIDE-51. This
code is compiled, generating a file with extension HEX. The simulation process is
performed when the connection was completed by adding other components to the
minimal system, using previously mentioned tools and getting excellent results.
3.2 The proposed algorithm.
The proposed algorithm initially examines the modules to accomplish several
tasks, evaluating temporal and spatial resources and establishing ideas to an optimal
use of the different elements.
In this work, the Intel 8031 microcontroller is utilized, which controls a stepper
motor and a DC motor. The 8031 microcontroller is used in processor mode and only
uses the port P1 and P3 to connect the peripherals because the ports P0 and P2 are
used to read instructions from EEPROM memory. In this first version, the control
circuitry for the DC motor and the stepper motor is exclusive. The general operation
is described as follows: the external control is based on a 16-key keypad, which is
connected to the decoder 74922; this device takes as input the rows and columns from
keypad; depending of the keypad selection, a 4-bit number is obtained and displayed
in the output by using LEDs.
This number is used to select the engine speed. The keypad is divided in two
regions of eight buttons each one; the region S1 is composed of buttons whose
outputs are in the range from binaries 0 to 7 and they are used to control the stepper
motor; the region S2 is composed by buttons that provide outputs from binaries 8 to
15 and they control the DC motor speed. The outputs mentioned above are connected
to the microcontroller, which decodes and obtains an output in bits of the port P1,
specifically the bits P1.0, P1.1, P1.2, P1.3. Moreover, the bits P1.4 and P1.5 are used
to control and enable the stepper motor and DC motor, respectively. The
microcontroller has the task of recognizing and activating the motor, establishing the
speed of operation for both motors, which depends of the selection made by the
keypad.
The decoder has the following operation: If pressing the first eight buttons, the
microcontroller changes a variable speed B; this variable affects the speed of the
sequence of the stepper motor, see Table 1. Moreover, the bit P1.4 revises the
operation of the microcontroller, presenting through an LED and disabling L293
8 Williams Antonio Pantoja Laces, Ignacio Algredo-Badillo, Uriel Algredo-Badillo
and Miguel ngel Hernndez Lpez
circuit. When it happens, the motor does not perform any movement. It should be
noted that the proposed work use an H-bridge, which is encapsulated in the L293
circuit. This enables to control the stepper motor from the microcontroller because the
stepper motor requires more current than the microcontroller can provide.


Table 1. Sequence of the stepper motor
The operation for controlling the DC motor is explained in next: if pressing
someone of the eight remaining buttons, the obtained output is a binary value. Later,
this value is processed by a digital-analog decoder, which generates a voltage,
depending of the value mentioned above. The voltage obtained from DAC is applied
specifically in the charge voltage pin of the L293 circuit.
At the system startup, the stepper motor is running with the slowest speed and DC
motor is off. The block diagram of the proposed system is shown in Fig. 4.

Fig. 4. Block diagram of the proposed design.

Number of step Coil A Coil B Coil C Coil D
Step 1 1 1 0 0
Delay that depends on the variable B
Step 2 0 1 1 0
Delay that depends on the variable B
Step 3 0 0 1 0
Delay that depends on the variable B
Step 4 1 0 0 1
Delay that depends on the variable B
Variable Speed Control based on Multiplexing DC and Stepper Motors 9
The algorithm is based on a main program and a subroutine of interruption, see
Fig. 5. The main program is running inside an infinite cycle waiting an interruption.
When an interruption happens, the routine of interruption is executed; when it
finished, it returns to the start of main program, saving instructions and the motor
does not turns other step.


Fig. 5. Flowcharts of the used algorithm: (a) main routine and (b) interruption routine.
The previous algorithms were implemented by using instructions of the
microcontroller. The pseudo-codes for the main routine and interruption routine are
shown in Fig. 6.

Main routine
Interruption routine
Start
Initialize Variables and Ports
Label: Program
If Selection of velocity from keyboard
Jump to Interruption routine
Else
Sequence of steps of Stepper motor
End If
Jump to label Program
End
Read Input
If The selection is DC motor
Decode input.
Establish velocity for DC motor in the output.
Enable DC motor and disable stepper.
else
Decode input.
Change the value of the velocity Stepper motor.
Enable Stepper motor and disable DC motor.
End if
Jump to Program
(a) (b)
Fig. 6. Pseudo-codes for the parts of the proposed algorithm: (a) main routine and (b)
interruption routine.
10 Williams Antonio Pantoja Laces, Ignacio Algredo-Badillo, Uriel Algredo-Badillo
and Miguel ngel Hernndez Lpez
4 Results
All members of the family 8051 use an external crystal for the oscillator. The
crystal is selected according to the member of the family; the frequency of the crystal
can be from 500 kHz to 40 MHz. It is important to revise the manual of the
manufacturer for each device in particular, because the basic machine cycle is not a
period of clock (each instruction not happens in 83 ns if 12-MHz crystal is used), but
each instruction takes around 12 clock cycles. In order to characterize the behavior in
time of the motors it is necessary to define the following parameters:

II = Total number of instructions.
II
mn
= Minimum number of instructions.
Ii = Number of instructions for initialization.
Io = Number of instructions to define sequence of the steps
Ib = Number of instructions for interruption routine.
Ic = Number of instructions to read and decode.
I = Number of instructions for selecting DC motor.
IS =Number of instructions for selecting stepper motor.

By counting instructions, it is obtained the Eq. (1). At the best case, it is obtained a
value II
mn
, see Eq. (2)

II = Ii + Io +Ib (1)
II
mn
= Ii (2)
This means that the main routine is running; when the speed of some motor is
changed, then other instructions should be taken into account, see Eq. (3).
Ib = Ic + I|IS (3)
A value important is B, because this value offers the variable speed of the stepper
motor. B decreases when somebody pushes the relative button, increasing the speed
of the motor and requiring less instructions. The number of instructions is:

Ii =12 instructions Io = 4u + 8 B instructions
Ic = 8 instructions I = IS = S8 instructions
Ib = 46 instructions

II = 12 +4u + 8B = S2 + 8B represents the number of instructions executed in
a round of the stepper motor and by each repetition of the main program. II = S8,
represents the minimum number of instructions that are executed by each repetition of
the main program when happens an interruption. II
mn
=12 indicates the minimum
number of instructions that are executed by each repetition of the main program,
during the functioning of the motor DC. II
mux
= 98 + 8 B represents the maximum
number of instructions that are executed by each repetition of the main program,
Variable Speed Control based on Multiplexing DC and Stepper Motors 11
functioning of the stepper motor after an interruption happens. Using an oscillator 12
MHz, the duration of one instruction is approximately 1s redefined. In this case, instead
of number of instructions, it is possible to have temporal data:
II
mn
=12 (4)
II
mux
= 98 +8 B (5)
Where, II
mn
is the minimum total time required by the algorithm, and
II
mn
is the maximum total time.
In Fig. 6, temporal results are shown. If B increases, the total time decreases, see
Fig. 6a. Instead of this, if there is no interruption, the total time is constant, see Fig.
6b, whereas if there is an interruption, variable value of B is taking into account, and
the total time also is variable, see Fig. 6c.

Fig. 6. Total time of the proposed algorithm: (a) which depends of B, (b) if there is no
interruption and (c) if there is an interruption.
In future work, it is required to control a wheelchair, this wheelchair consists of two
DC motors of 24 volts in addition to several stepper motors that require high current,
which are a part of a robotic arm. It is necessary to analyze and search efficient
controls, establishing a methodology to handle current demanded from the battery as
well as the real-time response of the DC motors and stepper motors.
5 Conclusions
The objective of this work has been completed by controlling by multiplexing and
varying the speed of both DC motor and stepper motor, varying characteristics
established by the proposed application. The design of this project is a fundamental
12 Williams Antonio Pantoja Laces, Ignacio Algredo-Badillo, Uriel Algredo-Badillo
and Miguel ngel Hernndez Lpez
implementation of control systems that can be found in complex industrial
application.
The system is open to changes so that control options can be expanded. Also, the
presented work can be utilized as a base for implementing more advanced control
using a microcontroller or other system controlled, for example, by FPGA (Field
Programmable Gate Array). This last one is proposed to be examined in future works.
The final prototype has the advantage of being very economical and functional,
because it basically consists of an 8031 microcontroller, motor drivers L293 and a
DAC0832. In this case, the microcontroller changes the resolution of the stepper
motor by a determined variable. This last one functions like a timer. This resolution is
better than the one of the DC motor. Another factor influencing the precision of the
system is the value of input bits in the DAC.
The use of the PCB machine (LPKF) enables to stabilize the system because the
connections on the PCB are best, when they are compared against the ones used in the
protoboard. The microcontrollers are efficient to control the motor, but the possibility
of choosing a dedicated microcontroller with more resources is interesting, for
example more ports, timers, counters, DACs, ADCs and especially, supporting more
operation frequency (reaching responses in real time).Finally, it is important to
providing a more precise and faster system with the purpose of improving the
efficiency in real time.
6 References
1. Savita Sonoli, K.Nagabhushan Raju, "Implementation of FPGA based PID Controller for DC
Motor Speed Control System", Proceedings of the World Congress on Engineering and
Computer Science Vol II,San Francisco,USA,(WCECS 2010).
2. Ba-Hai Nguyen, Hai-Bac Ngo, Jee-Hwan Ryu, "Novel Robust Control Algorithm of DC
Motors", Korea University of Technology, The 6th International Conference on Ubiquitous
Robots and Ambient Intelligence, URAI, 2009.
3. Marcelo Arvalo Luzuriaga, "Sistema de navegacin automtica controlada por voz para una
silla de ruedas", Facultad de Ciencias de la Ingeniera, Universidad Tecnolgica
Equinoccial, Quito, Ecuador, 2011. (In Spanish)
4. Vsquez Diego, Brcenes Jimmy, "Diseo de un prototipo de una silla de ruedas para
personas minusvlidas no videntes", Fundacin Ecuatoriana para el No Vidente, FENOVI,
2005. (In Spanish)
5. Jeffrey John Jordan, "A DC Motor Drive for a Dyno Microcontroller and Power
Electronics", The School of Information Technology and Electrical Engineering the
University of Questland, 2001.
6. Gamboa Bentez Silvana del Pilar, Quelal Analuisa Paulo Alexi, Rivera Argoti Pablo,
"Diseo y construccin de un variador de velocidad con el microcontrolador 80c196mc",
Escuela Politcnica Nacional, JIEE, Vol. 19, (2005). (In Spanish)
7. Lina Mara Aguilar, Javier Mauricio Roln, Luis Javier Martnez, "Controlador de velocidad
de un motor DC basado en un PIC 16F877", Universidad Francisco de Paula Santander,
Ingeniera Electrnica. (In Spanish)

You might also like