Professional Documents
Culture Documents
PENDULUM
The pendulum is attached to the base platform by a
360° free rotating potentiometer. 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.
CONTROLLER BOARD
Feedback EQUATION 4:
C(n) = KPE(n) + KITs Σ E(n) + KD[E(n)- E(n-1)]/Ts
N
R(t) = Reference of desired set point
0
Y(t) = Measured response
E(t) = Error OR
N
Reset of
Reset TMR0
PIC16F684
Yes No
Calculate
Integral Term Error to Yes Clear PID
small? Loop Flag
Set PWM DC
& direction
Shift errors
clear PID flag
DS00964A-page 8
100 nF RA4/OSC2 RA1/AN1 ICSPCLK
AN964
4 11
APPENDIX A:
PIC16F684/P
+15V +15V
C1 C8
SCHEMATICS
100 nF 100 nF
+15V +15V
C3 C4
8 7 Q1:A 10 pF 10 pF Q2:A 7 8
IRF7389 IRF7389 U2:B
4 5 2 1 2 4
P1B 2 5 P1D
U1:B
R2 TC4428A TC4428A R4
1 J1 1
100 kΩ 100 kΩ
Note 1: Unless otherwise specified, resistance values are in Ω. Resistors are 5% tolerance. Capacitance values are in µF.
2: Device names and numbers shown here are for reference only and may differ from the actual number.
3: Items labeled with “A” are unpopulated, “B” are socketed but not populated, and “C” are socketed and populated.
R32
FIGURE 8:
+5V 10 kΩ
R16 S1
1 4
9.1 kΩ MCLR
C11 C13 2 3
0.1 µF
6.8 nF
+5V +5_SWITCHED
8
J2 2 U4:A TP3
4
3 MCP602SN C12 TP5 TP6
C10 MCP602SN
+5V 1 µF
BUTTON
0.1 µF
R17
150 kΩ
CW
3
Offset R9 2
10 kΩ In-Circuit Serial
+5V
1
CCW C14 Programming Header
CW
3
1 µF J3
R29 1 No Connect
R27 2 R18
P-POT
10 kΩ 100 Ω 150 kΩ 2
ICSPCLK
1
CCW C24 3
ICSPDATA
4
0.1 µF
5
+5_SWITCHED
6
+5V MCLR
CW BFMP
3
R30
R26 2
I-POT U8
10 kΩ 100 Ω
1
CCW C23 LM2940S
TP1 +15V
0.1 µF R8
1 Input Output 3 +5_SWITCHED
TP2 2Ω
+5V C19 C18 C17 C21
Gnd
Gnd
CW
2
4
470 µF 1 µF 22 µF 4.7 µF
3
R31
R28 2 +5V
D-POT R23
10 kΩ 100 Ω
1
CCW C22 2Ω C20
0.1 µF
4.7 µF
DS00964A-page 9
AN964
AN964
APPENDIX B: DERIVATION OF Using 2 unit vectors, i and j to represent the horizontal
and vertical vectors respectively, yields the following
EQUATION 5
equations for the pendulum.
The pendulum’s motion is described in this appendix
with one assumption. The assumption is that the EQUATION B-1:
pendulum is modeled as a point mass at the end of a
massless rod. Position = RsinΘi +RcosΘj
Where R is the length of the pendulum
FIGURE 9: PENDULUM FREE BODY
DIAGRAM
The pendulum’s angular velocity is the derivative of the
j position with respect to Θ.
EQUATION B-2:
Θ
i Velocity = RΘ’cosΘi – RΘ’sinΘj
mg
The pendulum’s angular acceleration is the derivative
T of the angular velocity w.r.t. Θ.
EQUATION B-3:
Acceleration = (RΘ”cosΘi – RΘ’2sinΘi) – (RΘ”sinΘj + RΘ’2cosΘj)
= R(Θ”cosΘi – Θ”sinΘj – Θ’2sinΘi – Θ’2cosΘj)
EQUATION B-4:
EQUATION B-5:
EQUATION B-6:
EQUATION B-9:
EQUATION B-10:
EQUATION B-11:
EQUATION B-12:
EQUATION B-13:
EQUATION B-15:
Θ” = (g/R)sinΘ
EQUATION B-16:
Θ” = (g/R)Θ
• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
10/20/04