You are on page 1of 24

Abstract

In this project, focuses on a low cost DC motor speed control system using a microcontroller logic PWM controller to control brushless DC Motor. In a digital controller of brushless DC Motor, the control accuracy is of a high level, and it has a fast response time. Here a microcontroller of 8-bit type (80CL580) will be used as the system's core controller in other to acquire an accurate logic control algorithm. The DC motor speed control has found vast application in the day to day application of modern day engineering

Page

Acknowledgement

On the submission of our project "Speed control with soft start soft stopping", 1 Introduction

we would like to extend our gratitude and thanks to our supervisor Dr. Ahmad Ababna for his motivation and support during our work in this semester.

We thank him for all needed information that helped us designing a successful project.

We extend our sincere thanks to all engineers who helped us to complete the project.

At last but not least, we would like to thank the staff of electrical engineering department for thier constant support and providing place to work during project period.

Index:

Page

1.1 1.2 1.3 2 2.1 2.2 3 3.1 3.2 3.3 3.4 3.5 3.6 4 5 5.1 6 6.1 6.2 7 7.1 7.2

Automation Project concerns Conveyer belt setup Systems control Types of controlling systems Benefits of speed control DC motors Construction Principle of operation DC motors classifications DC motor speed control Advantages of DC motor Controlling DC motors DC speed control with soft starting and soft stopping Pulse width modulation Advantages of PWM PIC 16f877A More about PIC 16f877A features Programming in C language The technical side

Speed control of a conveyor belt (With soft starting and soft stopping)

1. Introduction:

Page

The circuit

The code

1.1 Automation : Nowadays trends are to automate processes due to its major role in saving time money and efforts. Modern industrial world demands ever-increasing standards of safety, quality, productivity and cost effectiveness, also reduction the number of labors working in the factory, so the need of automation increases a day after a day. Automation is any system that works by itself without human intervention to optimize productivity in the production of goods and delivery of services. Automation is also needed due to the increased demand for flexibility and convertibility in manufacturing processes. Manufacturers are increasingly demanding the ability to easily switch from manufacturing Product A to manufacturing Product B without having to completely rebuild the production lines.

1.2 Project concerns: Our project aims to have an automatic-speed control for a conveyor belt, which has a wide range of applications especially in factories. It is known that conveyor belts are loops of material that move parts or other items from one location to another. Controlling the speed of the conveyor is very important issue, because if a particular belt moves too slowly, workers may find themselves waiting for parts. And if it was moving too quickly, parts may be damaged or thrown down, or workers may become overwhelmed. Our work will mainly concentrate on building a controlling circuit. That can automatically control the speed o f a conveyor belt (driven by a DC motor) .

This circuit will make it's own decisions via a microcontroller (PIc16f877A); according to the state of the conveyor, described by the amount or the number of the items held on it measured per a specific period of time.

1.3 Conveyor belt setup:

Page

Our project uses a DC motor to move the conveyor, so our concern will be on how to control the speed of the DC motor. The purpose of motor speed controller is to take signal representing the required speed and to drive a motor at that speed.

Fig.1 Conveyor belt 1

systems control:

Control can be defined as the operation of controlling the state of a given systems at a required level or point. System is said to be controlled when its components are connected and functioned in such manner as to regulate its self or other system i.e. it's designed and structured to achieve a desired purpose.
Page

2.1 types of controlling systems:

Open loop system: system in which the output quantity has no effect on input quantities. An open loop control system is simple, has a low cost, reliable but it can be incorrect because there is no correction system. Closed loop system: system in which the output has an effect upon the input quantity, where the variable to be controlled is measured, then the measured value is compared with the desired value to determined the difference (error). The difference is used to adjust the controlled value to reduce the error, in other words in closed loop control system the controlled variable (output or response) is fed back and compared with the reference input and the actuating signal proportional to the difference of the input and output must be sent through the system to correct the error. 2.2 Benefits of speed control: 1- It helps in the process of faulted items rejection. 2-saving power, when extra speed is not needed or when having soft starting, such that no huge current is allowed. 3-important for packing processes. Our project uses a DC motor to move the conveyor, so our concern will be on how to control the speed of the DC motor, the purpose of motor speed controller is to take signal representing the required speed and to drive a motor at that speed.

DC motors: Almost every mechanical movement we see is accomplished by an electrical motor whether its DC motor or AC motor. Motors consumes electrical energy to produce mechanical energy.

3.1 Constructions: DC motors consist of armature windings and stator, both are set of coils, applying voltage to the coils produces torque which result in motion.

Page

-Stator: stator is the outside part of the motor -Rotor: the rotor is the inner rotating part. it consist of windings (armature windings). Stator and rotor are made of ferromagnetic materials separated by the air gap. -Windings: windings usually made of copper, there are two types of windings armature windings and field windings. Armature winding is where the voltage is applied and the field winding is which the current passes through it.

3.2 Principle of operation:

When the current passes through the coils that wound the rotor, a magnetic field and torque induces. At different positions of the moving conductors the flux changes which causes an EMF. A schematic diagram for a DC motor is shown down. A DC motor has two circuits: field and armature circuit. The input is electrical and the output is mechanical.

Fig.2 equivalent circuit of DC motor

Nomenclature: Vf: DC voltage supply

Page

Rf: resistance of the field windings Lf: inductance of the field windings If: current produced in the field windings from the magnatic field Vt: voltage applied across the motor terminals Ia: current flowing in the armature circuit Ra: resistance of the armature winding Eb: total voltage induced in the armature.

3.3 DC motors classifications: DC motors can be classified into two classifications according to their electrical connection of the field and armature windings 1- Separately excited motor: separately excited means that the armature and the field are electrically separated, and the field winding is excited by a separated DC source as shown below.

2- Self excited motor: in Self excited machines the DC source is connected directly to the main terminals. there are 3 types of self excited motors : shunt, series and compound.

3.4 DC motor speed control: The speed of DC motors is easy to vary compared with AC motors. it can be varied by varying any of the following:

Page

1- Armature terminal voltage. 2- Armature resistance. 3- Field flux.

3.5 Advantages of DC motor: 1- Speed control over a wide range speed for both above and below the rated speeds. This is one of the main applications in which dc motors are widely used in fine speed applications. 2-High starting torque: dc series motors are termed as best suited drives for electrical traction applications used for driving heavy loads in starting conditions. DC series motors will have a staring torque as high as 500% compared to normal operating torque. . 3-Accurate speed with constant torque: Constant torque drives is one such the drives will have constant motor shaft torque over a given speed range. In such drives shaft power varies with speed. 4-Quick starting, stopping, reversing and acceleration 5-Free from harmonics, reactive power consumption and many factors which makes dc motors more advantageous compared to AC induction motors. In addition, the speed control units that provide the best performance with AC motors are those that electronically control both the frequency and voltage supplied to the motor which are more complicated than those used in DC motors, like the external resistance or a simple drive with pulse width modulation generator. - Advantages of DC motor over AC motor: In Industries 70% of the motors and drives used are Induction motors (AC motors). Induction motors were preferred in industries due to the advantages of its rugged construction, less maintenance and can be operated in explosive atmospheres. But DC motors were still used in certain applications where induction motors cannot fulfill the need and they have a lot of practical applications and many advantages over the AC motors especially in the speed control that we are mostly interested in.

3.6 controlling DC motors: In general the speed of a DC motor can be controlled with a less complicated control unit than the unit required for an AC motor. For example DC motor can

Page

control speed even with load but AC motor can't, also DC motors provide excellent speed control for acceleration.

DC motor speed control with soft starting and soft stopping:

Speed control of a DC motor can be done by simply controlling the input voltage to the motor, hence the speed of the DC motor is directly proportional to the input voltage, for example if we a have a motor operates at its rated speed at 12 volts, it will rotate at the half of its rated speed if the voltage reduced to 6 volts. Many techniques where developed to have the desired level of speed control, but nowadays all techniques trend to have automatically controlled. One point that must be taken into consideration The time that it takes a motor to speed up and slow down under switching conditions it dependants on the inertia of the rotor, and how much friction and load torque there is. Soft starting The reason of using soft starting a motor is to reduce the mechanical and electrical stress, it also provides current limiting control for smoother accelerations. For conveyor belts, soft starting can avoid pressure surges. For example; conveyor belt systems can be smoothly started, avoiding jerk and stress on drive components. Systems with belt drives can be started slowly to avoid belt slipping. In all systems, a soft start limits the inrush current and so improves stability of the power supply and reduces transient voltage drops that may affect other loads. On the other hand, soft stopping which is the opposite of soft starting, the voltage is gradually reduced, reducing the torque capacity of the motor. The reduction of available torque causes the motor to begin to stall when the shaft torque of the motor is less than the torque that is required by the load. Its effectively extends the stopping or breaking time of the motor. Hard stopping or sudden stopping of the motor that moves the conveyor belt may cause falling the items on the belt, also a lot of energy will be lost due to friction, producing huge amount of heat, which may increase the temperature of the motor and the surrounding devices to forbidden limits. Sometimes it is desirable to stop a DC motor quickly. This may be necessary in case of emergency or to save time, this is called motor electrical breaking, if the motor is being used for frequently repeated operations. The motor and its load may be brought to rest by using either:
Page

10

(a) Mechanical (friction) braking. (b) Electric braking. In mechanical braking, the motor is stopped due to the friction between the moving parts of the motor. Kinetic energy of the motor is dissipated as heat. Mechanical braking has several disadvantages including non-smooth stop and greater stopping time. All of the above speed control terms and features must be controlled by an appropriate method, that a good degree of accuracy. In this project, we use the Pulse Width Modulation (PWM) technique with PIC that can be an excellent solution to do.

Pulse Width Modulation (PWM):

Today, PWM technique has been used in wide applications, such as voltage control, current control, motor control, power control, UPS, and inverters. Definition of PWM: A technique that uses a digital circuit to create a variable analog signal, by simply opening and closing a switch at different or similar Pulse width depending on the application. It's mainly used to allow the control of the power supplied to electrical devices. PWM applies similar ideas of sampling processes, because it refers to the concept of rapidly pulsing the digital signal of a wire to simulate a varying voltage on the wire. It controls the portion of the input signal that can appear in the output side according to the duty time. (For example the average DC value of an input signal can be varied by varying the duty cycle). The term duty cycle describes the proportion of 'on' time to the regular interval or 'period' of time; a low duty cycle corresponds to low power, because the power is off for most of the time. Duty cycle is expressed in percent, 100% being fully on.
Page

Duty cycle: D= ton / T ; Where T: period time of the signal.

Figure below shows an example of the output of PWM , the first waveform shows zero duty cycle , that means the output is zero volt.

11

the following 3 waveforms shows a portion of 25% , 50% 75% of the full wave respectively , each case the outpu will be high or ON accordind to the given duty cycle , and low (off) for the rest of the pulse time period (T). the last one shows the 100% wave , that gives us a dc signal of 5 volts, here the off time is equal to zero.

Fig.3 output of PWM for different duty cycles

5.1. Advantages of PWM: 1- Simple to implement, requires only that fast response to be switched on and off enough rapidly.

Page

12

2- Power loss in the switching devices is very low. When a switch is off there is practically no current, and when it is on, there is almost no voltage drop across the switch. 3- Efficiency up to 90% The application of the PWM that will be implemented in this project is voltage regulation or voltage control. The output after the PWM process will be an input to a DC motor. PWM specifies a certain level of voltage by controlling the corresponding duty cycle; for example , if its desired to have the full voltage ( full signal) the duty cycle should be used is 100% , an 50% for the half of the full input signal and so on.

Many microcontrollers can be used to generate the PWM signals, in our project we would use PIC 16f877A.

PIC16f877A:

PIC 16f877a is one of the famous chips produced by Micro Chip Company. We would use it in our project due to many advantages it has. But first let us know, what is a microcontroller, a microcontroller is an integrated chip a processor core, memory, and programmable input/output peripherals, which is used to create a multi-function computer or device and to handle various tasks. It functions like a tiny, dedicated computer. Microcontrollers are designed for embedded applications. PIC is denoted for Programmable intelligent computer, it is made by Microchip Technology, and it is popular by industry developers and hobbyists, and dedicated for controlling applications. The main use of the PIC in our project is to control the motor speed by controlling its input voltage, and as mentioned earlier, the method to do that is PWM.

Page

13

Fig. 4 Pin diagram of PIC16f877A

We've chosen PIC16f788A because of its various properties and advantages: 1- Low power consumption. 2- RISC architecture. 3- Inexpensive microcontrollers. 4- Easy programming language, with relatively small instruction set to learn. 5- Its low cost, high clock speed. 6- Performing the PWM effectively.

6.1. More about PIC 16f788a features: PIC's are most likely Reduced Instruction Set Computer (RISC), they have different speeds and different ranges of working frequencies, Generally PIC have two patterns:

Page

14

1- Harvard Architecture: used mostly in RISC CPUs separate program bus and data bus, can be different widths for example, PICs use data memory (RAM):a small number of 8bit-registers,program memory (ROM):12bit, 14bit or 16bit

2- Von-Neumann Architecture: used in 80x86(PCs),8051, 68HC11,only one bus between CPU and memory. RAM and program memory share the same bus and the same memory and so must have the same bit width.

PICs have two different types of program storage: 1- EPROM (Erasable Programmable Read Only Memory) Needs high voltage from a programmer to program Needs windowed chips and UV light to erase Note: One Time Programmable (OTP) chips are EPROM, chips, but with no window! 2- FLASH: Re-writable Much faster to develop on! Finite number of writes (~100k Writes) PIC16f788a is an example of this type.

6.2. Programming in C language: Microchip provides the free MPLAB that is based on the assembly language, it is also provides the c compiler which could be basic or c-based.

Page

15

common peripherals are: Tri-state (floatable) digital I/O pins, Analog to Digital Converters (ADC) Serial communications: (RS-232C), Pulse Width Modulation (PWM) , Timers and counters , Watchdog timers, Brown out detect, LCD drivers.

Although c is not more efficient than assembly, but it's widely used in programming (especially by students), because it is easier to deal with. The program that debugs the c program is called "compiler " ,the compiler converts the high level language to machine instructions. Generally we can summarize the most important advantages of c-language: 1) Easy to understand. 2) Freedom of using different type of data. 3) Short listed words could be use. 4) Efficient and fast programming. 5) Flexible and versatile, allowing maximum control with minimal commands

Finally it's good to mention that is the computer language, C, is the basic language of all advanced computer languages. For example, if you want to learn C++, you need to know the C language well beforehand. Once you master C programming, you can easily learn another specified language.

The technical side:

As mentioned before, this project shows an application of automation using the PWM produced by the microcontroller. First we brought a ready conveyor belt. And connected dc motor (12 V) to move it. We measured the speeds at various voltages to make sure that the speed and the torque are suitable for our main purpose.

Then we started to write the code, and build the control circuit.
Page

7.1 The code: #include <16f877a.h> #fuses

16

XT,NOPUT,NOWDT,NOPROTECT,NOBROWNOUT,NOdEBUG,NOLVP #use delay(clock=4000000) unsigned INT16 DD=0,numofpakages; INT8 x,flag; void start(){ set_pwm1_duty(0); delay_ms(50); set_pwm1_duty(DD/10); delay_ms(50); set_pwm1_duty(DD*2/10); delay_ms(50); set_pwm1_duty(DD*3/10); delay_ms(50); set_pwm1_duty(DD*4/10); delay_ms(50); set_pwm1_duty(DD*5/10); delay_ms(50); set_pwm1_duty(DD*6/10); delay_ms(50); set_pwm1_duty(DD*7/10); delay_ms(50); set_pwm1_duty(DD*8/10); delay_ms(50); set_pwm1_duty(DD*9/10); delay_ms(50); set_pwm1_duty(DD); } void stop(){ set_pwm1_duty(DD*9/10); delay_ms(50); set_pwm1_duty(DD*8/10); delay_ms(50); set_pwm1_duty(DD*7/10); delay_ms(50); set_pwm1_duty(DD*6/10); delay_ms(50); set_pwm1_duty(DD*5/10); delay_ms(50); set_pwm1_duty(DD*4/10); delay_ms(50); set_pwm1_duty(DD*3/10); delay_ms(50); set_pwm1_duty(DD*2/10); delay_ms(50); set_pwm1_duty(DD/10); delay_ms(50); set_pwm1_duty(0); }

Page

17

#int_timer1 void isrext() { x++; if(x==9){ numofpakages=get_timer0(); if(numofpakages>0 && numofpakages<5 ){DD=128;if(flag==0)start();else set_pwm1_duty(DD);flag=1;} if(numofpakages>=5 && numofpakages<10 ){DD=256;if(flag==0)start();else set_pwm1_duty(DD);flag=2;} if(numofpakages>=10 && numofpakages<15 ){DD=384;if(flag==0)start();else set_pwm1_duty(DD);flag=3;} if(numofpakages>=15 ){DD=512;if(flag==0)start();else set_pwm1_duty(DD);flag=4;} if(numofpakages==0){stop();flag=0;} x=0; set_timer0(0); } set_timer1(0); } void main() { Enable_interrupts(int_timer1); enable_interrupts(global); setup_timer_0(RTCC_DIV_1|RTCC_EXT_H_TO_L); setup_timer_1 (T1_INTERNAL | T1_DIV_BY_8); setup_ccp1(ccp_pwm); setup_timer_2(T2_DIV_BY_4, 127, 1); set_timer0(0); // init timer0 to 0 set_timer1(0); stop(); flag=0; LOOP: GOTO LOOP; }

7.2 The circuit:

Page

18

The circuit is simple, containing the PIC 16f877A, which is the brain of the circuit, it decides the appropriate speed, and controls the process of the soft starting and stopping. The Transistor BDX53, which is a power transistor, we chose it to work in this place as a switch, because it can handle a relatively high current, which the case that we have, referred to our measurements, the motor takes about 3.3 Ampere at rated speed. Other component that is needed to correctly operate the PIC Crystal (4 MH), voltage regulator, limiting resistors

7.2 Some pictures of the output captured from the oscilloscope: First when 5 items passes the IR sensor, 25%

Page

19

When .. 50%

Page

20

75%

Page

21

Page

22

100%

The circuit :

Page

23

Page

24