Pendulo invertido

Solo disponible en BuenasTareas
  • Páginas : 22 (5253 palabras )
  • Descarga(s) : 0
  • Publicado : 26 de abril de 2011
Leer documento completo
Vista previa del texto
Software PID Control of an Inverted Pendulum Using the PIC16F684
Author: John Charais Ruan Lourens Microchip Technology Inc.

The purpose of this application note is to describe how a PIC16F684 can be used to implement a positional Proportional-Integral-Derivative (PID) feedback control in an inherently unstable system. An inverted pendulum is used to demonstrate this typeof control. The inverted pendulum consists of three main parts: the base platform, the pendulum and the controller board, as shown in Figure 1.



 2004 Microchip Technology Inc.

DS00964A-page 1

The base platform is a 3-point platform, 2 wheels (one of which is geared and attached to a DC motor) and an audio jack. When the DC motoris turned on, the base platform will rotate around in a circle with the center of the axis of rotation being the audio jack. The audio jack serves 2 purposes; first it is used as the axis of rotation for the base platform and second, it is used to bring commutated power to the controller board.



The pendulum is attached to the base platform by a 360° free rotatingpotentiometer. The pendulum’s base is attached to the potentiometer in such a fashion that when the pendulum is balanced (completely vertical), the potentiometer center tap is biased to VREF/2. For the rest of this application note Θ will be used to denote the displacement angle of the pendulum with respect to the vertical axis.


DS00964A-page 2 2004 Microchip Technology Inc.

The controller board has 2 main functions, to measure Θ and to drive the DC motor. The power supply needed to run the system is dictated by the selection of the motor. The motor is controlled by an H-bridge which is driven by the PIC16F684 Enhanced Capture/Compare/ PWM Module (ECCP). The outputs of the ECCP are connected to FET drivers that produce theproper drive voltages and reduce the transition times for the FETs in the H-bridge. There are 5 potentiometers located on the controller board, 3 of which are used for adjusting the PID constants (KP, KI and KD) and one to measure Θ. The fifth potentiometer is used in conjunction with the input filter’s reference. The input filter is a low-pass Bessel filter with a cut-off frequency of 60 Hz andhas a voltage gain of 6. A low-pass filter is needed to eliminate any high frequency noise on the angle measurement which the derivative term of the PID controller is extremely sensitive to. The Bessel filter is used because it has the best response to a step function. (Once the pendulum is balanced, a sudden displacement that causes it to become unbalanced will look like a step function.) Thecut-off frequency was chosen to be at least twice the expected frequency of the pendulum. The gain of the filter was chosen to increase the resolution of the Analog-to-Digital (A/D) converter. With the 360° potentiometer and a 10-bit A/D converter, with no gain, one LSb equals 0.35°. With the gain set to 6, the displacement angle is limited to ±30° which gives a resolution of 0.059° per LSb. The fifthpotentiometer controls the input filter’s reference to produce a true 0° displacement angle when the pendulum is vertical. Without this potentiometer, any slight offset angle will cause the base to slowly increase its speed and eventually take the system into an unstable state. For more information on the controller board, see the schematics in Appendix A: “Schematics”. The desired set point R(t)of this system occurs when Θ = 0°. In this state, the pendulum is balanced. Since the desired response of the system is 0°, any angle measured other than 0° is the error or Y(t) = E(t). In implementing the PID controller, there are 3 terms which are based off the error measurement. Proportional Term: KPE(t) – where KP is the proportional constant Integral Term: KI ∫ E(t)dt – KI is the integral...
tracking img