Microcontroller – Based digitalMicrocontroller – Based digital
control of DC - motorcontrol of DC - motor
University of GaryounisUniversity of Garyounis
Faculty of EngineeringFaculty of Engineering
Electrical and Electronic Engineering DepartmentElectrical and Electronic Engineering Department
Project objectivesProject objectives
Modeling of separately excited DC motorModeling of separately excited DC motor
Control design and simulationControl design and simulation
Physical implementationPhysical implementation
Modeling of separately excited DC motorModeling of separately excited DC motor
Determination of electrical specificationsDetermination of electrical specifications
A
-
+
12
1 O h m
21
V 8
D C = 5 V
T o O s c i l l o s c o p e
RRaa = 3.1 ohm L= 3.1 ohm Laa = 0.822 Henry= 0.822 Henry
Determination of Mechanical specificationsDetermination of Mechanical specifications
Rotor moment of inertiaRotor moment of inertia
Viscous frictionViscous friction
Tm(S)Ia(S)
1/ (LaS + Ra) 1/ (JmS + Bm)
Kb
Kt
-TL(S)
Ω m(S)Ea(s)
-Eb(s)
++
JJmm= 0.04307 kg.m2 B= 0.04307 kg.m2 Bmm = 7.868 x 10-4 N.m/(rad/sec)= 7.868 x 10-4 N.m/(rad/sec)
KKbb= 0.46 Volt/(rad/sec)= 0.46 Volt/(rad/sec) KKtt= 0.46 N.m/A.Wb= 0.46 N.m/A.Wb
Project objectivesProject objectives
Modeling of separately excited DC motorModeling of separately excited DC motor
Control design and simulationControl design and simulation
Control design and simulationControl design and simulation
Current controller designCurrent controller design
Speed controller designSpeed controller design
Current Controller DesignCurrent Controller Design
Freq domain specificationsFreq domain specifications
Gain crossover freq = 10 rad/sec Phase margin = 60 degGain crossover freq = 10 rad/sec Phase margin = 60 deg
-40
-35
-30
-25
-20
-15
-10
-5
0
Magnitude(dB)
10
-1
10
0
10
1
10
2
-90
-45
0
Phase(deg)
Frequency (rad/sec)
UncompensatedSystemUncompensatedSystem
Corner frequency 1 Rad/SecCorner frequency 1 Rad/Sec
CompensatedSystemCompensatedSystem
Current Controller DesignCurrent Controller Design
Frequency (rad/sec)
-50
0
50
Magnitude(dB)
10
-1
10
0
10
1
10
2
10
3
-130
-120
-110
-100
-90
Phase(deg)
Corner frequency 10 Rad/SecCorner frequency 10 Rad/Sec
Phase Margin = 60 degreePhase Margin = 60 degree
Current Controller DesignCurrent Controller Design
Step response of current controllerStep response of current controller
0 0.2 0.4 0.6 0.8 1 1.2
0
0.2
0.4
0.6
0.8
1
1.2
1.4
Time (sec)
Amplitude
Control design and simulationControl design and simulation
Current controller designCurrent controller design
Speed controller designSpeed controller design
-60
-40
-20
0
20
40
Magnitude(dB)
10
0
10
1
10
2
-225
-180
-135
-90
Phase(deg)
Bode Diagram
Frequency (rad/sec)
Speed Controller DesignSpeed Controller Design
Corner frequency 10 Rad/SecCorner frequency 10 Rad/Sec
UncompensatedSystemUncompensatedSystem
Gain Margin = 17.5 dBGain Margin = 17.5 dB
Phase Margin = 27.5 degreePhase Margin = 27.5 degree
Freq domain specificationsFreq domain specifications
Gain crossover freq = 4 rad/sec Phase margin = 60 degGain crossover freq = 4 rad/sec Phase margin = 60 deg
Bode Diagram
Frequency (rad/sec)10
-2
10
-1
10
0
10
1
10
2
-225
-180
-135
-90
Phase(deg)
-100
-50
0
50
100Magnitude(dB)
Speed Controller DesignSpeed Controller Design
Corner frequency 4 Rad/SecCorner frequency 4 Rad/Sec
CompensatedSystemCompensatedSystem
Phase Margin = 70 degreePhase Margin = 70 degree
Speed Controller DesignSpeed Controller Design
Project objectivesProject objectives
Modeling of separately excited DC motorModeling of separately excited DC motor
Control design and simulationControl design and simulation
Physical implementationPhysical implementation
Physical implementation: Hardware DesignPhysical implementation: Hardware Design
General Block Diagram of Hardware DesignGeneral Block Diagram of Hardware Design
DC SourceDC SourceDC SourceDC Source
InterfaceInterfaceInterfaceInterface DC ChopperDC ChopperDC ChopperDC Chopper DC MotorDC MotorDC MotorDC MotorDPWMDPWMDPWMDPWM
MeasurementsMeasurementsMeasurementsMeasurements
Firmware DesignFirmware Design
Start up & Initialize PeripheralsStart up & Initialize Peripherals
PWMPWM
Soft UARTSoft UART
A / DA / D
Start up & Initialize PeripheralsStart up & Initialize Peripherals
PWMPWM
Soft UARTSoft UART
A / DA / D
Wait the HostWait the Host
CommandCommand
Wait the HostWait the Host
CommandCommand
General block diagramGeneral block diagram
Main control programMain control program
Change Reference SpeedChange Reference Speed
Change Reference SpeedChange Reference Speed
PI-Speed ControllerPI-Speed Controller
PI-Speed ControllerPI-Speed Controller
PI-Current ControllerPI-Current Controller
PI-Current ControllerPI-Current Controller
Digital PW-ModulatorDigital PW-Modulator
Digital PW-ModulatorDigital PW-Modulator
RS-232 CommunicationRS-232 Communication
RS-232 CommunicationRS-232 Communication
Ref ChangeRef Change
Ref ChangeRef Change
NONONONO
STARTSTART
STARTSTART
YESYES
YESYES
Firmware flow chartFirmware flow chart
Software Design
Start MotorStart Motor
STARTSTART
Do EventsDo Events
Packet ReceivedPacket Received
Packet ProcessPacket Process
PacketPacket
TypeType
speedspeed
CurrentCurrent
Display currentDisplay current
signal on Excel sheetsignal on Excel sheet
Display speed signalDisplay speed signal
on Excel sheeton Excel sheet
Wait on next packetWait on next packet
Overall Design & System Operation
DC supplyDC supply
DC MotorDC Motor
Power MOSSFETPower MOSSFET
FreeFree
WheelingWheeling
DiodeDiode
Current TransducerCurrent TransducerSpeed Signal conditioningSpeed Signal conditioning
Current Signal conditioningCurrent Signal conditioning
PIC16F877APIC16F877A
RS232RS232
DutyDuty
InterfaceInterface
FloatingFloating
SupplySupply
VVgsgs
-20
0
20
40
60
80
100
0 2 4 6 8 10
Time (sec)
Speed(Rad/Sec)
Motor Speed
Set Point
Video 1Video 1
Video 2Video 2
BACKUPBACKUP

Presentation1

  • 1.
    Microcontroller – BaseddigitalMicrocontroller – Based digital control of DC - motorcontrol of DC - motor University of GaryounisUniversity of Garyounis Faculty of EngineeringFaculty of Engineering Electrical and Electronic Engineering DepartmentElectrical and Electronic Engineering Department
  • 2.
    Project objectivesProject objectives Modelingof separately excited DC motorModeling of separately excited DC motor Control design and simulationControl design and simulation Physical implementationPhysical implementation
  • 3.
    Modeling of separatelyexcited DC motorModeling of separately excited DC motor Determination of electrical specificationsDetermination of electrical specifications A - + 12 1 O h m 21 V 8 D C = 5 V T o O s c i l l o s c o p e RRaa = 3.1 ohm L= 3.1 ohm Laa = 0.822 Henry= 0.822 Henry
  • 4.
    Determination of MechanicalspecificationsDetermination of Mechanical specifications Rotor moment of inertiaRotor moment of inertia Viscous frictionViscous friction Tm(S)Ia(S) 1/ (LaS + Ra) 1/ (JmS + Bm) Kb Kt -TL(S) Ω m(S)Ea(s) -Eb(s) ++ JJmm= 0.04307 kg.m2 B= 0.04307 kg.m2 Bmm = 7.868 x 10-4 N.m/(rad/sec)= 7.868 x 10-4 N.m/(rad/sec) KKbb= 0.46 Volt/(rad/sec)= 0.46 Volt/(rad/sec) KKtt= 0.46 N.m/A.Wb= 0.46 N.m/A.Wb
  • 5.
    Project objectivesProject objectives Modelingof separately excited DC motorModeling of separately excited DC motor Control design and simulationControl design and simulation
  • 6.
    Control design andsimulationControl design and simulation Current controller designCurrent controller design Speed controller designSpeed controller design
  • 7.
    Current Controller DesignCurrentController Design Freq domain specificationsFreq domain specifications Gain crossover freq = 10 rad/sec Phase margin = 60 degGain crossover freq = 10 rad/sec Phase margin = 60 deg -40 -35 -30 -25 -20 -15 -10 -5 0 Magnitude(dB) 10 -1 10 0 10 1 10 2 -90 -45 0 Phase(deg) Frequency (rad/sec) UncompensatedSystemUncompensatedSystem Corner frequency 1 Rad/SecCorner frequency 1 Rad/Sec
  • 8.
    CompensatedSystemCompensatedSystem Current Controller DesignCurrentController Design Frequency (rad/sec) -50 0 50 Magnitude(dB) 10 -1 10 0 10 1 10 2 10 3 -130 -120 -110 -100 -90 Phase(deg) Corner frequency 10 Rad/SecCorner frequency 10 Rad/Sec Phase Margin = 60 degreePhase Margin = 60 degree
  • 9.
    Current Controller DesignCurrentController Design Step response of current controllerStep response of current controller 0 0.2 0.4 0.6 0.8 1 1.2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 Time (sec) Amplitude
  • 10.
    Control design andsimulationControl design and simulation Current controller designCurrent controller design Speed controller designSpeed controller design
  • 11.
    -60 -40 -20 0 20 40 Magnitude(dB) 10 0 10 1 10 2 -225 -180 -135 -90 Phase(deg) Bode Diagram Frequency (rad/sec) SpeedController DesignSpeed Controller Design Corner frequency 10 Rad/SecCorner frequency 10 Rad/Sec UncompensatedSystemUncompensatedSystem Gain Margin = 17.5 dBGain Margin = 17.5 dB Phase Margin = 27.5 degreePhase Margin = 27.5 degree Freq domain specificationsFreq domain specifications Gain crossover freq = 4 rad/sec Phase margin = 60 degGain crossover freq = 4 rad/sec Phase margin = 60 deg
  • 12.
    Bode Diagram Frequency (rad/sec)10 -2 10 -1 10 0 10 1 10 2 -225 -180 -135 -90 Phase(deg) -100 -50 0 50 100Magnitude(dB) SpeedController DesignSpeed Controller Design Corner frequency 4 Rad/SecCorner frequency 4 Rad/Sec CompensatedSystemCompensatedSystem Phase Margin = 70 degreePhase Margin = 70 degree
  • 13.
  • 14.
    Project objectivesProject objectives Modelingof separately excited DC motorModeling of separately excited DC motor Control design and simulationControl design and simulation Physical implementationPhysical implementation
  • 15.
    Physical implementation: HardwareDesignPhysical implementation: Hardware Design General Block Diagram of Hardware DesignGeneral Block Diagram of Hardware Design DC SourceDC SourceDC SourceDC Source InterfaceInterfaceInterfaceInterface DC ChopperDC ChopperDC ChopperDC Chopper DC MotorDC MotorDC MotorDC MotorDPWMDPWMDPWMDPWM MeasurementsMeasurementsMeasurementsMeasurements
  • 16.
    Firmware DesignFirmware Design Startup & Initialize PeripheralsStart up & Initialize Peripherals PWMPWM Soft UARTSoft UART A / DA / D Start up & Initialize PeripheralsStart up & Initialize Peripherals PWMPWM Soft UARTSoft UART A / DA / D Wait the HostWait the Host CommandCommand Wait the HostWait the Host CommandCommand General block diagramGeneral block diagram
  • 17.
    Main control programMaincontrol program Change Reference SpeedChange Reference Speed Change Reference SpeedChange Reference Speed PI-Speed ControllerPI-Speed Controller PI-Speed ControllerPI-Speed Controller PI-Current ControllerPI-Current Controller PI-Current ControllerPI-Current Controller Digital PW-ModulatorDigital PW-Modulator Digital PW-ModulatorDigital PW-Modulator RS-232 CommunicationRS-232 Communication RS-232 CommunicationRS-232 Communication Ref ChangeRef Change Ref ChangeRef Change NONONONO STARTSTART STARTSTART YESYES YESYES Firmware flow chartFirmware flow chart
  • 18.
    Software Design Start MotorStartMotor STARTSTART Do EventsDo Events Packet ReceivedPacket Received Packet ProcessPacket Process PacketPacket TypeType speedspeed CurrentCurrent Display currentDisplay current signal on Excel sheetsignal on Excel sheet Display speed signalDisplay speed signal on Excel sheeton Excel sheet Wait on next packetWait on next packet
  • 19.
    Overall Design &System Operation DC supplyDC supply DC MotorDC Motor Power MOSSFETPower MOSSFET FreeFree WheelingWheeling DiodeDiode Current TransducerCurrent TransducerSpeed Signal conditioningSpeed Signal conditioning Current Signal conditioningCurrent Signal conditioning PIC16F877APIC16F877A RS232RS232 DutyDuty InterfaceInterface FloatingFloating SupplySupply VVgsgs
  • 20.
    -20 0 20 40 60 80 100 0 2 46 8 10 Time (sec) Speed(Rad/Sec) Motor Speed Set Point
  • 21.
  • 22.