56 - A Learning Model For 8051 Microcontroller Case Study On Closed Loop DC Motor Speed Control PDF
56 - A Learning Model For 8051 Microcontroller Case Study On Closed Loop DC Motor Speed Control PDF
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 3, Issue 11, November 2013)
380
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 3, Issue 11, November 2013)
The system is driven by a regulated 5V DC, 1A power Higher the PWM duty cycle higher the voltage across
supply. The system design has been kept simple so as to the DC motor, thus increasing the motor speed.
realize a less expensive miniature portable lab prototype
model. The 4x4 keypad has been used to key in the desired
motor speed. The LCD displays the desired speed and the
actual speed of the motor. There are three LEDs of Red,
Blue and green colour to indicate the comparator outputs
status i.e. Equal, Greater and Lesser. The motor driver is an
additional attachment designed in the Lab with just enough
current driving capability to drive a 6V DC toy motor.
381
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 3, Issue 11, November 2013)
In addition to these physical devices, several companies
also offer MCS-51 derivatives as IP cores for use in FPGA
or ASIC designs.
Intel's original MCS-51 family was developed using
NMOS technology, but later versions, identified by a letter
C in their name (e.g., 80C51) used CMOS technology and
consume less power than their NMOS predecessors. This
made them more suitable for battery-powered devices.
LCD: The LCD Module can easily be used with an 8051
microcontroller. The LCD requires 3 control lines and 8 I/O
lines for the data bus. The three control lines are referred to
as EN, RS, and RW. The EN line is called "Enable." To
send data to the LCD, this line is first made low (0) and then
the other two control lines are set and data is put on the data
bus. When the other lines are completely ready, EN is made
FIG:3 Duty Cycle Calculation high (1) for the minimum amount of time required by the
The speed of the motor depends on three factors: LCD datasheet (this varies from LCD to LCD), and end by
bringing it low (0) again. The RS line is the "Register
(a) Load (b) Voltage and (c) Current.
Select" line. When RS is low (0), the data is to be treated as
For a given fixed load we can maintain a steady speed by a command or special instruction (such as clear screen,
using a method called pulse width modulation (PWM). position cursor, etc.). When RS is high (1), the data being
By changing (modulating) the width of the pulse applied sent is text data which should be displayed on the screen.
to the DC motor we can increase or decrease the amount of For example, to display the letter "T" on the screen you
power provided to the motor, thereby increasing or would set RS high. The RW line is the "Read/Write" control
decreasing the motor speed. Notice that, although the line. When RW is low (0), the information on the data bus is
voltage has fixed amplitude, it has a variable duty cycle. being written to the LCD. When RW is high (1), the
That means the wider the pulse, the higher the speed. program is effectively querying (or reading) the LCD. Only
PWM is so widely used in DC motor control that some one instruction ("Get LCD status") is a read command. All
microcontrollers come with the PWM circuitry embedded in others are write commands--so RW will almost always be
the chip. In such microcontrollers the configuration registers low.
are loaded with the values of the high and low portions of KEYPAD: Keypads are often used as a primary input
the desired pulse, and the rest is taken care by the device for embedded microcontrollers. The keypads actually
microcontroller. This allows the microcontroller to do other consist of a number of switches, connected in a row/column
things. For microcontrollers without PWM circuitry, the arrangement. In order for the microcontroller to scan the
various duty cycles pulses are generated using software, keypad, it outputs a nibble to force one (only one) of the
which prevents the microcontroller from doing other things. columns low and then reads the rows to see if any buttons in
The ability to control the speed of the DC motor using that column have been pressed. The rows are pulled up by
PWM is one reason that DC motors are preferable over AC the internal weak pull-ups in the 8051 ports. Consequently,
motors. as long as no buttons are pressed, the microcontroller sees
8051 MICROCONTROLLER: The microcontroller acts logic high on each of the pins attached to the keypad rows.
like the brain of the DC motor speed control system. The The nibble driven onto the columns always contains only a
microcontroller chip that has been selected for the purpose single 0. The only way the microcontroller can find a 0 on
of controlling the speed of DC motor is 8051. any row pin is for the keypad button to be pressed that
The Intel MCS-51 (commonly referred to as 8051) is connects the column set to 0 to a row. The controller knows
Harvard architecture, single chip microcontroller (µC) series which column is at a 0-level and which row reads 0,
which was developed by Intel in 1980 for use in embedded allowing it to determine which key is pressed.
systems. While Intel no longer manufactures the MCS-51,
binary compatible derivatives remain popular today.
382
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 3, Issue 11, November 2013)
IV. DESIGN & SIMULATION
Model based design approach is an ideal approach for
Embedded System Design. There are many system model
tools available from various vendors. These tools facilitate
the design of hardware and software before actual physical
implementation of the system. Proteus tool is used for this
project. The Protues tool also provides virtual instruments
like Oscilloscope, Logic analyser to monitor the signals of
the system. Students install and learn the use of the Proteus
tool by going through the readymade examples which
comes free with the tool. Step by step design process of
building a small system for example flashing, counting,
shifting, and rotating a set of LEDs connected to 8051
Microcontroller ports is designed and practiced using the
assembly language programming and drawing the schematic
of the system. Proteus allows assembly code to be
assembled and downloaded on the virtual 8051. For C
language coding Keil compiler can be used and the
generated hex code can be used to configure and run the
virtual 8051. Fig:5 Closed Loop Flow Chart
383
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 3, Issue 11, November 2013)
The hardware development setup is shown in Fig-6. The Fig:7 Motor Driver Diagram
8051 KIT is procured from a local vendor. The Motor driver
II. TESTING & OBSERVATION
unit is assembled using the motor, gear and wheel
arrangement available in a bought out Toy Mechano KIT. The motor control system is tested in both open loop and
The 8051 KIT and the motor driver unit as shown in the closed loop. Table-1 shows the PWM duty cycle and the
figure are driven by an external +5V Lab power supply. The speed of rotation of the motor in open loop without the
micro controller is programmed by the Topwin programmer speed feedback. As seen the motor fails to start at low ON
before mounting on the 8051 socket of the KIT. Two period since the average voltage across motor is not
important signals i.e. PWM from microcontroller KIT to sufficient to overcome the stall inertia. Table – 2 shows
motor driver unit and motor speed encoder clock from the observation during closed loop system. The numeral 1 to 9
motor driver unit to microcontroller KIT, and common is keyed in, which represents 10% to 90% duty cycle
ground signal are wired between the two units. The motor respectively. The next column shows the actual speed
driver unit has a 9 pin D connector through which all the closely following the desired speed which confirms the
signals are brought out. closed loop operation of the motor. Initially the motor
The motor driver as shown in Fig-7 is a Darlington rotates from stall condition and the actual speed gradually
transistor comprising of a switching transistor BC 457 and increases and matches the desired speed. While the motor is
power transistor SL100 to drive sufficient current to rotate picking up speed the three Red, Green and Blue LED
the motor. When the low power switching transistor BC-457 displays the relational difference between the desired speed
is OFF the high power transistor SL-100 is ON and them and actual speed as given in following examples.
motor gets supply current and rotates. Hence the PWM
Design Simulation
pulse needs to be reversed so that ON period of PWM
decides the motor ON period. The average voltage decides Let SET SPEED=A and ACTUAL SPEED=B
speed of the motor. The IR LED based speed encoder If A>B then RED LED will glow.
generates pulses in proportion to the rotation of the motor.
The speed encoder is made out of a wheel with 8 holes. So If A<B then GREEN LED will glow.
the IR transmitter/receiver LED generates 8 pulses per one If A=B then BLUE LED will glow.
revolution of the motor.
384
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 3, Issue 11, November 2013)
Example.1 Example.2 Example.3 TABLE I
Key Press=8 Key Press=8 Key Press=8 Up/Dn Total On time Off time Duty Speed
time Pulses
Set Speed=44 Set Speed=44 Set Speed=44 Counter (µ sec) (µ sec) Cycle per sec
Output (µ sec)
%
Actual Speed=44 Actual Speed=45 Actual Speed=41
LED Glow=BLUE LED Glow=GREEN LED Glow=RED 0000 160 10 150 6.250 -
0001 160 20 140 12.50 -
0010 160 30 130 18.75 -
0011 160 40 120 25.00 -
0100 160 50 110 31.25 -
0101 160 60 100 37.50 12
0110 160 70 90 43.75 16
0111 160 80 80 50.00 24
1000 160 90 70 56.25 28
1001 160 100 60 62.50 34
1010 160 110 50 68.75 40
1011 160 120 40 75.00 44
1100 160 130 30 81.25 50
1101 160 140 20 87.50 54
1110 160 150 10 93.75 56
1111 160 150 10 93.85 56
Fig:8 PWM & Motor Speed Waveform
385
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 3, Issue 11, November 2013)
V. CONCLUSION & FUTURE SCOPE [2] MCS-51TM Macro Assembler User's Guide, Publication number
9800937, Intel Corporation.
The design of a closed loop system to control the speed [3] Prof. shashank pujari, ―A simple closed loop dc motor speed control
of a DC Motor was successfully implemented in this paper. system on fpga platform for vhdl beginner‖, International Journal of
DC motors have speed control capabilities which means that Scientific & Engineering Research Volume 4, Issue3, March-2013
speed, torque and even direction of rotation can be changed [4] Jimenez-Fernandez, A. ; Arquitectura y Tecnol. de Computadore,
at any time to meet new condition. The hardware of the Univ. de Sevilla, Sevilla ; Paz-Vicente, R. ; Rivas, M. ; Linares-
Barranco, A.,‖ AER-based robotic closed-loop control system‖,
proposed system and interfacing with computer is explained ISCAS 2008.
in this paper .The case study satisfied the objective of [5] Beetner, d. ; dept. of electr. & comput. eng., missouri univ., rolla,
learning 8051 microcontroller in a practical way. mo, usa ; pottinger, h. ; mitchell, k. ―Laboratories teaching concepts
The paper can be redesigned on AVR and ARM in microcontrollers and hardware-software co-design‖, frontiers in
microcontroller platforms. The scope of the project can be education conference, 2000. fie 2000. 30th annual (volume:2 )
further extended by inclusion of a PID controller in control [6] Mazidi & mazidi ―The 8051 Microcontroller Embedded Systems‖.
system taking into account motor electrical time constant. [7] Proteus & Keil user manual.
[8] Guoshing Huang ,Shuocheng Lee‖PC-based PID speed control
Acknowledgment in DC motor‖
Authors wish to thank Sambalpur University Institute Of [9] T.C. Green 1 ; B.W. Williams ―Derivation of motor line-current
Information Technology for the support in providing the waveforms from the DC-link current of an inverter‖, : IEE
development tools, KITs and laboratory infrastructure in Proceedings B (Electric Power Applications), Volume 136,
Issue 4, July 1989, p. 196 – 204
carrying out this project.
REFERENCES
[1] John Wharton: An Introduction to the Intel MCS-51TM Single-Chip
Microcomputer Family, Application Note AP-69, May 1980, Intel
Corporation.
386