DSP Based Adjustable Closed-Loop DC Motor Speed Control System

Abstract This paper deals with real time DC motor speed control, using the low-cost new generation TMS320LF2812 digital signal processor (DSP). An optimal control algorithm which can be realized through event manager (EV) module of the DSP is proposed. According to the error signal DSP processor will change the duty cycle of the PWM (which can be named mark-space ratio). The comparison between two signals (reference and actual speed) in addition to the PWM technique are included in a C++ language program. Code composer studio (CCS) is used to load and run the program to achieve real time control. Theoretically Matlab/Simulink software was used for simulation the proposed circuit before implementation. A PID controller is designed using MATLAB to generate a set of coefficients associated with the desired controller characteristics.


I. Introduction
Direct current (DC) motors have been widely used in many industrial applications such as electric vehicles, steel rolling mills, electric cranes, and robotic manipulators due to precise, wide, simple, and continuous control characteristics. DC motors have long been the primary means of Electrical Traction. DC motor has torque/speed characteristics compatible with most mechanical loads [1].
The speed control methods of a dc motor are simpler and less expensive than other types of motors and speed control over a large range both below and above rated speed can be easily achieved. Recently, brush less DC motors, induction motors and synchronous motors have gained wide spread use in Electrical Traction. However, there is a persistent effort towards making them behave like dc motors through innovative designs and control strategies. Hence, dc motors are always a good proving ground for advanced control algorithms because the theory is extendable to other types of motors. By controlling DC motors accurately, they can overlap many applications of stepper motors [2][3][4].
The uses of digital signal processors (DSPs) have permitted the increasingly stringent performance requirements and fast, efficient, and accurate control of servomotor and motion control systems. DSPs such as TMS320F2812 a (C2000) from Texas Instruments are currently used for wide range of control applications and communications. They continue to be successful because of available low cost support tools. DSP based systems can be readily programmed for different applications DSP processor will take the speed of the motor as the feedback signal and according to the difference between the set point speed and the present speed finally it will change the duty cycle of the base drive signal, which is given as the input to the buck converter. Basically the buck converter is a step down converter and it will supply the input to the DC motor according to the input duty cycle. The combined transfer functions of the buck converter and the motor are simulated for the desired PID controller.

II. State Space Modeling of the Buck Converter and DC Motor
Basically the buck converter is a step down converter. DC-to-DC converters are inherently nonlinear due to switching operation. The regulation is normally achieved by the PWM (mark-space ratio) at fixed frequency. The switching device is power MOSFET, which has low losses at high frequency and are voltage controlled. Here buck converter is used to give the regulated DC supply to the DC motor according to the duty cycle of input.
The buck converter is modeled using averaged signal model [5] [6]. From Fig.(1), a buck converter model is obtained using linear differential equations where i L is inductor current, u is input voltage, K is duty cycle, L is circuit inductance R L is the inductor resistance, C is the output capacitance and R is the load resistance. Thus the total solution can be obtained by state space averaging, then by summing the terms for each analysis the linear mode switching periods can be obtained, using the universal format, as.
------- (7) ---------(8) Substituting A 1 , A 2 , B 1 , and B 2 then the final state space equation can be written as In order to get the dynamic model the small signal perturbation must be introduced Here the load is assumed as DC motor where, capital letters have been used to describe the converter operating point. ---------(10) Where R = inf Ω, L = 5.5mH, C = 47μF, R L = 2Ω and U =220 V.
The transfer function of the buck converter is as follows: The transfer function of the DC motor is as follows: The combined transfer function of both the DC motor and the Buck converter is obtained by The cascaded transfer function obtained as follows:

III. Modeling and Control of DC Motor
The closed-loop speed control system in this study consists of a separately excited DC motor, a pulse width modulation at constant frequency, chopper, and proportional integral derivative type (PID) for speed and current controller that design using Ziegler-Nichols method. The transfer function which was found it in the previous section is used in MATLAB Program with multiple closed loop control system to tune the parameters of the PID controller. The closed-loop control of the motor has basically two feedback loops. The outer loop is a speed feedback loop and the inner loop is the current feedback loop. The controllers used in these loops are both of the PID type. The parameters of PID controller which was found it is used in the Power System Blockset (P.S.B) library to build the model of the system. The speed controller output is fed to a current limiter that produces controller signal to the current and this implement the reference for the current controller. The output of the current controller is the input to the uniform pulse width modulated (PWM) generator that controls the motor input voltage [7]. The MATLAB simulation model of the closed loop control system of the DC motor is given in Fig. (2).

IV. Practical Drive Circuits
To drive the power MOSFET of the chopper circuit is needs at least 7Volt, and the PWM output from DSP Kit does not exceed 3.3 Volt. Therefore, an electrical circuit must be designed to amplify output signal and isolate the DSP Kit from MOSFET gate. This circuit consists of three stages, buffer circuit, Optocoupler circuit and matching circuit. The practical isolated firing circuit is shown in Fig.(3).
Also for 3.3V ADC, the sensing and amplification stages usually must produce at the ADC input a signal swing of 0-3.3V. This is to achieve maximum signal magnitude and signal-tonoise ratio at the ADC input. It is a good practice to use an op-amp driver circuit for signal conditioning of input analog signals and as a buffer. The op-amp isolates the ADC acts as a low-impedance source to charge the sample capacitor and configured as a gain buffer. It provides low/stable output impedance and protects the ADC inputs.

V. Programming of TMS320F2812 Digital Signal Processor
The TMS320F2812 DSP has many special features for the control applications. It has Event Manager that is specially designed for the motor control and motion control applications [8]. The general-purpose Timer3 in EVB (Event Manager B) is used in continuous up/down count mode for the symmetric PWM generation. Timers have associated compare registers which are used to write the calculated duty ratio values. These values then get compared with the timer counter value in order to generate the PWM output [9].
The F281x and C281x can be clocked by an external oscillator or by a crystal attached to the on-chip oscillator circuit.  The DIV field controls whether the PLL is bypassed or not, and sets the PLL clocking ratio when not bypassed. In this paper set the PLL not bypassed and clocking ratio to (XCLKIN*10)/2 by select DIV field control to (1010) to give the maximum CPU clock rate.
The code development is carried out through an application suite called Code Composer Studio TM (CCS). The Code Composer Studio (CCS) provides an integrated development environment (IDE) to incorporate the software tool which is fully compatible and enables the engineers to simplify the source code. It has graphical capabilities and supports real-time debugging. Fig (4) shows the code composer window.
The 12-bit ADC module has 16 channels, configurable as two independent 8-channel modules to service event managers A and B. The two independent 8-channel modules can be cascaded to form a 16-channel module. Although there are multiple input channels and two sequencers, there is only one converter in the ADC module. Fig (5) shows the block diagram of the F2812 ADC module. The ADC of DSP could be triggered by the software, EVA/B or the external pins. In this paper the DSP platform, is set up the ADC trigger by the GPtimer1 (general-purpose timer one) of EVA that is set to continuous up count mode, whose frequency is supposed to be equal to the sampling frequency of the ADC. The Block diagram of the EVA module of TMS320F2812 is shown in Fig (6). The tachogenerator and reference voltages are connected to ADCINB0 and ADCINB1 respectively. Since the SOC is started by the GPTimer1, and once the conversion is finished, the EOC (end of conversion) interrupt is triggered, and then the ADC interrupt routine is called in the program. In ADC interrupt routine, DSP reads the sample results from the ADC result registers (ADCRESULT0 and ADCRESULT1).

VI. Experimental Results
The hardware system has been developed and tested under laboratory conditions. Fig. (7) shows the mark-space ratio output from TMS320F2812 DSP with desired switching frequency of the 5KHz. The system is designed in such away as to generate a PWM signal in which the duty cycle can be varied from zero to one hundred percent. The DC motor ratings that are used in this paper are 2KW; 220V and the load that is used is a generator coupled with DC motor.    Fig. (9) shows the practical step speed response of DC motor with speed rising from zero to a predetermined speed of 1375 rpm shown by the NI-PCI-6023E data acquisition card (DAQ) with 1000 sample/second. It can be seen that a steady raise is achieved with almost 2.8% overshoot and then the speed settles at required speed. Fig.(10) shows the practical speed response when a sudden load torque 2N.m is applied to the DC motor. It can be seen that the speed descends appreciably from 1375 to 1315 rpm and resumes the setting value (1375rpm) quickly within 3.581 seconds. Fig (11) shows the power electronics and control circuits of the system. The experimental setup of the closed loop speed control system is shown in Fig (12).

VII. Conclusion
The closed loop speed control system has been experimented, and the results were obtained by connecting DC motor as a load to the BUCK converter which is controlled by TMS320F2812 DSP. All the circuits were design and simulated using MATLAB program. Simulation and experimental results demonstrated the validity of the system and showed that the DSP is reliable instrument to control the motor. The system shows the applicability to different sizes of the motors and capable of controlling the speed of the motors with very high precision.

AC source voltage
Power electronic CCT+ DSP