DC Motor Control System by Using PIC Microcontroller

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Yadanabon University Research Journal, 2019, Vol-10, No.

1 1

DC Motor Control System By Using PIC Microcontroller

Mar Mar Cho , Aung Naing Oo 

Abstract
DC motor can be designed to rotate in clockwise direction, counter clockwise direction and
bidirectional rotation. The PIC microcontroller receives the instruction and processing is made.
Then it sends signals to clock wise rotation unit, counter clock wise rotation unit, bidirectional
rotation unit and display unit. The direction of rotation is shown simultaneously by both light
emitting diode and liquid crystal display. The required programs are written in Pic BASIC Pro
language in MicroCode Studio software. The programs are complied and downloaded into PIC
16F877A microcontroller and PIC16F84A microcontroller via GTP USB Lite programmer.
Key words: PIC16F84A and PIC16F877A microcontrollers, Pic Basic Pro language.

Introduction
DC motors consist of one set of coils, called armature winding, inside another set of
coils or a set of permanent magnets, called the stator. Applying a voltage to the coils produces
a torque in the armature, resulting in motion. The stator is the stationary which is outside part
of a motor. The stator of a permanent magnet dc motor is composed of two or more permanent
magnet pole pieces. The magnetic field can alternatively be created by an electromagnet. In
this case, a DC coil (field winding) is wound around a magnetic material that forms part of the
stator. The rotor is the inner part which rotates. The rotor is composed of windings (called
armature windings) which are connected to the external circuit through a mechanical
commutator. Both stator and rotor are ferromagnetic materials. The two are separated by air-
gap. A winding is made up of series or parallel connection of coils. Armature winding is the
winding through which the voltage is applied or induced. Field winding is the winding
through which a current is passed to produce flux (for the electromagnet). Windings are
usually made of copper.

PIC Microcontroller
A microcontroller is a single chip computer. Micro suggests that the device is small,
and controller suggests that the device can be used in control applications. A microcontroller
differs from a microprocessor in many ways. The main difference is that a microprocessor
requires several other components for its operation, such as program memory and data
memory, I/O devices and external clock circuit. A microcontroller on the other hand has all
the supported chips that are incorporated inside the same chip. All microcontrollers operate on
a set of instructions (or the user program) stored in their memory. A microcontroller fetches
the instructions from its program memory one by one, decodes these instructions, and then
carries out the required operations. In this work, three dc motor control units are designed and
constructed. They are clock wise rotation unit, counter clock wise rotation unit and
bidirectional rotation unit. These control units are also shown by liquid crystal display unit.


Lecturer, Dr, Department of Physics, Yadanabon University

Lecturer, Dr, Department of Physics, Yadanabon University
Yadanabon University Research Journal, 2019, Vol-10, No.1 2

Fig.1 Pin diagram and photograph of PIC16F877A microcontroller

Fig.2 Photograph and pin configuration of PIC16F84A

Design and Construction


There are five main parts of “DC Motor Control System By Using PIC Microcontroller”. They
are
(i) Regulated Power Supply Unit
(ii) Liquid Crystal Display Unit
(iii) Clock Wise Rotation Unit
(iv) Counter Clock Wise Rotation Unit
(v) Bidirectional Rotation Unit
Liquid Crystal Counter Clock Bidirectional
Clock wise
Display wise Rotation Rotation
Rotation
Unit Unit Unit
Unit

+ 5V + 12V + 12V + 12V

Regulated Power Supply Unit

Fig.3 The block diagram of the constructed system


Yadanabon University Research Journal, 2019, Vol-10, No.1 3

Regulated Power Supply Unit


The PIC16F84A and PIC16F877A microcontroller work at DC +5V well. The
required DC voltage is taken from voltage regulator (LM7805). For liquid crystal display unit,
DC +9V battery is used and for DC motor rotation unit, DC +12V battery is used separately
The pin 1 (input pin) of LM7805 is connected to positive terminal of the battery and they are
also ground. The output voltage of DC +5V is taken from pin 3 (output) of LM7805.

Liquid Crystal Display Unit


This unit shows about the construction of the whole system. The 20 characters x 4
lines liquid crystal display (2004A) is used. The pin 2 (VDD) is powered by DC +5V. The pin
3 (VEE) is also connected to middle pin of 20 k  variable resistor. The pin 1 (VSS) and pin 5
(R/ W ) are tied to ground. The pin 11 (DB4), pin 12 (DB5), pin 13 (DB6), pin 14 (DB7), pin 6
(E) and pin 4 (RS) of (2004A) are connected to pin 33 (RB0), pin 34 (RB1), pin 35 (RB2), pin
36 (RB3), pin 37 (RB4) and pin 38 (RB5) of PIC16F877A microcontroller respectively. For
back light emitting diode, the anode pin 15 is connected to DC +5V through 100  and
cathode pin 16 is grounded.

Clock Wise Rotation Unit


This unit is designed to rotate the DC motor in clock wise direction. The one end of
microswitch is connected to DC +5V and the other end is connected to pin 4 ( MCLR ) of PIC
16F84A and this end is also grounded through 10 k  resistor. So, the PIC microcontroller is
in reset mode for initial condition. Pin 6 (RB0) is connected to anode pin of green light
emitting diode. The cathode pin of LED is connected to Pin 1 of photocoupler (PC817). Pin 2
of PC817 is connected to ground. Pin 3 of PC817 and collector pin of TIP122 are tied to DC
+12V. Pin 4 of PC817 is connected to base pin of TIP122. The emitter pin of TIP122 is
connected to one end of DC motor and the other end is grounded.

Counter Clock Wise Rotation Unit


This unit is designed to rotate the DC motor in counter clock wise direction. The one
end of microswitch is connected to DC +5V and the other end is connected to pin 4 ( MCLR )
of PIC 16F84A and this end is also grounded through 10 k  resistor. So, the PIC
microcontroller is in reset mode for initial condition. Pin 6 (RB0) is connected to anode pin of
red light emitting diode. The cathode pin of LED is connected to Pin 1 of photocoupler
(PC817). Pin 2 of PC817 is connected to ground. Pin 3 of PC817 and collector pin of TIP122
are tied to DC +12V. Pin 4 of PC817 is connected to base pin of TIP122. The emitter pin of
TIP122 is connected to one end of DC motor and the other end is grounded.

Bidirectional Rotation Unit


This unit is designed to rotate the DC motor in clock wise and counter clock wise
directions. One end of the clock wise switch is connected to DC +5V and the other end is
connected to pin 4 ( MCLR ) of PIC16F84A microcontroller. This end is also grounded
through 10 k  resistor. The microcontroller is in reset mode for initial condition. For counter
clock wise rotation, one end of the counter clock wise switch is connected to DC +5V and the
other end is connected to pin 17 (RA0) of PIC16F84A microcontroller. This end is also
grounded through 10 k  resistor. So, the pin 17(RA0) is at LOW state for initial condition.
Pin6 (RB0), pin 7 (RB1) and pin 8 (RB2) of PIC16F84A microcontroller are connected to pin
2 (1A), pin 7 (2A) and pin 1 (1,2 EN) of quadruple half-H drivers (L293D) respectively. Pin8
(VCC2) and pin 16 (VCC1) of L293D are connected to DC +12V and pin 4 (GND) and pin 5
Yadanabon University Research Journal, 2019, Vol-10, No.1 4

(GND) of L293D are connected to ground. Pin 3 (1Y) of L293D is connected to one end of
DC motor and pin 6 (2Y) of L293D is also connected to other end of DC motor respectively.

Result and Discussion


The required program for liquid crystal display unit is written in Pic BASIC Pro
language. It is compiled and downloaded into PIC16F877A microcontroller. The pin 33
(RB0), pin 34 (RB1), pin 35 (RB2), pin 36 (RB3), pin 37 (RB4) and pin 38 (RB5) are defined
as output pins. When the circuit is powered, “DC MOTOR CONTROL” in the first line,
“(I)CW ROTATION” in the second line, “(II)CCW ROTATION” in the third line and
“(III)BI DIRECTION” in the fourth line are shown in liquid crystal display.
For clock wise rotation unit, the required program is written in Pic BASIC Pro Language. It is
compiled and downloaded into PIC16F84A microcontroller. The pin 6 (RB0) is defined as
output pin and CW SWITCH is fixed at pin 4 ( MCLR ). The DC motor makes clock wise
rotation as long as the switch is pressed.
For counter clock wise rotation unit, the required program is written in Pic BASIC Pro
Language. It is complied and downloaded into PIC16F84A microcontroller. The pin 6 (RB0)
is defined as output pin and CCW SWITCH is fixed at pin 4 ( MCLR ). The DC motor makes
counter clock wise rotation as long as the switch is pressed.
For bidirectional rotation unit, the required program is written in Pic BASIC Pro Language. It
is complied and downloaded into PIC16F84A microcontroller. The pin 6 (RB0), pin 7 (RB1),
pin 8 (RB2) are defined as output pin and pin 17 (RA0) is defined as input pin. BCW
SWITCH is fixed at pin 4 ( MCLR ) and BCCW SWITCH is fixed at pin 17 (RA0). The DC
motor makes counter clock wise rotation as long as BCW SWITCH is pressed. If both BCW
SWITCH and BCCW SWITCH are pressed simultaneously, the DC motor makes counter
clock wise rotation.

Conclusion
DC motor is widely used in many areas. It can be found in many places such as small
machines to large machines. The basic theory and operation of dc motor can be enhanced by
carrying out this work. The application and control of dc motor are also suggested to be
carried out as further works by using other electronic devices.
Yadanabon University Research Journal, 2019, Vol-10, No.1 5

+ 5V 20 k 
10 k
14
+ 12V
100 4
VDD
RESET MCLR
32 11 15 2 3
10 k  VDD VDD 33 11 6 1 3
RB 0 DB 4 A VDD V EE RB0
1 34 12 PC817
LED
MCLR RB 1 DB 5 PIC16F84A RED 2 4
LCD
13
RB 2 35 DB 6 2004A 22pF
16 C
RB 3 36 14 DB 7 OSC1

PIC16F877A E RS VSS R / W K 4MHz


B
TIP122

22 pF 5 16 OSC2 E
13 6 4 1 15
OSC 1 RB 4 37 22pF
DC
MOTOR
4 MHz RB 5 38
14 OSC 2 VSS
22 pF 5
VSS VSS
12 31 + 12V

14 8 16
VDD VCC2 VCC1
4 MCLR
BCW
3
1Y
10 k 6 2
14 10k RB0 1A
VDD 6 1 3
4
RB0
PIC16F84A
RESET MCLR 7 7 2A
LED
PC817 BCCW RB1
4 DC
GREEN 2 RA0 L293D MOTOR
8 1
C RB2 1,2EN
PIC16F84A 10k
22pF TIP122
B 22pF 6
16
OSC1 E 2Y
16
4MHz OSC1
DC
OSC2 MOTOR 4MHz
15
22pF VSS GND GND
OSC2
5 15 4 5
22pF VSS
5

Fig.4 Complete circuit diagram of “DC Motor Control System By Using PIC
Microcontroller”

Fig.5 The photograph of constructed circuit

Fig.6 The display of operation


Yadanabon University Research Journal, 2019, Vol-10, No.1 6

Acknowledgements
We would like to express our gratitude to Dr Maung Maung Naing, Rector, Dr Si Si
Khin, Pro-Rector and Dr Tin Moe Thuzar, Pro-Rector of Yadanabon University for their
suggestion and permission to perform this project work. We would also like to express our
great thanks to Dr Yi Yi Myint, Professor (Head of Department), Dr May Thidar Win,
Professor and all teachers and staffs from Department of Physics, Yadanabon University for
their help and discussion throughout this research work.

References
“Getting Start with PIC Microcontrollers”, Fred Stevens (1997).
"How to use Liquid Crystal Display (LCD)", PIC Microcontroller Course Electronics Training
Center (2004).
“Interfacing PIC Microcontrollers Embedded Design by Interactive Implantation”, Martin
Bates, Elsevier (2006).
“Microchip PIC16F84A Data Sheet, 18-pin Enhanced FLASH/EEPROM 8- bit Microcontroller”,
Microchip Technology Inc:, (2001).
“Microchip PIC16F877A Data Sheet, 40 pin Enhanced FLASH/ EEPROM 8-bit
Microcontroller”, Microchip Technology Inc, (2001).
T. L. Floyd, ninth edition, “Digital Fundamentals”, New Jersey (2006).

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy