ABSTRACT I. INTRODUCTION T (3) T T

Similar documents
ETEC Digital Controls PIC Lab 10 Pulse Width Modulation

Real-Time Clock. * Real-Time Computing, edited by Duncan A. Mellichamp, Van Nostrand Reinhold

Section 14. Compare/Capture/PWM (CCP)

Design and Construction of Variable DC Source for Laboratory Using Solar Energy

STEPPER MOTOR SPEED AND POSITION CONTROL

Data Acquisition Module with I2C interface «I2C-FLEXEL» User s Guide

CHAPTER 11: Flip Flops

AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR

PROJECT PRESENTATION ON CELLPHONE OPERATED ROBOTIC ASSISTANT

Innovative Practices in Optimal Utilization of Solar Energy (Solar Tracking System)

Accurate Measurement of the Mains Electricity Frequency

Application Note AN-1187

A Surveillance Robot with Climbing Capabilities for Home Security

Micro-Step Driving for Stepper Motors: A Case Study

1. Learn about the 555 timer integrated circuit and applications 2. Apply the 555 timer to build an infrared (IR) transmitter and receiver

Display Board Pulse Width Modulation (PWM) Power/Speed Controller Module

8051 MICROCONTROLLER COURSE

Hardware and Logic Implementation of Multiple Alarm System for GSM BTS Rooms

Microcontroller-based experiments for a control systems course in electrical engineering technology

How To Program A Microcontroller Board (Eb064) With A Psp Microcontroller (B064-74) With An Ios 2.5V (Power) And A Ppt (Power Control) (Power Supply) (

Interfacing Analog to Digital Data Converters

Selecting and Implementing H-Bridges in DC Motor Control. Daniel Phan A

Programming Logic controllers

HT46R14A Single Phase AC Induction Motor Frequency Converter Application

A Flexible Closed Loop PMDC Motor Speed Control System for Precise Positioning

Room Temperature based Fan Speed Control System using Pulse Width Modulation Technique

[F/T] [5] [KHz] [AMP] [3] [V] 4 ) To set DC offset to -2.5V press the following keys [OFS] [+/-] [2] [.] [5] [V]

Software Manual RS232 Laser Merge Module. Document # SU Rev A

Timer A (0 and 1) and PWM EE3376

Decimal Number (base 10) Binary Number (base 2)

DC Motor control Reversing

AC : PRACTICAL DESIGN PROJECTS UTILIZING COMPLEX PROGRAMMABLE LOGIC DEVICES (CPLD)

Access Control Using Smartcard And Passcode

AVR Timer/Counter. Prof Prabhat Ranjan DA-IICT, Gandhinagar

MODULE BOUSSOLE ÉLECTRONIQUE CMPS03 Référence :

PID Control. Proportional Integral Derivative (PID) Control. Matrix Multimedia 2011 MX009 - PID Control. by Ben Rowland, April 2011

Pmod peripheral modules are powered by the host via the interface s power and ground pins.

HIGH VOLTAGE POWER SUPPLY FOR ELECTRO-OPTICS APPLICATIONS

Microtronics technologies Mobile:

Arduino Motor Shield (L298) Manual

Designing an Induction Cooker Using the S08PT Family

A Digital Timer Implementation using 7 Segment Displays

DC Motor Driver 24V 20A [RKI-1340]

Measuring Resistance Using Digital I/O

Series: IDAM Servo Drive E Digital Motor Drive - DMD

Pololu DRV8835 Dual Motor Driver Shield for Arduino

RF CONTROLLED VEHICLE ROBOT WITH METAL DETECTOR

Serial port interface for microcontroller embedded into integrated power meter

The Design of DSP controller based DC Servo Motor Control System

E-Blocks Easy RFID Bundle

ServoOne. Specification. Option 2 - Technology. x 11. x 8 X 8. x 10. x 9. x 7. x 6 TTL Encoder / TTL Encoder simulation

Location-Aware and Safer Cards: Enhancing RFID Security and Privacy

EXERCISE 3: String Variables and ASCII Code

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1

How to design an insulin pump

Servo Info and Centering

User Manual. AS-Interface Programmer

Solar Energy Conversion using MIAC. by Tharowat Mohamed Ali, May 2011

Design of an Insulin Pump. Purpose of an Insulin Pump:

DS1621 Digital Thermometer and Thermostat

POCKET SCOPE 2. The idea 2. Design criteria 3

A Practical Guide to Free Energy Devices

3. Identification of water pumps through RFID technology. 4. Wireless control of remote water pump using RF technology.

Fundamentals of Signature Analysis

Lab Experiment 1: The LPC 2148 Education Board

Controller for AD9850 DDS Modules Andy Talbot G4JNT

8-Bit Flash Microcontroller for Smart Cards. AT89SCXXXXA Summary. Features. Description. Complete datasheet available under NDA

LCM NHD-12032BZ-FSW-GBW. User s Guide. (Liquid Crystal Display Graphic Module) RoHS Compliant. For product support, contact

Welcome to the tutorial for the MPLAB Starter Kit for dspic DSCs

The components. E3: Digital electronics. Goals:

High Power LED Driver Series User s Guide

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

Monitoring of Intravenous Drip Rate

Table 1 below is a complete list of MPTH commands with descriptions. Table 1 : MPTH Commands. Command Name Code Setting Value Description

Eric Mitchell April 2, 2012 Application Note: Control of a 180 Servo Motor with Arduino UNO Development Board

OPTICAL COMMUNICATION BASED STEPPER MOTOR CONTROL USING PULSE WIDTH MODULATION

TURBO PROGRAMMER USB, MMC, SIM DEVELOPMENT KIT

Advanced LED Controller (LED Chaser)

ABB Drives. User s Manual. Pulse Encoder Interface Module RTAC-01

Microcontroller Code Example Explanation and Words of Wisdom For Senior Design

DS1104 R&D Controller Board

AVR Butterfly Training. Atmel Norway, AVR Applications Group

LED board datasheet EB

Design And Implementation Of Bank Locker Security System Based On Fingerprint Sensing Circuit And RFID Reader

Chapter 13. PIC Family Microcontroller

Development of Low Cost Private Office Access Control System(OACS)

UPS PIco. to be used with. Raspberry Pi B+, A+, B, and A. HAT Compliant. Raspberry Pi is a trademark of the Raspberry Pi Foundation

Pulse Width Modulation (PWM) LED Dimmer Circuit. Using a 555 Timer Chip

dspace DSP DS-1104 based State Observer Design for Position Control of DC Servo Motor

AN2680 Application note

F 2 MC-8FX FAMILY MB95200 SERIES ELECTRONIC SAFE DEMO REFERENCE SOLUTION 8-BITMICROCONTROLLER APPLICATION NOTE

Talon and Talon SR User Manual

Analog Servo Drive 25A8

Power Electronic Circuits

c0003 A Simple PIC Application CHAPTER 3

Feasibility Study of Implementation of Cell Phone Controlled, Password Protected Door Locking System

Flexible Active Shutter Control Interface using the MC1323x

Experiment 8 : Pulse Width Modulation

Implementing SPI Master and Slave Functionality Using the Z8 Encore! F083A

Transcription:

2015 IJSRST Volume 1 Issue 5 Print ISSN: 2395-6011 Online ISSN: 2395-602X Themed Section: Engineering and Technology Bidirectional Speed Control of DC Motor Based on Pulse Width Modulation using Microcontroller Ayman Y. Yousef *1, M. H. Mostafa 2 1 Electrical Engineering Department, Faculty of Engineering at Shoubra, Benha University, Cairo, Egypt 2 Distribution Sectors, South Cairo Electrical Distribution Co., Cairo, Egypt ABSTRACT This paper presents a design, simulation and implementation of Pulse Width Modulation (PWM) speed control system of DC motor using microcontroller (MCU). The PIC16F877A microcontroller is programmed to generate two periodic PWM signals from its Capture/Compare/PWM (CCP) modules. These output PWM signals from MCU with various duty cycle are used to controlling the speed and direction of DC motor through L293D driver chip which is used as an interface between MCU and DC motor. The PIC MCU has been programmed using flowcode software package and the complete PWM control system model has been simulated using proteus design suite software package. A hardware setup has been practically implemented for the proposed control system in order to check the simulation results and which were acceptable and satisfactory. Keywords: PIC Microcontroller, PWM Technique, CCP Module, Duty Cycle, DC Motor Driver. I. INTRODUCTION DC motor drives are used for many speed and position control systems where their excellent performance, ease of control and high efficiency are desirable characteristics [1, 2]. The rotational speed of a DC motor is directly proportional to the mean (average) value of its supply voltage which applied to the motor terminals and by increasing this value up to its maximum value, the motor can rotate faster. Pulse-width modulation (PWM) is a digital technique used in many industrial applications mostly for controlling the motor speed by varying the amount of power delivered to the DC motor. In other words by increasing the voltage applied to the motor its speed will increases. The PWM means varying the ratio between the "ON" (t ON ) time and the "OFF" (t OFF ) time durations, which called the "Duty Cycle". Then by varying the width of pulse, the motor voltage and hence the power applied to the motor can be controlled as shown in Fig. 1 which shows the ON and OFF time of simple PWM signal. The pulse period is given by: T T ON T OFF Where: T is the Pulse period, T ON is the ON time = Pulse width, and T OFF is the OFF time. The duty cycle is defined by the ratio of the pulse width to pulse period as: Pulse width Duty cycle Pulse period (1) (2) T Duty cycle T ON T ON TON T OFF (3) Figure 1: PWM time duration If the rated supply voltage of the DC motor is V s, then the average DC output voltage fed to the motor is given by: IJSRST151518 Received: 18 November 2015 Accepted: 23 November 2015 November-December 2015 [(1)5: 52-60] 52

V Duty cycle average V s Therefore, the motor speed can be controlled with regularly adjusting the time of turn-on and turn-off in order to changing the average value of the motor voltage V av and then the rotational speed of the motor can be varied. Figure 2 illustrate the timing diagram of the PWM signals for various duty cycles with supply voltage of 12V. The motor speed is slow, medium and fast with duty cycle 25%, 50%, and 75% respectively. (4) These modules can support PWM signals by initializing the control register and duty-cycle register. The CCP1 and CCP2 modules are identical in operation, with the exception being the operation of special event trigger. Table. 1 show the resources and interactions of the CCP modules. TABLE I CCP MODE -TIMER RESOURCES REQUIRED CCP Mode Capture Compare PWM Timer Resource Timer1 Timer1 Timer2 The operation of a CCP module is described with respect to CCP1, whereas CCP2 operates the same as CCP1 except where noted [4]. The CCP1 Module is comprised of two 8-bit registers: CCPR1L (low byte) and CCPR1H (high byte). The CCP1CON register controls the operation of CCP1 module as shown in Fig. 3. Figure 2: PWM Signals with Different Duty Cycles There are three methods could achieve the adjustment of duty cycle [ 3 ]: (a) Adjust frequency with fixed pulsewidth. (b) Adjust both frequency and pulse-width. (c) Adjust pulse-width with fixed frequency which is the method chosen in this work depending on the PWM module embedded in a PIC 16F877A microcontroller. II. Generation of PWM using PIC16F877A The PIC16F877A has two Capture/Compare/PWM (CCP) Modules [4]. Each module (CCP1 and CCP2) contains a 16 bit register (two 8-bit registers) and can operate in one of the three different modes as: 16-bit Capture register 16-bit Compare register PWM Master/Slave Duty Cycle register Figure 3: Block diagram of PWM mode of CCP1 module. Also, the CCP2 Module is comprised of two 8-bit registers: CCPR2L (low byte) and CCPR2H (high byte). The CCP2CON register controls the operation of CCP2 module. The special event trigger is generated by a compare match and will reset Timer1 and start an A/D conversion (if the A/D module is enabled) [4]. In Pulse Width Modulation mode, the CCP1 or CCP2 pins produces up to a 10-bit resolution PWM output. 53

Since the CCP1 pin is multiplexed with the PORTC data latch, the TRISC<2> bit must be cleared to make the CCP1 pin an output. Clearing the CCP1CON register will force the CCP1 PWM output latch to the default low level. This is not the PORTC I/O data latch [5]. The PWM period is specified by writing to the PR2 register and has a time base (period) and a time that the output stays high (duty cycle) [6] as shown in Fig. (4). The frequency of the PWM is the inverse of the period (1/period). Figure 4: Microcontroller PWM output III. DC Motor Driver In order to control the DC motor, the motor armature winding must be driven by signals which are generated by the PIC16F877A microcontroller. Since the PIC microcontroller input and output ports terminals do not source a sufficient current to the motor therefore, an integrated power driver is used. A simple and low cost L293D device was chosen to drive a small DC motor. The pin assignment and the internal schematic diagram of L293D IC device are shown in Fig. 5 and Fig. 6 respectively. Figure 6: Internal L293D schematic diagram The L293D driver consist of four channel driver or dual H-Bridge channel and can be used to drive four motors in one direction only, or two motors bidirectional. The chip has a built-in freewheeling diodes to protect the circuit from the back EMF [7]. it can drive a motor with a maximum output voltage of 36v. It has output current of 600mA and peak output current of 1.2A per channel and 5 khz switching frequency. It has two control inputs, one enable input and one output per each channel. The pins EN1, IN1, IN2, OUT1 and OUT2 control one of the motors while the pins EN2, IN3, IN4, OUT3 and OUT4 control the other if the driver used to control two motors. The Control inputs are used to control the direction while the enable input is used for turn the bridge ON or OFF. In addition, it has four ground center pins connected together and used as a heat sink. The device must be powered by two supply voltage; the first is the external voltage supply which also drives DC motor up to 36V and the other is +5V which is the logic supply voltage to control the IC. IV. Control System Strategy The proposed control strategy based on PWM technique using PIC microcontroller and the L293D driver chip is shown in Fig. 7. Figure 5: L293D pin assignment diagram Figure 7: Proposed PWM control strategy 54

The operation of the H-Bridge is fairly simple by Identify the logic state of Enable 1, Input 1, and Input 2 pins. Enable 1 pin is responsible for the motor turn on and off, while the Input pins are used to change the speed direction of the motor by changing the voltage across its terminals. For example, if Enable 1, Input 1pins are in HIGH state, and Input 2 pin in the LOW state, the motor will rotate clockwise. On the other hand, if Enable 1, Input 2 pins are in HIGH state, and Input 1 pin in the LOW state, the motor will turn to the other direction. If Input pins are both at the same level and the Enable pin is high then the motor will stall (or break) and with the Enable pin is low the motor will freewheel. Therefore, the idea of the control depends upon the two control inputs connected to the driver channel, when the microcontroller sends a logic value 1 to the motor it will start running in a certain direction, and when the logic value is 0 it will inverse the direction. The behavior of the DC motor for various input conditions are as in the following truth table 2. TABLE II MOTOR BEHAVIOUR WITH VARIOUS INPUT CONDITIONS Motor status Input 1 Input 2 Motor Stops or brake Low Low Motor Runs (Anticlockwise) Low High Motor Runs (clockwise) High Low Stops or brake High High V. PWM Control System Description The proposed schematic diagram of the PWM control of DC motor is designed and simulated by Proteus 7.10 professional software package. The circuit is consists of the PIC16F877A microcontroller which is the main control element of the implemented control system and other electric and electronic devices as shown in Fig. 8. Figure 8: Schematic diagram of the PWM control of DC motor designed by Proteus software A digital LCD (4x16) connected to port B and one 7- segment unit connected to port D are used to display the details of DC motor control modes of operation. The PIC will generate the PWM signals from CCP1 and CCP2 modules at port C (RC2 and RC1) to drive the DC motor and control its speed. The motor driver chip L293D is interfaced with PIC microcontroller pin RC2 and RC1 at its input terminals IN1and IN2 while its EN1 pin is connected to pin RC7 at HIGH state signal constantly. Two push button switches (button1and button2) are used to select the direction of rotation (clockwise or anticlockwise) of the DC motor. Another push button switch (button 3) is used to make the motor in brake mode. Two toggle switches (switch 4 and switch 5) are used to increase/decrease the DC motor speed. The DC motor is connected to the output pins (OUT1 and OUT2) of the L293D driver chip. A 5V/12V DC power supply is used to drive the PIC microcontroller and L293D chip by 5V, and the DC motor by 12V. VI. Software Algorithm Implementation The software and control algorithm of the implemented PWM control system was developed using Flowcode software package. Flowcode is graphical programming software which is used to programming the PIC microcontroller. Flowcode software contains a tool to compile the designed flowchart to the hexadecimal (HEX) file. This HEX file is loaded in the 55

microcontroller RAM in order to execute the control system. The software implementation of the control algorithm consists of main routine and a group of subroutines as shown in Fig. 9. Figure 9: Structure of software implementation The program of main routine shown in Fig.(10) started by configuring the PIC microcontroller and loading it by the necessary system codes, its initialization and also call the start routine to display the motor status. The right and left direction routines are programed to generate the two PWM signals having duty cycle changing from 0 to 100% with period equals 4ms and frequency equals to 244 Hz by using of CCP1 and CCP2 PWM modules of the PIC microcontroller. These two PWM modules are configured as output pins and the PWM period is specified by writing to the PR2 register. The duty cycle 1 of the clockwise direction (right mode) and duty cycle 2 of the anticlockwise direction (lift mode) are stored in the microcontroller EEPROM. Two analogue to digital converter channels (ADC1 and ADC2) of the microcontroller are used to set the output at the target level by incrementing or decrementing the duty cycle values. Figure 10: flowchart of the developed control algorithm. The simulation of the PWM control system with the different modes of operation using flowcode software is shown in Fig. 11. The right direction mode is simulated at duty cycle 1 equals 65% of PWM period using CCP1 module. The lift direction mode is simulated at duty cycle 2 equals 85% of PWM period using CCP2 module. The brake mode is simulated at duty cycle 3 equals 100% of PWM period using CCP1and CCP2 modules. The duty cycle 1 is specified by writing to the CCPR1L register for CCP1 module and also the duty cycle 2 is loading to the CCPR2L register of CCP2 module. The brake mode is programed to load the CCPR1L register and CCPR2L register by duty cycle 3 which is equal to 100% of the PWM period. Figure 11a: Start mode (CCP1 and CCP2 modules with Duty cycle = 0) 56

The minimum hardware development setup of the bidirectional PWM control system of DC motor having rated voltage V =12V and current I=0.5A. is shown in Fig. 12. Figure 11b: Right direction mode (CCP1 module with Duty cycle 1 = 65%) Figure 12: Photograph of hardware setup connection of PIC16F877A based PWM control system of DC motor The practical implementation of the three modes of operation (right, lift, and break) of the PWM control system of DC motor with LCD, 7-segment display, L293D driver is shown in Fig. 13. Figure 11c: Lift direction mode (CCP2 module with Duty cycle 2 = 85%) Figure 11d: Brake mode (CCP1 and CCP2 modules with Duty cycle 3 = 100%) Figure 13a: Right direction mode Figure 10: Simulation of PWM control system on flowcode software panel VII. Hardware System Implementation 57

Figure 13b: Lift direction mode Figure 14a: Output signals at duty cycle 25% Horizontal: 1 msec/div. Vertical; 5 volt/div. Upper Trace: PWM signal. Lower Trace: Terminal voltage (V av = 3V). Figure 13c: Brake direction mode Figure 13: Photograph of hardware setup connection of PWM control system with different modes of operation. Figure 14b: Output signals at duty cycle 50% Horizontal: 1 msec/div. Vertical; 5 volt/div. Upper Trace: PWM signal. Lower Trace: terminal voltage (V av = 6V). VIII. Simulation and Excremental Results The simulation results of the digital PWM signals with period of 4ms and frequency of 244 Hz generated from PIC16F877A microcontroller of the proposed control system of DC motor using proteus software package are shown in Fig. 14. The output PWM signals and the corresponding DC motor terminal voltage for various values of duty cycle are shown also in Fig. 13. The chosen values of 25%, 50%, 75%, and 100% duty cycles gives motor terminal voltage as average values equals 3V, 6V, 9V, and 12V respectively. Figure 14c: Output signals at duty cycle 75% Horizontal: 1 msec/div. Vertical; 5 volt/div. Upper Trace: PWM signal. 58

Lower Trace: terminal voltage (V av = 9V). Figure 14d: Output signals at duty cycle 100% Horizontal: 1 msec/div. Vertical; 5 volt/div. Upper Trace: PWM signal. Lower Trace: terminal voltage (V av = 12V). Figure 15b: PWM signal at duty cycle = 50% Horizontal: 2 msec/div. Vertical; 10 volt/div. Figure 13: PWM signals and DC motor terminal voltage at various values of Duty cycle. The hardware oscilloscope results of PWM signals with the same period and frequency at different values of PWM duty cycle are shown in Fig. 15. Figure 15c: PWM signal at duty cycle = 75% Horizontal: 2 msec/div. Vertical; 10 volt/div. Figure 15a: PWM signal at duty cycle = 25% Horizontal: 2 msec/div. Vertical; 10 volt/div. Figure 15d: PWM signal at duty cycle = 100% Horizontal: 2 msec/div. Vertical; 10 volt/div. 59

Figure 15: Photograph of PWM signals at various values of PWM duty cycle. IX. CONCLUSION This paper has covered the design, simulation and practical implementation of a low-cost bidirectional speed control of DC motor based on PWM technique using PIC16F877A MCU. The PWM channels of the PIC microcontroller with its embedded CCP modules has been programed to generate two digital PWM signals with period 4ms and frequency of 244 Hz. The proposed control system model can control the DC motor speed and direction by varying the duty cycle of the output PWM signals. A dual H-Bridge channel built in L293D device was chosen to drive a DC motor and also used as interface between it and MCU. The PIC16F877A MCU can integrate all required functions in its single chip and therefore, it reduces the hardware setup of the overall control system. A very good agreement was achieved between the experimental and simulation results. [6] Pallavi Papalkar and S. P. Phulambrikar, Speed Control of DC Motor using Capture/Compare/Pulse Width Modulation Module of PIC Microcontroller International Journal of Engineering Research & Technology,Vol. 3, Issue 9, September- 2014 [7] Push-Pull Four Channel Driver with Diodes, L293D Datasheet. [8] Shinde Krishnat Arvind, Tarate Akshay Arun, Taur Sandip Madhukar, and Prof. Jayashree Deka Speed Control of DC Motor using PIC 16F877A Microcontroller Multidisciplinary Journal of Research in Engineering and Technology, Volume 1, Issue 2, July- 2014 [9] Taiqiang Cao, Jianping Xu, and Shungang Xu, Designing DSP Based Digital Control DC Motor System IEEE Proceedings 2008. X. REFERENCES [1] Sabedin A. Meha, Besnik Haziri, Loreta N. Gashi, and Behar Fejzullahu Controlling DC Motor Speed using PWM from c# windows Application 15th International Research/Expert Conference Trends in the Development of Machinery and Associated Technology, TMT 2011, Prague, Czech Republic, 12-18 September 2011. [2] Bharat Joshi, Rakesh Shrestha, and Ramesh Chaudhar Modeling, Simulation and Implementation of Brushed DC Motor Speed Control Using Optical Incremental Encoder Feedback Proceedings of IOE Graduate Conference, 2014. [3] Yue-Li Hu, and Wei Wang Design of PWM Controller in a MCS-51 Compatible MCU IEEE Proceedings of (HDP 07) 2007. [4] PIC Microcontroller Instruction Sets, PIC16F877A Datasheet. [5] A.S.M. Bakibillah, Nazibur Rahman, Md. Anis Uz Zaman, Microcontroller based Closed Loop Speed Control of DC Motor using PWM Technique International Journal of Computer Applications Volume 108 No 14, December 2014. 60