58
1 GSM BASED DC MOTOR SPEED CONTROL 1. INTRODUCTION This project mainly deals with the speed control of a DC Motor using a GSM. The type of speed control that has been chosen here is pulse width modulation PWM. This project deals with development of DC MOTOR control using PC using PWM. 12V DC Motor drives widely use Micro controllers and The project detail design and complete hardware based high performance DC drive control system will be implemented. Most recently new requirements have arisen. These include faster torque control update with flexible design capability of motion peripherals for high performance military drive applications. Pulse width modulation type of speed control is chosen here because of high accuracy, high reliability, quick response and high efficiency. Our project deals with the types of problems that we face due to disturbances in supply voltage or load on the motor and enables us to overcome these difficulties by helping us with the appropriate software and hardware. We propose to design an embedded controller that helps us maintain the speed of the DC machine within the specific limits and a remote operate the embedded controller. Here, the pulses from the remote are sensed by sensor and are transmitted to the embedded controller. This controller contains a programmable PWM port. The output of this PWM port is used to control power delivered by a power regulating device.

GSM Based DC Motor Control (PWM Technique)

Embed Size (px)

Citation preview

Page 1: GSM Based DC Motor Control (PWM Technique)

1

GSM BASED DC MOTOR SPEED CONTROL

1. INTRODUCTION

This project mainly deals with the speed control of a DC

Motor using a GSM. The type of speed control that has been chosen here is pulse

width modulation PWM. This project deals with development of DC MOTOR

control using PC using PWM. 12V DC Motor drives widely use Micro controllers

and The project detail design and complete hardware based high performance DC

drive control system will be implemented. Most recently new requirements have

arisen. These include faster torque control update with flexible design capability of

motion peripherals for high performance military drive applications. Pulse width

modulation type of speed control is chosen here because of high accuracy, high

reliability, quick response and high efficiency.

Our project deals with the types of problems that we face due to disturbances

in supply voltage or load on the motor and enables us to overcome these

difficulties by helping us with the appropriate software and hardware.

We propose to design an embedded controller that helps us maintain the

speed of the DC machine within the specific limits and a remote operate the

embedded controller. Here, the pulses from the remote are sensed by sensor and

are transmitted to the embedded controller. This controller contains a

programmable PWM port. The output of this PWM port is used to control power

delivered by a power regulating device.

Page 2: GSM Based DC Motor Control (PWM Technique)

2

1.1. HARDWARE COMPONENTS:

1. POWERSUPPLY UNIT

(TRANSFORMER, 7805 & 7812 REGULATORS, CAPACITOR 1000mf)

2. 89C52 MICROCONTROLLER

3. DC MOTOR

4. ULN 2803 DRIVER IC

5. DB 9 CONNECTOR

6. MAX 232 IC

1.2. SOFTWARE:

Soft Ware developed for this project in Embedded ‘C’ using KEIL-3.

Page 3: GSM Based DC Motor Control (PWM Technique)

3

BLOCK DIAGRAM:

.

2. EMBEDDED SYSTEMS

2.1. DEFINITIONS:

Embedded system is a combination of hardware and software, it is also named

as “Firm ware”.

AT89C52

Micro

controller

unit

DTMF

HT9170B

POWER

SUPPLY

SUPPLY

MOBILE

(GSM)

MOTOR

DRIVER

DC MOTOR MOBILE

CONNECTIONNR

Page 4: GSM Based DC Motor Control (PWM Technique)

4

An embedded system is a special purpose computer system, which is

completely encapsulated by the device it controls. It is a computer-controlled

system.

An embedded system is a specialized system that is a part of a larger system

or machine. As a part of a larger system it largely determines its functionality.

Embedded systems are electronic devices that incorporate microprocessors with in

their implementations. The main purpose of the microprocessors are simplify the

system design and improve flexibility. In the embedded systems, the software is

often stored in a read only memory (RAM) chip.

Embedded systems provide several major functions including monitoring of

the analog environment by reading data from sensors and controlling actuators.

Inputs (sensor) Outputs (actuator)

Figure: A real time system interacts with environment

Embedded

System

Page 5: GSM Based DC Motor Control (PWM Technique)

5

2.2. EXAMPLES OF EMBEDDED SYSTEMS:

Embedded systems are found in wide range of application areas. Originally they

were used only for expensive industrial control applications, but as technology

brought down the cost of dedicated processors, they began to appear in

moderately expensive applications such as automobiles, communication and

office equipments and television Today's embedded systems are so inexpensive

that they are used in almost every electronic product in our life. Embedded

systems are often designed for mass production.

Some examples of embedded systems:

Automatic Teller Machines

Cellular telephone and telephone switches

Computer network equipment

Computer printers

Disk drives

Engine controllers and antilock break controllers for automobiles

Home automation products

Handheld calculators

Household appliances

Medical equipment

Page 6: GSM Based DC Motor Control (PWM Technique)

6

Measurement equipment

Multifunction wrist watches

Multifunction printers

Mobile phones with additional capabilities

Programmable Logic Controllers

3. BLOCK DIAGRAM

`

3.1. MICROPROCESSOR AND MICROCONTROLLER

Microprocessors and microcontrollers are used in embedded system products.

An embedded product uses a microprocessor (or microcontroller) to do one task and

one task only. Microprocessor as the term come to be known is a general purpose

89C52

HT

9170B

DRIVER

TRAIC

AC

MOTOR

Page 7: GSM Based DC Motor Control (PWM Technique)

7

digital computer central processing unit. Although popularly known as a "computer

on chip", the microprocessor is in no sense a complete digital computer.

Microprocessor CPU contains Arithmetic Logical Unit, a program counter, a

stack pointer, some working registers, a clock timing circuits and interrupt

circuit. To make complete microcomputer memory must add, usually Read Only

Memory, Random Access Memory, memory decoders and an Input/output

devices. In addition special purpose devices such as interrupts, counters may be

added to relieve the CPU from time consuming counting or timing chores.

The hardware design of microprocessor CPU is arranged so that a small or very

large system can be configured around the CPU as the application demands. The

internal CPU architecture as well as the resultant machine level code that

operates that architecture is comprehensive but as flexible as possible.

The prime use of microprocessor is to read data perform extensive calculations

on that data and store those calculations in mass storage devices or display the

results for user use. The program is used by microprocessor are stored in the

mass storage devices and loaded into RAM as the user directs.

A microcontrollers is a computer on a single chip .Micro suggest that the device

is small and controller tells that the device is used to control objects, process or

events

Page 8: GSM Based DC Motor Control (PWM Technique)

8

Microcontroller is a highly integrated chip that contains all the devices

comprising a computer. Typically this includes a CPU, RAM, Input/ Output

ports, timers, interrupts. So microcontroller is also called as "true computer on a

chip". Unlike a general purpose computer which also includes all of these

devices. A microcontroller is designed for a very specific task to control a

particular system.

A microcontroller is a general purpose device but one that is meant to read data,

performs limited calculations on that data and control its environment based on

those calculations.

The prime use of microcontroller is to control the operation of machine using

a fixed program that is stored in ROM that does not change over the life time of the

system.

The advantages of microcontroller over microprocessor are

cost is less

speed is more

power consumption is less

compact device

external components are minimum

Page 9: GSM Based DC Motor Control (PWM Technique)

9

3.2. MICROPROCESSOR VERSES MICROCONTROLLER

The contrast between microprocessor and microcontroller is best exemplified by

the fact that:

Most microprocessor have operational codes for moving data from external

memory to CPU, microcontroller may have one or two.

Microprocessor may have one or two types of bit handling instructions

microcontroller will have many.

Microprocessor concerned with rapid movement of code and data from

external address to the chip, microcontroller is concerned with rapid data

movement of bits with in chip.

Microcontroller can function as a computer with out addition of external

devices, but microprocessor must have many additions to operate an

computer.

4. MICROCONTROLLER

4.1. A BRIEF HISTORY OF 8051:

In 1981, Intel Corporation introduced an 8 bit microcontroller called 8051.

This microcontroller had 128 bytes of RAM, 4K bytes of chip ROM, two timers, one

serial port, and four ports all on a single chip. At the time it was also referred as “A

SYSTEM ON A CHIP”.

Page 10: GSM Based DC Motor Control (PWM Technique)

10

The 8051 is an 8-bit processor meaning that the CPU can work only on 8 bits

data at a time. Data larger than 8 bits has to be broken into 8 bits pieces to be

processed by the CPU. The 8051 has a total of four I\O ports each 8 bit wide.

There are many versions of 8051 with different speeds and amount of on-chip

ROM and they are all compatible with the original 8051. This means that if you

write a program for one it will run on any of them.

The 8051 is an original member of the 8051 family. There are two other members in

the 8051 family of microcontrollers. They are 8052 and 8031. All the three

microcontrollers will have the same internal architecture, but they differ in the

following aspects.

8031 has 128 bytes of RAM, two timers and 6 interrupts.

8051 has 4K ROM, 128 bytes of RAM, two timers and 6 interrupts.

8052 has 8K ROM, 128 bytes of RAM, three timers and 8 interrupts.

Of the three microcontrollers, 8051 is the most preferable. Microcontroller

supports both serial and parallel communication.

In the concerned project 8052 microcontroller is used. Here microcontroller

used is AT89C52, which is manufactured by ATMEL laboratories.

Page 11: GSM Based DC Motor Control (PWM Technique)

11

4.2. Description of 89C52 Microcontroller:

The AT89C52 provides the following standard features: 8Kbytes of Flash,

256 bytes of RAM, 32 I/O lines, three 16-bit timer/counters, six-vector two-level

interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry.

In addition, the AT89C52 is designed with static logic for operation down to zero

frequency and supports two software selectable power saving modes. The Idle Mode

stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt

system to continue functioning. The Power down Mode saves the RAM contents but

freezes the oscillator, disabling all other chip functions until the next hardware reset.

By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel

AT89C52 is a powerful microcomputer which provides a highly flexible and cost

effective solution to many embedded control applications.

4.3. Features of Microcontroller (8052)

Compatible with MCS-51 Products

8 Kbytes of In-System Reprogrammable Flash Memory

Endurance: 1,000 Write/Erase Cycles

Fully Static Operation: 0 Hz to 24 MHz

Three-Level Program Memory Lock

256 x 8-Bit Internal RAM

Page 12: GSM Based DC Motor Control (PWM Technique)

12

32 Programmable I/O Lines

Three 16-Bit Timer/Counters

Eight vector two level Interrupt Sources

Programmable Serial Channel

Low Power Idle and Power Down Modes

In addition, the AT89C52 is designed with static logic for operation down to zero

frequency and supports two software selectable power saving modes.

The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial

port and interrupt system to continue functioning. The Power Down Mode saves

the RAM contents but freezes the oscillator disabling all other chip functions

until the next hardware reset.

Page 13: GSM Based DC Motor Control (PWM Technique)

13

Block Diagram of Microcontroller

Figure 5.1 Block Diagram of 8052

Page 14: GSM Based DC Motor Control (PWM Technique)

14

PIN CONFIGURATIONS

Figure Pin Diagram of 89C52

4.4. Pin Description

VCC

Pin 40 provides Supply voltage to the chip. The voltage source is +5v

GND.

Pin 20 is the grounded

Page 15: GSM Based DC Motor Control (PWM Technique)

15

Port 0

Port 0 is an 8-bit open drain bidirectional I/O port from pin 32 to 39. As an

output port each pin can sink eight TTL inputs. When 1s are written to port 0 pins,

the pins can be used as high-impedance inputs. Port 0 may also be configured to be

the multiplexed low-order address/data bus during accesses to external program and

data memory. In this mode P0 has internal pull-ups.

Port 0 also receives the code bytes during Flash programming, and outputs the

code bytes during program verification. External pull-ups are required during

program verification.

Port 1

Port 1 is an 8-bit bidirectional I/O port with internal pull-ups from pin 1 to 8.

The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to

Port 1 pins they are pulled high by the internal pull-ups and can be used as inputs.

As inputs, Port 1 pins that are externally being pulled low will source current (IIL)

because of the internal pull-ups. Port 1 also receives the low-order address bytes

during Flash programming and program verification.

Port 2

Port 2 is an 8-bit bidirectional I/O port with internal pull-ups from pin 21 to

28. The Port 2 output buffers can sink / source four TTL inputs. When 1s are written

Page 16: GSM Based DC Motor Control (PWM Technique)

16

to Port 2 pins they are pulled high by the internal pull-ups and can be used as inputs.

As inputs, Port 2 pins that are externally being pulled low will source current (IIL)

because of the internal pull-ups.

Port 2 emits the high-order address byte during fetches from external program

memory and during accesses to external data memories that use 16-bit addresses

(MOVX @ DPTR). In this application it uses strong internal pull-ups when emitting

1s. During accesses to external data memory that uses 8-bit addresses (MOVX @

RI), Port 2 emits the contents of the P2 Special Function Register. Port 2 also

receives the high-order address bits and some control signals during Flash

programming and verification.

Port 3

Port 3 is an 8-bit bidirectional I/O port with internal pull-ups from pin 10 to 17.

The Port 3 output buffers can sink / source four TTL inputs. When 1s are written to

Port 3 pins they are pulled high by the internal pull-ups and can be used as inputs.

As inputs, Port 3 pins that are externally being pulled low will source current (IIL)

because of the pull-ups.

Port 3 also serves the functions of various special features of the AT89C51 as

listed below:

Page 17: GSM Based DC Motor Control (PWM Technique)

17

Table Special Features of 89C52

Port 3 also receives some control signals for Flash programming and

programming verification.

RST

Pin 9 is the Reset input. It is active high. Upon applying a high pulse to this

pin, the microcontroller will reset and terminate all activities. A high on this pin for

two machine cycles while the oscillator is running resets the device.

ALE/PROG

Address Latch is an output pin and is active high. Address Latch Enable output

pulse for latching the low byte of the address during accesses to external memory.

This pin is also the program pulse input (PROG) during Flash programming. In

normal operation ALE is emitted at a constant rate of 1/6 the oscillator frequency,

and may be used for external timing or clocking purposes.

Page 18: GSM Based DC Motor Control (PWM Technique)

18

Note, however, that one ALE pulse is skipped during each access to external

Data Memory. If desired, ALE operation can be disabled by setting bit 0 of SFR

location 8EH. With the bit set, ALE is active only during a MOVX or MOVC

instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has

no effect if the microcontroller is in external execution mode.

PSEN

Program Store Enable is the read strobe to external program memory. When

the AT89C52 is executing code from external program memory, PSEN is activated

twice each machine cycle, except that two PSEN activations are skipped during each

access to external data memory.

EA/VPP

External Access Enable. EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally

latched on reset. EA should be strapped to VCC for internal program executions.

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming, for parts that require 12-volt VPP.

Page 19: GSM Based DC Motor Control (PWM Technique)

19

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit.

XTAL2

Output from the inverting oscillator amplifier.

Oscillator Characteristics

XTAL1 and XTAL2 are the input and output, respectively; of an inverting

amplifier which can be configured for use as an on chip oscillator, as shown in

Figure either a quartz crystal or ceramic resonator may be used. To drive the device

from an external clock source, XTAL2 should be left unconnected while XTAL1 is

driven as shown in Figure 5.4.

Figure: crystal connections

Page 20: GSM Based DC Motor Control (PWM Technique)

20

Figure: External Clock Drive Configuration

There are no requirements on the duty cycle of the external clock signal, since

the input to the internal clocking circuitry is through a divide-by two flip-flop, but

minimum and maximum voltage high and low time specifications must be observed.

TIMERS

Timer 0 and 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51.

Timer 2

Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an

event counter. The type of operation is selected by bit C/T2 in the SFR T2CON.

Timer 2 has three operating modes: capture, auto-reload (up or down counting), and

baud rate generator. The modes are selected by bits in T2CON, as shown in Table

Page 21: GSM Based DC Motor Control (PWM Technique)

21

5.2. Timer 2 consists of two 8-bit registers, TH2 and TL2. In the Timer function, the

TL2 register is incremented every machine cycle. Since a machine cycle consists of

12 oscillator periods, the count rate is 1/12 of the oscillator frequency.

Table Timer 2 Operating Modes

In the Counter function, the register is incremented in response to a 1-to-0

transition at its corresponding external input pin, T2. In this function, the external

input is sampled during S5P2 of every machine cycle. When the samples show a

high in one cycle and a low in the next cycle, the count is incremented. The new

count value appears in the register during S3P1 of the cycle following the one in

which the transition was detected. Since two machine cycles (24 oscillator periods)

are required to recognize a 1-to-0 transition, the maximum count rate is 1/24 of the

oscillator frequency. To ensure that a given level is sampled at least once before it

changes, the level should be held for at least one full machine cycle.

There are no restrictions on the duty cycle of external input signal, but it

should for at least one full machine to ensure that a given level is sampled at least

once before it changes

Page 22: GSM Based DC Motor Control (PWM Technique)

22

Interrupts:

The AT89C52 has a total of six interrupt vectors: two external interrupts

(INT0 and INT1), three timer interrupts (Timers 0, 1, and 2), and the serial port

interrupt. These interrupts are all shown in Figure 5.5

Figure Interrupts source

Each of these interrupt sources can be individually enabled or disabled by setting

or clearing a bit in Special Function Register IE. IE also contains a global disable

bit, EA, which disables all interrupts at once.

Note that Table 5.3 shows that bit position IE.6 is unimplemented. In the

AT89C51, bit position IE.5 is also unimplemented. User software should not write

1s to these bit positions, since they may be used in future AT89 products.

Page 23: GSM Based DC Motor Control (PWM Technique)

23

Table: Interrupts Enable Register

Timer 2 interrupt is generated by the logical OR of bits TF2 and EXF2 in

register T2CON. Neither of these flags is cleared by hardware when the service

routine is vectored

In fact, the service routine may have to determine whether it was TF2 or EXF2

that generated the interrupt, and that bit will have to be cleared in software.

The Timer 0 and Timer 1 flags, TF0 and TF1, are set at S5P2 of the cycle in

which the timers overflow. The values are then polled by the circuitry in the next

cycle. However, the Timer 2 flag, TF2, is set at S2P2 and is polled in the same

cycle in which the timer overflows.

Page 24: GSM Based DC Motor Control (PWM Technique)

24

Idle Mode:

In idle mode, the CPU puts itself to sleep while all the on-chip peripherals

remain active. The mode is invoked by software. The content of the on-chip RAM

and all the special functions registers remain unchanged during this mode. The idle

mode can be terminated by any enabled interrupt or by a hardware reset. It should be

noted that when idle is terminated by a hardware reset, the device normally resumes

program execution, from where it left off, up to two machine cycles before the

internal reset algorithm takes control.

On-chip hardware inhibits access to internal RAM in this event, but access to

the port pins is not inhibited. To eliminate the possibility of an unexpected write to a

port pin when Idle is terminated by reset, the instruction following the one that

invokes Idle should not be one that writes to a port pin or to external memory.

Power down Mode:

In the power down mode the oscillator is stopped, and the instruction that

invokes power down is the last instruction executed. The on-chip RAM and Special

Function Registers retain their values until the power down mode is terminated. The

only exit from power down is a hardware reset. Reset redefines the SFRs but does

not change the on-chip RAM. The reset should not be activated before VCC is

Page 25: GSM Based DC Motor Control (PWM Technique)

25

restored to its normal operating level and must be held active long enough to allow

the oscillator to restart and stabilize.

Table Status of External Pins during Idle and Power down Mode

Program Memory Lock Bits

On the chip are three lock bits which can be left unprogrammed (U) or can be

programmed (P) to obtain the additional features listed in the table 5.4. When lock

bit 1 is programmed, the logic level at the EA pin is sampled and latched during

reset. If the device is powered up without a reset, the latch initializes to a random

value, and holds that value until reset is activated. It is necessary that the latched

value of EA be in agreement with the current logic level at that pin in order for the

device to function properly.

Page 26: GSM Based DC Motor Control (PWM Technique)

26

Table 5.4 Lock Bit Protection Modes

Programming the Flash

The AT89C51 is normally shipped with the on-chip Flash memory array in

the erased state (that is, contents = FFH) and ready to be programmed. The

programming interface accepts either a high-voltage (12-volt) or a low-voltage

(VCC) program enable signal. The low voltage programming mode provides a

convenient way to program the AT89C51 inside the user’s system, while the high-

voltage programming mode is compatible with conventional third party Flash or

EPROM programmers.

The AT89C52 is shipped with either the high-voltage or low voltage

programming mode enabled. The respective top-side marking and device signature

codes are listed in the following table.

Page 27: GSM Based DC Motor Control (PWM Technique)

27

Top side Marking and Device Signature Codes

The AT89C52 code memory array is programmed byte-by-byte in either

programming mode. To program any non-blank byte in the on-chip Flash Memory,

the entire memory must be erased using the Chip Erase Mode.

Programming Algorithm

Before programming the AT89C52, the address, data and control signals should

be set up according to the Flash programming mode table and Figures 3 and 4. To

program the AT89C52, take the following steps.

1. Input the desired memory location on the address lines.

2. Input the appropriate data byte on the data lines.

3. Activate the correct combination of control signals.

4. Raise EA/VPP to 12 V for the high-voltage programming mode.

5. Pulse ALE/PROG once to program a byte in the Flash array or the lock bits. The

byte-write cycle is self-timed and typically takes no more than 1.5 Ms. Repeat steps

Page 28: GSM Based DC Motor Control (PWM Technique)

28

1 through 5, changing the address and data for the entire array or until the end of the

object file is reached.

Data Polling

The AT89C52 features Data Polling to indicate the end of a write cycle. During a

write cycle, an attempted read of the last byte written will result in the complement

of the written datum on PO.7. Once the write cycle has been completed, true data are

valid on all outputs, and the next cycle may begin. Data Polling may begin any time

after a write cycle has been initiated.

Ready/Busy

The progress of byte programming can also be monitored by the RDY/BSY

output signal. P3.4 is pulled low after ALE goes high during programming to

indicate BUSY. P3.4 is pulled high again when programming is done to indicate

READY.

Program Verify

If lock bits LB1 and LB2 have not been programmed, the programmed code

data can be read back via the address and data lines for verification. The lock bits

cannot be verified directly. Verification of the lock bits is achieved by observing that

their features are enabled.

Page 29: GSM Based DC Motor Control (PWM Technique)

29

Chip Erase

The entire Flash array is erased electrically by using the proper combination of

control signals and by holding ALE/PROG low for 10 ms. The code array is written

with all "1"s. The chip erase operation must be executed before the code memory

can be re-programmed.

Reading the Signature Bytes

The signature bytes are read by the same procedure as a normal verification of

locations 030H, 031H, and 032H, except that P3.6 and P3.7 must be pulled to a

Logic low. The values returned are as follows.

(030H) = 1EH indicates manufactured by Atmel

(031H) = 51H indicates 89C51

(032H) = FFH indicates 12 V programming

(032H) = 05H indicates 5 V programming

Programming Interface

Every code byte in the Flash array can be written and the entire array can be

erased by using the appropriate combination of control signals. The write operation

cycle is self-timed and once initiated, will automatically time itself to completion.

Page 30: GSM Based DC Motor Control (PWM Technique)

30

Table: Flash Programming Modes

5. PWM THE SOLUTION

PWM is a way of digitally encoding analog signal levels. Through the use of

high-resolution counters, the duty cycle of a square wave is modulated to encode a

specific analog signal level. The PWM signal is still digital because, at any given

instant of time, the full DC supply is either fully on or fully off. The voltage or

current source is supplied to the analog load by means of a repeating series of and

off pulse.

The on time is the time during which the DC supply is applied to the load and

the off time is the periods during which that supply is switched off. Given a

sufficient bandwidth, any analog value can be encoded with PWM.

Page 31: GSM Based DC Motor Control (PWM Technique)

31

Many micro controllers include PWM controllers. For example,

Microchip’s PIC16C67 includes two, each of which has a selectable on-time and

period.

The duty cycle is the ratio of the on-time to the period.

5.1. ADVANTAGES OF PWM:

PWM is economical, space saving. The signal remains

digital all the way from the processor to the controlled system. No digital-to –analog

conversion is necessary. By keeping the signal digital, noise immunity is yet another

benefit of choosing PWM over analog control and is the principal reason PWM is

sometimes used for communication.

5.2APPLICATIONS OF PWM:

PWM is employed in a wide variety of applications, ranging from

Measurement and communication to power control and conversion. As a concrete

example consider a PWM-controlled brake. To put it simply, a brake is a device that

clamps down hard on something in many brakes; the amount of clamping pressure is

controlled with an analog input signal. The more voltage or current that’s applied to

the brake, the more pressure the brake will exert. The output of a PWM controller

could be connected to a switch between the supply and the brake to produce more

stopping power, the software need only increase the duty cycle of the PWM output.

5.3. Serial communication between PC and microcontroller

When a processor communicates with the outside world, it provides data

in byte sized chunks. Computers transfer data in two ways: parallel and serial. In

parallel data transfers, often more lines are used to transfer data to a device and 8 bit

Page 32: GSM Based DC Motor Control (PWM Technique)

32

data path is expensive. The serial communication transfer uses only a single data line

instead of the 8 bit data line of parallel communication which makes the data

transfer not only cheaper but also makes it possible for two computers located in two

different cities to communicate over telephone.

Serial data communication uses two methods, asynchronous and

synchronous. The synchronous method transfers data at a time while the

asynchronous transfers a single byte at a time. There are some special IC chips made

by many manufacturers for data communications. These chips are commonly

referred to as UART (universal asynchronous receiver-transmitter) and USART

(universal synchronous asynchronous receiver transmitter). The AT89C51 chip has a

built in UART.

In asynchronous method, each character is placed between start and stop bits.

This is called framing. In data framing of asynchronous communications, the data,

such as ASCII characters, are packed in between a start and stop bit. We have a total

of 10 bits for a character: 8 bits for the ASCII code and 1 bit each for the start and

stop bits. The rate of serial data transfer communication is stated in bps or it can be

called as baud rate.

To allow the compatibility among data communication equipment made by

various manufacturers, and interfacing standard called RS232 was set by the

Electronics industries Association in 1960. Today RS232 is the most widely used

I/O interfacing standard. This standard is used in PCs and numerous types of

equipment. However, since the standard was set long before the advent of the TTL

logic family, its input and output voltage levels are not TTL compatible. In RS232, a

1 bit is represented by -3 to -25V, while a 0 bit is represented +3 to +25 V, making -

3 to +3 undefined. For this reason, to connect any RS232 to a microcontroller system

we must use voltage converters such as MAX232 to connect the TTL logic levels to

Page 33: GSM Based DC Motor Control (PWM Technique)

33

RS232 voltage levels and vice versa. MAX232 ICs are commonly referred to as line

drivers.

The RS232 cables are generally referred to as DB-9 connector. In

labeling, DB-9P refers to the plug connector (male) and DB-9S is for the socket

connector (female). The simplest connection between a PC and microcontroller

requires a minimum of three pin, TXD, RXD, and ground. Many of the pins of the

RS232 connector are used for handshaking signals. They are bypassed since they are

not supported by the 8051 UART chip.

IBM PC/ compatible computers based on x86(8086, 80286, 386, 486

and Pentium) microprocessors normally have two COM ports. Both COM ports have

RS232 type connectors. Many PCs use one each of the DB-25 and DB-9 RS232

connectors. The COM ports are designated as COM1 and COM2. We can connect

the serial port to the COM 2 port of a PC for serial communication experiments. We

use a DB9 connector in our arrangement.

The AT89C52 has two pins that are used specifically for transferring

and receiving data serially. These two pins are called TXD and RXD and are part of

the port3 (P3.0 and P3.1). These pins are TTL compatible; therefore they require a

Page 34: GSM Based DC Motor Control (PWM Technique)

34

line driver to make them RS232 compatible. One such line driver is the MAX232

chip. One advantage of MAX232 chip is that it uses a +5v power source which is the

same as the source voltage for the at89c51. The MAX232 has two sets of line drivers

for receiving and transferring data. The line drivers for TXD are called T1 and T2

while the line drivers for RXD are designated as R1 and R2. T1 and R1 are used for

TXD and RXD of the 89c51 and the second set is left unused. In MAX232 that the

TI line driver has a designation of T1 in and T1 out on pin numbers 11 and 14,

respectively. The T1 in pin is the TTL side and is connected to TXD of the

microcontroller, while TI out is the RS232 side that is connected to the RXD pin of

the DB9 connector.

To allow data transfer between PC and the microcontroller system

without any error, we must make sure that the baud rate of the 8051 system matches

the baud rate of the PC’s COM port.

6. ULN DC MOTOR DRIVER

ULN is mainly suited for interfacing between low-level circuits

and multiple peripheral power loads, The series ULN20XX high voltage, high

current Darlington arrays feature continuous load current ratings. The driving

circuitry in- turn decodes the coding and conveys the necessary data to the stepper

motor, this module aids in the movement of the arm through steppers.

Page 35: GSM Based DC Motor Control (PWM Technique)

35

The driver makes use of the ULN2003 driver IC, which contains an

array of 7 power Darlington arrays, each capable of driving 500mA of current. At

an approximate duty cycle, depending on ambient temperature and number of

drivers turned on, simultaneously typical power loads totaling over 230w can be

controlled.

The device has base resistors, allowing direct connection to any

common logic family. All the emitters are tied together and brought out to a

separate terminal. Output protection diodes are included; hence the device can

drive inductive loads with minimum extra components. Typical loads include

Page 36: GSM Based DC Motor Control (PWM Technique)

36

relays, solenoids, stepper motors, magnetic print hammers, multiplexed LED,

incandescent displays and heaters.

6.1. The main features of ULN2003 are as follows:

Seven Darlington per package

Output current 500ma per driver (600ma peak)

Output voltage 50v

Integrated suppression diodes for inductive loads

Outputs can be paralleled for high current TTL/CMOS/DTL compatible inputs

Inputs pinned opposite outputs to simplify layout.

Transient protected outputs

Dual In-Line plastic package or small-Outline IC package.

7. DC MOTOR

DC motors are configured in many types and sizes, including brush less, servo,

and gear motor types. A motor consists of a rotor and a permanent magnetic field

stator. The magnetic field is maintained using either permanent magnets or

electromagnetic windings. DC motors are most commonly used in variable speed

and torque.

Motion and controls cover a wide range of components that in

some way are used to generate and/or control motion. Areas within this category

include bearings and bushings, clutches and brakes, controls and drives, drive

components, encoders and resolves, Integrated motion control, limit switches,

linear actuators, linear and rotary motion components, linear position sensing,

motors (both AC and DC motors), orientation position sensing, pneumatics and

pneumatic components, positioning stages, slides and guides, power transmission

Page 37: GSM Based DC Motor Control (PWM Technique)

37

(mechanical), seals, slip rings, solenoids, springs.

Motors are the devices that provide the actual speed and torque in a

drive system. This family includes AC motor types (single and multiphase motors,

universal, servo motors, induction, synchronous, and gear motor) and DC motors

(brush less, servo motor, and gear motor) as well as linear, stepper and air motors,

and motor contactors and starters.

In any electric motor, operation is based on simple

electromagnetism. A current-carrying conductor generates a magnetic field; when

this is then placed in an external magnetic field, it will experience a force

proportional to the current in the conductor, and to the strength of the external

magnetic field. As you are well aware of from playing with magnets as a kid,

opposite (North and South) polarities attract, while like polarities (North and

North, South and South) repel. The internal configuration of a DC motor is

designed to harness the magnetic interaction between a current-carrying conductor

and an external magnetic field to generate rotational motion.

Let's start by looking at a simple 2-pole DC electric motor (here red

represents a magnet or winding with a "North" polarization, while green represents

a magnet or winding with a "South" polarization).

Every DC motor has six basic parts -- axle, rotor (a.k.a., armature), stator,

commutator, field magnet(s), and brushes. In most common DC motors (and all

Page 38: GSM Based DC Motor Control (PWM Technique)

38

that Beamers will see), the external magnetic field is produced by high-strength

permanent magnets1. The stator is the stationary part of the motor -- this includes

the motor casing, as well as two or more permanent magnet pole pieces. The rotor

(together with the axle and attached commutator) rotates with respect to the stator.

The rotor consists of windings (generally on a core), the windings being

electrically connected to the commutator. The above diagram shows a common

motor layout -- with the rotor inside the stator (field) magnets.

The geometry of the brushes, commutator contacts, and rotor

windings are such that when power is applied, the polarities of the energized

winding and the stator magnet(s) are misaligned, and the rotor will rotate until it is

almost aligned with the stator's field magnets. As the rotor reaches alignment, the

brushes move to the next commutator contacts, and energize the next winding.

Given our example two-pole motor, the rotation reverses the direction of current

through the rotor winding, leading to a "flip" of the rotor's magnetic field, and

driving it to continue rotating.

In real life, though, DC motors will always have more than two poles

(three is a very common number). In particular, this avoids "dead spots" in the

commutator. You can imagine how with our example two-pole motor, if the rotor

is exactly at the middle of its rotation (perfectly aligned with the field magnets), it

will get "stuck" there. Meanwhile, with a two-pole motor, there is a moment where

the commutator shorts out the power supply (i.e., both brushes touch both

commutator contacts simultaneously). This would be bad for the power supply,

waste energy, and damage motor components as well. Yet another disadvantage of

such a simple motor is that it would exhibit a high amount of torque” ripple" (the

amount of torque it could produce is cyclic with the position of the rotor).

Page 39: GSM Based DC Motor Control (PWM Technique)

39

So since most small DC motors are of a three-pole design, let's tinker with the

workings of one via an interactive animation (JavaScript required):

You'll notice a few things from this -- namely, one pole is fully energized at a time

(but two others are "partially" energized). As each brush transitions from one

commutator contact to the next, one coil's field will rapidly collapse, as the next

coil's field will rapidly charge up (this occurs within a few microsecond). We'll see

more about the effects of this later, but in the meantime you can see that this is a

direct result of the coil windings' series wiring:

Page 40: GSM Based DC Motor Control (PWM Technique)

40

There's probably no better way to see how an average dc motor is put together,

than by just opening one up. Unfortunately this is tedious work, as well as

requiring the destruction of a perfectly good motor.

This is a basic 3-pole dc motor, with 2 brushes and three commutator contacts.

8. POWER SUPPLY

There are many types of power supply. Most are designed to convert high

voltage AC mains electricity to a suitable low voltage supply for electronics circuits

and other devices. A power supply can by broken down into a series of blocks, each

of which performs a particular function.

For example a 5V regulated supply can be shown as below

Fig 3.10: Block Diagram of a Regulated Power Supply System

Page 41: GSM Based DC Motor Control (PWM Technique)

41

Similarly, 12v regulated supply can also be produced by suitable selection of

the individual elements. Each of the blocks is described in detail below and the

power supplies made from these blocks are described below with a circuit diagram

and a graph of their output:

8.1. Transformer:

A transformer steps down high voltage AC mains to low voltage AC. Here we

are using a center-tap transformer whose output will be sinusoidal with 36volts peak

to peak value.

Fig: 3.10.2 Output Waveform of transformer

The low voltage AC output is suitable for lamps, heaters and special AC

motors. It is not suitable for electronic circuits unless they include a rectifier and a

smoothing capacitor. The transformer output is given to the rectifier circuit.

8.2. Rectifier:

A rectifier converts AC to DC, but the DC output is varying. There are several

types of rectifiers; here we use a bridge rectifier.

The Bridge rectifier is a circuit, which converts an ac voltage to dc

voltage using both half cycles of the input ac voltage. The Bridge rectifier circuit is

shown in the figure. The circuit has four diodes connected to form a bridge. The ac

Page 42: GSM Based DC Motor Control (PWM Technique)

42

input voltage is applied to the diagonally opposite ends of the bridge. The load

resistance is connected between the other two ends of the bridge.

For the positive half cycle of the input ac voltage, diodes D1 and D3 conduct,

whereas diodes D2 and D4 remain in the OFF state. The conducting diodes will be

in series with the load resistance RL and hence the load current flows through RL.

For the negative half cycle of the input ac voltage, diodes D2 and D4

conduct whereas, D1 and D3 remain OFF. The conducting diodes D2 and D4 will be

in series with the load resistance RL and hence the current flows through RL in the

same direction as in the previous half cycle. Thus a bi-directional wave is converted

into unidirectional.

FIG: The output waveform of the rectifier is shown as below

Page 43: GSM Based DC Motor Control (PWM Technique)

43

The varying DC output is suitable for lamps, heaters and standard motors. It is

not suitable for electronic circuits unless they include a smoothing capacitor.

8.3. Smoothing:

The smoothing block smoothes the DC from varying greatly to a small

ripple. The ripple voltage is defined as the deviation of the load voltage from its DC

value. Smoothing is also named as filtering.

Filtering is frequently effected by shunting the load with a capacitor. The

action of this system depends on the fact that the capacitor stores energy during the

conduction period and delivers this energy to the loads during the no conducting

period. In this way, the time during which the current passes through the load is

prolong Ted, and the ripple is considerably decreased. The action of the capacitor is

shown with the help of waveform.

Fig 3.10.4.1The waveform of the rectified output after smoothing is given below:

Page 44: GSM Based DC Motor Control (PWM Technique)

44

8.4. Regulator:

Regulator eliminates ripple by setting DC output to a fixed voltage. Voltage

regulator ICs are available with fixed (typically 5, 12 and 15V) or variable output

voltages. Negative voltage regulators are also available

Many of the fixed voltage regulator ICs has 3 leads (input, output and high

impedance). They include a hole for attaching a heat sink if necessary. Zener diode

is an example of fixed regulator which is shown here.

3.10.1 REGULATOR

Page 45: GSM Based DC Motor Control (PWM Technique)

45

Transformer + Rectifier + Smoothing + Regulator:

9. HT9170B-- DTMF RECIEVER

The HT9170B/D are Dual Tone Multi Frequency (DTMF) receivers integrated

with digital decoder and band split filter functions as well as power-down mode and

inhibit mode operations. Such devices use digital counting techniques to detect and

decode all the 16 DTMF tone pairs into a 4-bit code output.

Highly accurate switched capacitor filters are implemented to divide tone signals

into low and high group signals. A built-in dial tone rejection circuit is provided to

eliminate the need for pre-filtering.

9.1. FEAUTURES:

Operating voltage: 2.5V~5.5V

Minimal external components

No external filter is required

Low standby current (on power down mode)

Excellent performance

Tristate data output for MCU interface

Page 46: GSM Based DC Motor Control (PWM Technique)

46

3.58MHz crystal or ceramic resonator

1633Hz can be inhibited by the INH pin

HT9170B: 18-pin DIP package

Page 47: GSM Based DC Motor Control (PWM Technique)

47

PIN ASSIGMENT:

PIN DESCRIPTION:

Page 48: GSM Based DC Motor Control (PWM Technique)

48

BLOCK DIAGRAM:

9.2. FUNCTIONAL DESCRIPTION:

The HT9170B/D tone decoders consist of three band pass filters and two

digital decode circuits to convert a tone (DTMF) signal into digital code output.

An operational amplifier is built-in to adjust the input signal. The pre-filter is a band

rejection filter, which reduces the dialing tone from 350Hz to 400Hz.

The low group filter filters low group frequency signal output whereas the high

group filter filters high group Frequency signal output. A zero-crossing detector with

follows each filters output hysteretic. When each signal amplitude at the output

exceeds the specified level, it is transferred to full swing logic signal.

Page 49: GSM Based DC Motor Control (PWM Technique)

49

When input signals are recognized to be effective, DV becomes high, and the correct

tone code (DTMF) digit is transferred.

Steering control circuit:

The steering control circuit is used for measuring the effective signal duration

and for protecting against drop out of valid signals. It employs the analog delay by

external RC time-constant controlled by EST.

The EST pin is normally low and draws the RT/GT pin to keep low through

discharge of external RC. When a valid tone input is detected, EST goes high to

charge RT/GT through RC.

When the voltage of RT/GT changes from 0 to VTRT (2.35V for 5V supply), the

input signal is effective, and the code detector will create the correct code. After

D0~D3 are completely latched, DV output becomes high. When the voltage of

RT/GT falls down from VDD to VTRT (i.e. when there is no input tone), DV output

becomes Low, and D0~D3 keeps data until a next valid tone input is produced. By

selecting adequate external RC value, the minimum acceptable input tone duration

(TACC) and the minimum acceptable inter-tone rejection (ITR) can be set. External

Components (R, C) are chosen by the formula.

TACC=TDP+TGTP;

ITR=TDP+TGTP;

Where tACC: Tone duration acceptable time

TDP: EST output delay time (_L__H_)

TGTP: Tone present time

TIR: Inter-digit pause rejection time

Page 50: GSM Based DC Motor Control (PWM Technique)

50

TDA: EST output delay time (_H__L_)

TGTA: Tone absent time

TIMING DIAGRAM

Page 51: GSM Based DC Motor Control (PWM Technique)

51

PIN DIAGRAMOF 8870:

Applications:

PABX

Central office

Mobile radio

Remote control

Remote data entry

Call limiting

Telephone answering systems

Page 52: GSM Based DC Motor Control (PWM Technique)

52

10. PROJECT CODE

*PROGRAM FOR PC BASED AC MOTOR SPEED CONTROL */

#include<reg52.h>

void delay(unsigned int val);

sbit mt=P1^1; //input dc motor

unsigned char z;

void main()

{

void delay(unsigned int val)

{

unsigned int x,y;

for(x=0;x<val;x++)

for(y=0;y<1275;y++);

}

while(1)

{

switch(P2)

{

case (0X31):

Page 53: GSM Based DC Motor Control (PWM Technique)

53

{

mt=1;

delay(10);

mt=0;

delay(90);

break;

}

case (0X32):

{

mt=1;

delay(20);

mt=0;

delay(80);

break;

}

case (0X33):

{

mt=1;

delay(30);

Page 54: GSM Based DC Motor Control (PWM Technique)

54

mt=0;

delay(70);

break;

}

case (0X35):

{

mt=0;

delay(0);

mt=1;

delay(100);

break;

}

case (0X39):

{

mt=0;

delay(100);

mt=1;

delay(0);

Page 55: GSM Based DC Motor Control (PWM Technique)

55

break;

}

default:

{

mt=0;

}

while(1)

{

if(sw==1)

{

mt=1;

delay(50);

mt=0;

delay(50);

}

else

{

P1=0;

mt=0;

Page 56: GSM Based DC Motor Control (PWM Technique)

56

delay(20);

mt=1;

delay(80);

}

}

11. CONCLUSION

The speed control of DC Motor has been achieved successfully using

microcontroller unit. The circuit has been tested and verified.

We used DC MOTOR control to achieve various speed of the Motor, for this

fixed numbering is programmed by using the microcontroller. And the program has

been successfully tested and verified for several specified loads.

We can obtain various speed using this program and circuitry.

12. BIBILIOGRAPHY

1. The 8051 Microcontroller Architecture, Programming & Applications

…… Kenneth J Ayala

Page 57: GSM Based DC Motor Control (PWM Technique)

57

2. The 8051 Microcontroller & Embedded Systems

…… Mohammed Ali Mazidi &

Janice Gillispie Mazidi

3. Power Electronics

……. M D Singh &

K B Khanchandani

4. Linear Integrated Circuits

i. ……. D Roy Choudary & Shail Jain

5. Electrical Machines

i. …….. S K Bhattacharya

6. Electrical Machines II

i. …….. B L Thereja

13. REFERENCES

1. WWW.ELECTRONICS4U.COM

Page 58: GSM Based DC Motor Control (PWM Technique)

58

2. WWW.AARONCAKE.NET

3. WWW.MAZIDI.COM

4. WWW.8051PROJECTS.COM