Waleed Abd El- Megeed El- Badry
         Mechatronics Department
           Faculty of Engineering
  Misr University for Science & Technology
           wbadry@must.edu.eg
                                             Microsoft®
                                             CERTIFIED
                                              Professional
                                               Developer
Motivation
Project Outlines
Briefed Introduction
Work Carried Out
Results and Conclusion
Signal
                                             Conditioning

                                   Electronics




Friction, Coupling
and Torque
                            Mechatronics
             Mechanical                                     Control
                            Engineering
                                                                      Fuzzy Logic
                                                                      Controller




                                   Computer
                                    Science

                     Interfacing
                     Programming
Based on Linear model of DC Motor




 Source: Mo-Yuen Chow, ”Fuzzy Logic Microcontroller Implementation
            for DC Motor Speed Control”
Source: http://www.Fuzzy-Logic.com
Knowledge Base


      Fuzzification     Fuzzy Rules        Defuzzification



                       Coupling

D/A              M                     T               A/D
DC Motor-Tachometer Specification:
 24V DC
 180 RPM
 1.5 A

NI USB 6008
  12 Bits, 200Ks/S A/D Converter (0-10V)
  12 Bits, D/A Converter (0-5V)
BJT Amplifier
• Sourcing Current Up to 10 A
•Withstand Collector Voltage up
to 100V

Major Drawback:
Nonlinearity
• Designing a fuzzy logic class library was key objective
• Visual Studio proved to be a better performing language for real time applications.
• Object Orientation facilitates software design.
•.NET framework has rich library that developers can utilize from any language in VS
family (C#, VB and VC++)



          Microsoft®
          Visual Studio 2008
Fuzzy System
            •Mamdani
            •Sugeno



             Fuzzy Variable
Name       •Input                      Range
           •Output



             Fuzzy Term



   Trapezoidal            Triangular
'Declaration of Fuzzy System
  Dim fsSpeedControl As New MamdaniFuzzySystem
  Dim fvSpeed As New FuzzyVariable("Speed", 0.0, 1.0)
  Dim fvOutputVoltage As New FuzzyVariable("OutputVoltage", 0.0, 1.0)

'Fuzzification of Speed
     'Input Speed Fuzzy Terms
     fvSpeed.Terms.Add(New FuzzyTerm("VerySlow", New TrapezoidMembershipFunction(0.0, 0.0, 0.3, 0.4)))
     fvSpeed.Terms.Add(New FuzzyTerm("Slow", New TriangularMembershipFunction(0.3, 0.4, 0.5)))
     fvSpeed.Terms.Add(New FuzzyTerm("AboutRight", New TriangularMembershipFunction(0.4, 0.5, 0.6)))
     fvSpeed.Terms.Add(New FuzzyTerm("Fast", New TriangularMembershipFunction(0.5, 0.6, 0.7)))
     fvSpeed.Terms.Add(New FuzzyTerm("VeryFast", New TrapezoidMembershipFunction(0.6, 0.7, 1.0, 1.0)))
     fsSpeedControl.Input.Add(fvSpeed)


'Fuzzification of Output Voltage
     'Output Voltage Fuzzy Terms
     fvOutputVoltage.Terms.Add(New   FuzzyTerm("SpeedUp", New TrapezoidMembershipFunction(0.6, 0.7, 1.0, 1.0)))
     fvOutputVoltage.Terms.Add(New   FuzzyTerm("SlightlySpeedUp", New TriangularMembershipFunction(0.5, 0.6, 0.7)))
     fvOutputVoltage.Terms.Add(New   FuzzyTerm("NoChange", New TriangularMembershipFunction(0.4, 0.5, 0.6)))
     fvOutputVoltage.Terms.Add(New   FuzzyTerm("SlightlySlowDown", New TriangularMembershipFunction(0.3, 0.4, 0.5)))
     fvOutputVoltage.Terms.Add(New   FuzzyTerm("SlowDown", New TrapezoidMembershipFunction(0.0, 0.0, 0.3, 0.4)))
    fsSpeedControl.Output.Add(fvOutputVoltage)
Dim Rule1 = fsSpeedControl.ParseRule("if (Speed is VerySlow) then (OutputVoltage is SpeedUp)")
Dim Rule2 = fsSpeedControl.ParseRule("if (Speed is Slow) then (OutputVoltage is SlightlySpeedUp)")
Dim Rule3 = fsSpeedControl.ParseRule("if (Speed is AboutRight) then (OutputVoltage is NoChange)")
Dim Rule4 = fsSpeedControl.ParseRule("if (Speed is Fast) then (OutputVoltage is SlightlySlowDown)")
Dim Rule5 = fsSpeedControl.ParseRule("if (Speed is VeryFast) then (OutputVoltage is SlowDown)")
Screenshot from project
Dc motor speed control

Dc motor speed control

  • 1.
    Waleed Abd El-Megeed El- Badry Mechatronics Department Faculty of Engineering Misr University for Science & Technology wbadry@must.edu.eg Microsoft® CERTIFIED Professional Developer
  • 2.
  • 4.
    Signal Conditioning Electronics Friction, Coupling and Torque Mechatronics Mechanical Control Engineering Fuzzy Logic Controller Computer Science Interfacing Programming
  • 6.
    Based on Linearmodel of DC Motor Source: Mo-Yuen Chow, ”Fuzzy Logic Microcontroller Implementation for DC Motor Speed Control”
  • 7.
  • 8.
    Knowledge Base Fuzzification Fuzzy Rules Defuzzification Coupling D/A M T A/D
  • 9.
    DC Motor-Tachometer Specification: 24V DC 180 RPM 1.5 A NI USB 6008 12 Bits, 200Ks/S A/D Converter (0-10V) 12 Bits, D/A Converter (0-5V)
  • 11.
    BJT Amplifier • SourcingCurrent Up to 10 A •Withstand Collector Voltage up to 100V Major Drawback: Nonlinearity
  • 14.
    • Designing afuzzy logic class library was key objective • Visual Studio proved to be a better performing language for real time applications. • Object Orientation facilitates software design. •.NET framework has rich library that developers can utilize from any language in VS family (C#, VB and VC++) Microsoft® Visual Studio 2008
  • 15.
    Fuzzy System •Mamdani •Sugeno Fuzzy Variable Name •Input Range •Output Fuzzy Term Trapezoidal Triangular
  • 16.
    'Declaration of FuzzySystem Dim fsSpeedControl As New MamdaniFuzzySystem Dim fvSpeed As New FuzzyVariable("Speed", 0.0, 1.0) Dim fvOutputVoltage As New FuzzyVariable("OutputVoltage", 0.0, 1.0) 'Fuzzification of Speed 'Input Speed Fuzzy Terms fvSpeed.Terms.Add(New FuzzyTerm("VerySlow", New TrapezoidMembershipFunction(0.0, 0.0, 0.3, 0.4))) fvSpeed.Terms.Add(New FuzzyTerm("Slow", New TriangularMembershipFunction(0.3, 0.4, 0.5))) fvSpeed.Terms.Add(New FuzzyTerm("AboutRight", New TriangularMembershipFunction(0.4, 0.5, 0.6))) fvSpeed.Terms.Add(New FuzzyTerm("Fast", New TriangularMembershipFunction(0.5, 0.6, 0.7))) fvSpeed.Terms.Add(New FuzzyTerm("VeryFast", New TrapezoidMembershipFunction(0.6, 0.7, 1.0, 1.0))) fsSpeedControl.Input.Add(fvSpeed) 'Fuzzification of Output Voltage 'Output Voltage Fuzzy Terms fvOutputVoltage.Terms.Add(New FuzzyTerm("SpeedUp", New TrapezoidMembershipFunction(0.6, 0.7, 1.0, 1.0))) fvOutputVoltage.Terms.Add(New FuzzyTerm("SlightlySpeedUp", New TriangularMembershipFunction(0.5, 0.6, 0.7))) fvOutputVoltage.Terms.Add(New FuzzyTerm("NoChange", New TriangularMembershipFunction(0.4, 0.5, 0.6))) fvOutputVoltage.Terms.Add(New FuzzyTerm("SlightlySlowDown", New TriangularMembershipFunction(0.3, 0.4, 0.5))) fvOutputVoltage.Terms.Add(New FuzzyTerm("SlowDown", New TrapezoidMembershipFunction(0.0, 0.0, 0.3, 0.4))) fsSpeedControl.Output.Add(fvOutputVoltage)
  • 18.
    Dim Rule1 =fsSpeedControl.ParseRule("if (Speed is VerySlow) then (OutputVoltage is SpeedUp)") Dim Rule2 = fsSpeedControl.ParseRule("if (Speed is Slow) then (OutputVoltage is SlightlySpeedUp)") Dim Rule3 = fsSpeedControl.ParseRule("if (Speed is AboutRight) then (OutputVoltage is NoChange)") Dim Rule4 = fsSpeedControl.ParseRule("if (Speed is Fast) then (OutputVoltage is SlightlySlowDown)") Dim Rule5 = fsSpeedControl.ParseRule("if (Speed is VeryFast) then (OutputVoltage is SlowDown)")
  • 21.