Last Updated on Friday, 02 March 2012 13:59 Written by Administrator Saturday, 07 July 2007 09:54
Introduction:
The control of the rotation speed of servo motors is very complicated when done using traditional control techniques, as it requires a very complex mathematical model. Using Fuzzy logic eliminates the need for mathematical modeling and allows easy realization of a solution.

FLC Design:
Block Diagram of the FLC: Fuzzy PID controller, FPD + I


Membership Function For dError (X2[])

The result of the fuzzification of an input value is a vector with five elements
as three are five fuzzy sets, and the value of each member defines the degree of
membership of the input value to a particular fuzzy set (µ-value). The vectors for
the absolute and differential errors which are the results of the fuzzification are
denoted as X1[] and X2[].
Fuzzy Inference:
The Max-min relations are used for the composition because the experience proved that they give precise results. The process consists of :
- Clear the output vector Y[]
- Take the first member of the vector X1[]
- Compare it to every member of the vector X2[]. The smaller value is recorded on every comparison.
- The maximum value is found among the members obtained in previous step .
- This maximum value is then added to the output vector member which is defined by the inference rules.
- The next member of the vector X1[] is taken and the process from 3 to 6 is repeated.
Fuzzy Inference Rule Table

Defuzzification:
The result of the defuzzification has to be a numeric value which determines the duty facto of the PWM signal used to drive the servo motor. It is obtained by finding the centroid point of the function which is the result of the multiplication
of the output membership function and the output vector Y[]. The general mathematical formula which is used to obtain the centroid point is :

Y[i] are the i-th members of the output vector,
k[i] are the multiplying coefficients of the output membership function.
Output membership function

Hardware Description:
DSP TMS320F28335 :

- High-Performance Static CMOS Technology
- High-Performance 32-Bit CPU (TMS320C28x)
- Six Channel DMA Controller (for ADC, McBSP, XINTF, and SARAM)
- 16-bit or 32-bit External Interface (XINTF)
- F28335/F28235: 256K x 16 Flash, 34K x 16 SARAM
- Boot ROM (8K x 16)
- Clock and System Control
- GPIO0 to GPIO63 Pins Can Be Connected to One of the Eight External Core Interrupts
- Enhanced Control Peripherals
+ Up to 6 Event Capture Inputs
+ Up to 2 Quadrature Encoder Interfaces
+ Up to 8 32-bit/Six 16-bit Timers
- Three 32-Bit CPU Timers
- Serial Port Peripherals
- 12-Bit ADC, 16 Channels
DC Servo Motor Driver Schematic

Encoder Reading Schematic

DC Servo Motor:
- Motor : 24V DC, 3A , 8000 RPM
- Resolution of encoder : 512
DC Servo Motor (No load)

DC Servo Motor (Load > 1kg)

Diagram of application:
DSP TMS320F28335 device is used to make FLC (Fuzzy Logic Controller).
The DSP controls the speed of servo motor and sends the result to Matlab .

Software Description:
Matlab:
Communicate between PC and DSP via RS232 standard using Matlab.
Matlab program includes 2 part:
- Transmit command to DSP :
When PC wants to read the result from DSP, it will send command to DSP.
- Receive data from DSP :
PC receives data from DSP and displays on Scope.
Parameter of Serial Communication:
- Baudrate : 115200 bps
- Number of Data bits : 8
- Number of Stop bits : 1
- Parity : None
Simulink model:

DSP TMS320F28335:
DSP programming uses Code Composer Studio 3.3 complier.
DSP will run the following main tasks :
- Creating PWM output signal : to control the speed of servo motor
- Read Encoder signal : to calculate the feedback velocity of servo motor.
- Send/ receive data via RS232: to send the result to PC
- PID Controller use timer 0 interrupt routine
- Fuzzy Controller use timer 0 interrupt routine
+ Fuzzification :
Function converts the discrete input value ‘Value’ into the 5-element
fuzzy vector Data[].
+ Fuzzy Inference:
Function applies the fuzzy control interference rule table
‘InferenceTable[] []’ to the two input arrays X1[] and X2[] to generate
the output value Y[].
+ Defuzification :
Function transforms the Fuzzy vector Y[] to a discrete value using the
center of gravity method.
Results:
FLC at V = 4000 RPM (No Load):

FLC at V = 4000 RPM (Load) :

Conclusion:
The fuzzy logic controller behaved favorably when compared to the conventional PID controller.
Fuzzy Logic Controller on DSP TMS320F28335 stabled speed of servo motor with good response, fast rise time (≈ 0.04 s) and fast settling time ( ≈ 0.125 s), the overshoot and the error in steady state are very small ,…even the servo motor runs with load or no load at different speed value.