SlideShare a Scribd company logo
Two Wheel Inverted Pendulum Control
Hongtao Gu
1. Introduction
Segway is a commercial application of the inverted pendulum.
https://www.groupon.com/deals/segway-of-richmond-8
2. Approach
 1. Model Based Controller
Mathematical Model
(State Space)
Feedback
Gain
𝑥
ሶ𝑥
𝜃
ሶ𝜃
State Space Equation:
ሶ𝑥 = 𝐴𝑥 + 𝐵
𝑦 = 𝐶𝑥 + 𝐷
0 1 0 0
0 −0.006844 16.6194 0
0 0 0 1
0 −0.00053 234.8387 0
A=
0
161.0343
0
1248.9
B=
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
C=
0
0
0
0
D=
[−31.6228 −92.1359 141.9806 11.9917]K=
2. Approach
 2. Error Based Controller
Physical Model
PID
Error= target 𝜃 – actual 𝜃
3. Implementation
 For balancing the system, 4 states value should be read by the controller.
 Accelerometer will output different voltage with respect to different acceleration.
 Encoder will read the rotational speed voltage signal.
 Labview will convert the voltage signal to the physical signal.
 Labview will also add a feedback gain on the 4 states.
Physical
Model
Arduino
Uno
Accelerometer
Encoder
DC
Motor
ADXL335 3-axis accelerometer
Output Range -3~3 g
Nonlinearity -0.3~0.3%
SENSITIVITY 300 (270~ 330)mV/g
Magnetic Encoder
Channel A, B
Pulse/Rev 3 Pulses/Channel
4. Hardware
Arduino Uno
Digital I/O 14 Pins
Analog Input 6 Pins
AI Resolution 10 bits
Clock Speed 16MHz
4. Read Angle and Angular Velocity
 Angle and Angular Velocity
Z
Y
𝜽
 Sensor Calibration
Read the two voltage signal when Z axis is same or
opposite direction with gravity to get sensitivity.
Z
1/m +1g -1g Delta_V Sensitivity
z 1.308594 1.962891 0.654297 327.1485
y 1.264648 1.914062 0.649414 324.707
Read the voltage signal when Z axis is horizontal
to compensate the 0 gravity.
b 0-g
y 1584.66
z 1613.57
𝜃 = atan(
𝑧
𝑦
) Angular
Velocity
Averaging
4000 Hz
20 Samples
y=m*x+b
5. Read Encoder
 Motor RPM
3 pulses per revolution
DC Motor
Max Output RPM 200 RPM
Gear Ratio 150:1
 Encoder
Pulses/s at maximum motor speed:
= 200 RPM * Gear Ratio* 3 pulses/Rev= 1500 pulses/s
Sampling Frequency >= 2 * 1500 Pulses/s = 3000 Hz
The max Fs is 5000 Hz for Arduino, so 4000 Hz frequency is used.
𝑅𝑃𝑆 =
σ 𝑅𝑖𝑠𝑖𝑛𝑔 𝐸𝑑𝑔𝑒
𝑆𝑎𝑚𝑝𝑙𝑖𝑛𝑔 𝑡𝑖𝑚𝑒
Displacement = σ (Rotation Speed ∗ Loop Time)
Q&A
Thank you!
Reference
[1] ADXL335:https://www.sparkfun.com/datasheets/Components/SMD/adxl335.pdf
[2] Magnetic Encoder: https://www.pololu.com/product/3081
[3] Arduino Uno: https://www.arduino.cc/en/Main/ArduinoBoardUno
[4] Bageant/Massachusetts Institute of Technology, M. R. (2011). DSpace@MIT: Balancing a two-
wheeled Segway robot. Retrieved from https://dspace.mit.edu/handle/1721.1/69500
[5] Khaled/Technische Universitat Munchen, M. (2009, July). Balancing a Two Wheeled Robot
(PDF Download Available). Retrieved from http://www.researchgate.net/publication/252629451

More Related Content

What's hot

EEP301: Process control trainer II
EEP301: Process control trainer IIEEP301: Process control trainer II
EEP301: Process control trainer II
Umang Gupta
 
Electrical power engineering test (2)
Electrical power engineering test (2)Electrical power engineering test (2)
Electrical power engineering test (2)
Mohamed Safwat
 
EEP301: Process control trainer
EEP301: Process control trainerEEP301: Process control trainer
EEP301: Process control trainer
Umang Gupta
 
Electrical power engineering test (1)
Electrical power engineering test (1)Electrical power engineering test (1)
Electrical power engineering test (1)
Mohamed Safwat
 
Solución al ejercicio 2
Solución al ejercicio 2Solución al ejercicio 2
Solución al ejercicio 2
Jesthiger Cohil
 
WC-10-XZL(R)
WC-10-XZL(R)WC-10-XZL(R)
WC-10-XZL(R)
Eong Huat Corporation
 
Build your 1st robot arm controlled by arduino
Build your 1st robot arm controlled by arduinoBuild your 1st robot arm controlled by arduino
Build your 1st robot arm controlled by arduino
Mohamed Okasha
 
Modeling and Roll, Pitch and Yaw Simulation of Quadrotor.
Modeling and Roll, Pitch and Yaw Simulation of Quadrotor.Modeling and Roll, Pitch and Yaw Simulation of Quadrotor.
Modeling and Roll, Pitch and Yaw Simulation of Quadrotor.
Oka Danil
 
Energy for telecommunications systems - Wimax Systems, Presentation - Introdu...
Energy for telecommunications systems - Wimax Systems, Presentation - Introdu...Energy for telecommunications systems - Wimax Systems, Presentation - Introdu...
Energy for telecommunications systems - Wimax Systems, Presentation - Introdu...
Mario B.
 
EEP301: Analog control of DC motor
EEP301: Analog control of DC motorEEP301: Analog control of DC motor
EEP301: Analog control of DC motor
Umang Gupta
 
Ref protn ct sample calculation
Ref protn ct   sample calculationRef protn ct   sample calculation
Ref protn ct sample calculation
LANOGWA RODGERS
 
Rotating Magnetic Field in a Three-Phase AC Motor
Rotating Magnetic Field in a Three-Phase AC MotorRotating Magnetic Field in a Three-Phase AC Motor
Rotating Magnetic Field in a Three-Phase AC Motor
balaganesh boomiraja
 
Tutorial 8
Tutorial 8Tutorial 8
EEP301: Ac position control
EEP301: Ac position controlEEP301: Ac position control
EEP301: Ac position control
Umang Gupta
 
Ejercicio dos
Ejercicio dosEjercicio dos
Ejercicio dos
nickjeorly
 
Ac machines: Rotating Magnetic Field and its production
Ac machines: Rotating Magnetic Field and its productionAc machines: Rotating Magnetic Field and its production
Ac machines: Rotating Magnetic Field and its production
nishtha97
 
Quadcopter
QuadcopterQuadcopter
Quadcopter
Manoj Chowdary
 
Magnetic tracking --- talking from Magic Leap One
Magnetic tracking --- talking from Magic Leap OneMagnetic tracking --- talking from Magic Leap One
Magnetic tracking --- talking from Magic Leap One
James D.B. Wang, PhD
 
Engineering Calculation Table 2016
Engineering Calculation Table 2016Engineering Calculation Table 2016
Engineering Calculation Table 2016
Fredrick Kendrick
 
Final Year Project Presentation
Final Year Project PresentationFinal Year Project Presentation
Final Year Project Presentation
farhan_naseer_1
 

What's hot (20)

EEP301: Process control trainer II
EEP301: Process control trainer IIEEP301: Process control trainer II
EEP301: Process control trainer II
 
Electrical power engineering test (2)
Electrical power engineering test (2)Electrical power engineering test (2)
Electrical power engineering test (2)
 
EEP301: Process control trainer
EEP301: Process control trainerEEP301: Process control trainer
EEP301: Process control trainer
 
Electrical power engineering test (1)
Electrical power engineering test (1)Electrical power engineering test (1)
Electrical power engineering test (1)
 
Solución al ejercicio 2
Solución al ejercicio 2Solución al ejercicio 2
Solución al ejercicio 2
 
WC-10-XZL(R)
WC-10-XZL(R)WC-10-XZL(R)
WC-10-XZL(R)
 
Build your 1st robot arm controlled by arduino
Build your 1st robot arm controlled by arduinoBuild your 1st robot arm controlled by arduino
Build your 1st robot arm controlled by arduino
 
Modeling and Roll, Pitch and Yaw Simulation of Quadrotor.
Modeling and Roll, Pitch and Yaw Simulation of Quadrotor.Modeling and Roll, Pitch and Yaw Simulation of Quadrotor.
Modeling and Roll, Pitch and Yaw Simulation of Quadrotor.
 
Energy for telecommunications systems - Wimax Systems, Presentation - Introdu...
Energy for telecommunications systems - Wimax Systems, Presentation - Introdu...Energy for telecommunications systems - Wimax Systems, Presentation - Introdu...
Energy for telecommunications systems - Wimax Systems, Presentation - Introdu...
 
EEP301: Analog control of DC motor
EEP301: Analog control of DC motorEEP301: Analog control of DC motor
EEP301: Analog control of DC motor
 
Ref protn ct sample calculation
Ref protn ct   sample calculationRef protn ct   sample calculation
Ref protn ct sample calculation
 
Rotating Magnetic Field in a Three-Phase AC Motor
Rotating Magnetic Field in a Three-Phase AC MotorRotating Magnetic Field in a Three-Phase AC Motor
Rotating Magnetic Field in a Three-Phase AC Motor
 
Tutorial 8
Tutorial 8Tutorial 8
Tutorial 8
 
EEP301: Ac position control
EEP301: Ac position controlEEP301: Ac position control
EEP301: Ac position control
 
Ejercicio dos
Ejercicio dosEjercicio dos
Ejercicio dos
 
Ac machines: Rotating Magnetic Field and its production
Ac machines: Rotating Magnetic Field and its productionAc machines: Rotating Magnetic Field and its production
Ac machines: Rotating Magnetic Field and its production
 
Quadcopter
QuadcopterQuadcopter
Quadcopter
 
Magnetic tracking --- talking from Magic Leap One
Magnetic tracking --- talking from Magic Leap OneMagnetic tracking --- talking from Magic Leap One
Magnetic tracking --- talking from Magic Leap One
 
Engineering Calculation Table 2016
Engineering Calculation Table 2016Engineering Calculation Table 2016
Engineering Calculation Table 2016
 
Final Year Project Presentation
Final Year Project PresentationFinal Year Project Presentation
Final Year Project Presentation
 

Similar to TWIP Control

CIRCLE DIAGRAM ON 1-PHASE INDUCTION MOTOR
CIRCLE DIAGRAM ON 1-PHASE INDUCTION MOTORCIRCLE DIAGRAM ON 1-PHASE INDUCTION MOTOR
CIRCLE DIAGRAM ON 1-PHASE INDUCTION MOTOR
suresh shindhe
 
Speed Control of Synchronous Motor
Speed Control of Synchronous Motor Speed Control of Synchronous Motor
Speed Control of Synchronous Motor
Ashutosh Jha
 
Accelerometer 1
Accelerometer 1Accelerometer 1
Accelerometer 1
Er Sumit Balguvhar
 
Lab 2 Report More Linear Operational Amplifiers
Lab 2 Report More Linear Operational AmplifiersLab 2 Report More Linear Operational Amplifiers
Lab 2 Report More Linear Operational Amplifiers
Katrina Little
 
Third Freshers\' Workshop 2011
Third Freshers\'  Workshop 2011Third Freshers\'  Workshop 2011
Third Freshers\' Workshop 2011
Aditya Agarwal
 
Design and Implementation of Schmitt Trigger using Operational Amplifier
Design and Implementation of Schmitt Trigger using Operational AmplifierDesign and Implementation of Schmitt Trigger using Operational Amplifier
Design and Implementation of Schmitt Trigger using Operational Amplifier
IJERA Editor
 
Oscillography analysis
Oscillography analysisOscillography analysis
Oscillography analysis
michaeljmack
 
PDR Robotic Replacement of Solar Collector Panels.pptx
PDR Robotic Replacement of Solar Collector Panels.pptxPDR Robotic Replacement of Solar Collector Panels.pptx
PDR Robotic Replacement of Solar Collector Panels.pptx
CanGVEN7
 
Attitude Control of Satellite Test Setup Using Reaction Wheels
Attitude Control of Satellite Test Setup Using Reaction WheelsAttitude Control of Satellite Test Setup Using Reaction Wheels
Attitude Control of Satellite Test Setup Using Reaction Wheels
A. Bilal Özcan
 
Fq3510001006
Fq3510001006Fq3510001006
Fq3510001006
IJERA Editor
 
07
0707
Ppt (2)
Ppt (2)Ppt (2)
Ppt (2)
sayamarnath
 
Ppt (2)
Ppt (2)Ppt (2)
Ppt (2)
sayamarnath
 
ELEN601_Project
ELEN601_ProjectELEN601_Project
ELEN601_Project
Teja Adike
 
Motorized pan tilt(Arduino based)
Motorized pan tilt(Arduino based)Motorized pan tilt(Arduino based)
Motorized pan tilt(Arduino based)
kane111
 
Servo 2.0
Servo 2.0Servo 2.0
pwm for speed control
pwm for speed controlpwm for speed control
pwm for speed control
kaushal gadariya
 
Light intensity/incident angle measurement.pptx
Light intensity/incident angle measurement.pptxLight intensity/incident angle measurement.pptx
Light intensity/incident angle measurement.pptx
RAHITNATH
 
Design Calculation of Three Phase Self Excited Induction Generator Driven by ...
Design Calculation of Three Phase Self Excited Induction Generator Driven by ...Design Calculation of Three Phase Self Excited Induction Generator Driven by ...
Design Calculation of Three Phase Self Excited Induction Generator Driven by ...
ijtsrd
 
Unity power factor control by pwm rectifier
Unity power factor control by pwm rectifierUnity power factor control by pwm rectifier
Unity power factor control by pwm rectifier
eSAT Journals
 

Similar to TWIP Control (20)

CIRCLE DIAGRAM ON 1-PHASE INDUCTION MOTOR
CIRCLE DIAGRAM ON 1-PHASE INDUCTION MOTORCIRCLE DIAGRAM ON 1-PHASE INDUCTION MOTOR
CIRCLE DIAGRAM ON 1-PHASE INDUCTION MOTOR
 
Speed Control of Synchronous Motor
Speed Control of Synchronous Motor Speed Control of Synchronous Motor
Speed Control of Synchronous Motor
 
Accelerometer 1
Accelerometer 1Accelerometer 1
Accelerometer 1
 
Lab 2 Report More Linear Operational Amplifiers
Lab 2 Report More Linear Operational AmplifiersLab 2 Report More Linear Operational Amplifiers
Lab 2 Report More Linear Operational Amplifiers
 
Third Freshers\' Workshop 2011
Third Freshers\'  Workshop 2011Third Freshers\'  Workshop 2011
Third Freshers\' Workshop 2011
 
Design and Implementation of Schmitt Trigger using Operational Amplifier
Design and Implementation of Schmitt Trigger using Operational AmplifierDesign and Implementation of Schmitt Trigger using Operational Amplifier
Design and Implementation of Schmitt Trigger using Operational Amplifier
 
Oscillography analysis
Oscillography analysisOscillography analysis
Oscillography analysis
 
PDR Robotic Replacement of Solar Collector Panels.pptx
PDR Robotic Replacement of Solar Collector Panels.pptxPDR Robotic Replacement of Solar Collector Panels.pptx
PDR Robotic Replacement of Solar Collector Panels.pptx
 
Attitude Control of Satellite Test Setup Using Reaction Wheels
Attitude Control of Satellite Test Setup Using Reaction WheelsAttitude Control of Satellite Test Setup Using Reaction Wheels
Attitude Control of Satellite Test Setup Using Reaction Wheels
 
Fq3510001006
Fq3510001006Fq3510001006
Fq3510001006
 
07
0707
07
 
Ppt (2)
Ppt (2)Ppt (2)
Ppt (2)
 
Ppt (2)
Ppt (2)Ppt (2)
Ppt (2)
 
ELEN601_Project
ELEN601_ProjectELEN601_Project
ELEN601_Project
 
Motorized pan tilt(Arduino based)
Motorized pan tilt(Arduino based)Motorized pan tilt(Arduino based)
Motorized pan tilt(Arduino based)
 
Servo 2.0
Servo 2.0Servo 2.0
Servo 2.0
 
pwm for speed control
pwm for speed controlpwm for speed control
pwm for speed control
 
Light intensity/incident angle measurement.pptx
Light intensity/incident angle measurement.pptxLight intensity/incident angle measurement.pptx
Light intensity/incident angle measurement.pptx
 
Design Calculation of Three Phase Self Excited Induction Generator Driven by ...
Design Calculation of Three Phase Self Excited Induction Generator Driven by ...Design Calculation of Three Phase Self Excited Induction Generator Driven by ...
Design Calculation of Three Phase Self Excited Induction Generator Driven by ...
 
Unity power factor control by pwm rectifier
Unity power factor control by pwm rectifierUnity power factor control by pwm rectifier
Unity power factor control by pwm rectifier
 

TWIP Control

  • 1. Two Wheel Inverted Pendulum Control Hongtao Gu
  • 2. 1. Introduction Segway is a commercial application of the inverted pendulum. https://www.groupon.com/deals/segway-of-richmond-8
  • 3. 2. Approach  1. Model Based Controller Mathematical Model (State Space) Feedback Gain 𝑥 ሶ𝑥 𝜃 ሶ𝜃 State Space Equation: ሶ𝑥 = 𝐴𝑥 + 𝐵 𝑦 = 𝐶𝑥 + 𝐷 0 1 0 0 0 −0.006844 16.6194 0 0 0 0 1 0 −0.00053 234.8387 0 A= 0 161.0343 0 1248.9 B= 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 C= 0 0 0 0 D= [−31.6228 −92.1359 141.9806 11.9917]K=
  • 4. 2. Approach  2. Error Based Controller Physical Model PID Error= target 𝜃 – actual 𝜃
  • 5. 3. Implementation  For balancing the system, 4 states value should be read by the controller.  Accelerometer will output different voltage with respect to different acceleration.  Encoder will read the rotational speed voltage signal.  Labview will convert the voltage signal to the physical signal.  Labview will also add a feedback gain on the 4 states. Physical Model Arduino Uno Accelerometer Encoder DC Motor
  • 6. ADXL335 3-axis accelerometer Output Range -3~3 g Nonlinearity -0.3~0.3% SENSITIVITY 300 (270~ 330)mV/g Magnetic Encoder Channel A, B Pulse/Rev 3 Pulses/Channel 4. Hardware Arduino Uno Digital I/O 14 Pins Analog Input 6 Pins AI Resolution 10 bits Clock Speed 16MHz
  • 7. 4. Read Angle and Angular Velocity  Angle and Angular Velocity Z Y 𝜽  Sensor Calibration Read the two voltage signal when Z axis is same or opposite direction with gravity to get sensitivity. Z 1/m +1g -1g Delta_V Sensitivity z 1.308594 1.962891 0.654297 327.1485 y 1.264648 1.914062 0.649414 324.707 Read the voltage signal when Z axis is horizontal to compensate the 0 gravity. b 0-g y 1584.66 z 1613.57 𝜃 = atan( 𝑧 𝑦 ) Angular Velocity Averaging 4000 Hz 20 Samples y=m*x+b
  • 8. 5. Read Encoder  Motor RPM 3 pulses per revolution DC Motor Max Output RPM 200 RPM Gear Ratio 150:1  Encoder Pulses/s at maximum motor speed: = 200 RPM * Gear Ratio* 3 pulses/Rev= 1500 pulses/s Sampling Frequency >= 2 * 1500 Pulses/s = 3000 Hz The max Fs is 5000 Hz for Arduino, so 4000 Hz frequency is used. 𝑅𝑃𝑆 = σ 𝑅𝑖𝑠𝑖𝑛𝑔 𝐸𝑑𝑔𝑒 𝑆𝑎𝑚𝑝𝑙𝑖𝑛𝑔 𝑡𝑖𝑚𝑒 Displacement = σ (Rotation Speed ∗ Loop Time)
  • 10. Reference [1] ADXL335:https://www.sparkfun.com/datasheets/Components/SMD/adxl335.pdf [2] Magnetic Encoder: https://www.pololu.com/product/3081 [3] Arduino Uno: https://www.arduino.cc/en/Main/ArduinoBoardUno [4] Bageant/Massachusetts Institute of Technology, M. R. (2011). DSpace@MIT: Balancing a two- wheeled Segway robot. Retrieved from https://dspace.mit.edu/handle/1721.1/69500 [5] Khaled/Technische Universitat Munchen, M. (2009, July). Balancing a Two Wheeled Robot (PDF Download Available). Retrieved from http://www.researchgate.net/publication/252629451