damped_compound_pendulum
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
damped_compound_pendulum [2018/10/17 16:26] – [LEGO DCP] sangsinpark | damped_compound_pendulum [2018/10/17 17:14] (current) – [Damped Compound Pendulum (DCP)] sangsinpark | ||
---|---|---|---|
Line 3: | Line 3: | ||
**Author:** Sangsin Park Email: < | **Author:** Sangsin Park Email: < | ||
\\ | \\ | ||
- | **Date:** Last modified on <10/16/18> | + | **Date:** Last modified on <10/17/18> |
\\ | \\ | ||
**Keywords: | **Keywords: | ||
Line 195: | Line 195: | ||
=== LabVIEW block diagram for PID control === | === LabVIEW block diagram for PID control === | ||
A LabVIEW program, which is similar to the before LabVIEW code, is employed to control the LEGO DCP at a control frequency of 40Hz. The P, I, and D gain are 0.05, 0.8, and 0.05, respectively. | A LabVIEW program, which is similar to the before LabVIEW code, is employed to control the LEGO DCP at a control frequency of 40Hz. The P, I, and D gain are 0.05, 0.8, and 0.05, respectively. | ||
+ | |||
+ | Here is the LabVIEW file. {{dcp: | ||
+ | |||
{{ dcp: | {{ dcp: | ||
In addition, here is the front panel of the LabVIEW program. | In addition, here is the front panel of the LabVIEW program. | ||
Line 201: | Line 204: | ||
A breakdown of the LabVIEW block diagram is shown as follows. | A breakdown of the LabVIEW block diagram is shown as follows. | ||
- | == Initialize an angle sensor | + | 1. Initialize an angle sensor |
{{ dcp: | {{ dcp: | ||
Before while loop, reset angle sensor and wait until its angle is within 1 degree. | Before while loop, reset angle sensor and wait until its angle is within 1 degree. | ||
- | == Read angle == | + | 2. Read angle |
{{ dcp: | {{ dcp: | ||
An angle from the angle sensor is measured in the range 0 to 359 degrees with 1-degree accuracy. To display angle in the range -180 to 180, when the angle is greater than 180, subtract 360 from that. Moreover, to avoid getting mixed up with wires, I assign a local variable for the Angle. | An angle from the angle sensor is measured in the range 0 to 359 degrees with 1-degree accuracy. To display angle in the range -180 to 180, when the angle is greater than 180, subtract 360 from that. Moreover, to avoid getting mixed up with wires, I assign a local variable for the Angle. | ||
- | == PID controller | + | 3. PID controller |
{{ dcp: | {{ dcp: | ||
If a control frequency is changed, a value of dt also needs to be changed to a value of 1/ | If a control frequency is changed, a value of dt also needs to be changed to a value of 1/ | ||
- | == Convert angle to motor power == | + | 4. Convert angle to motor power |
{{ dcp: | {{ dcp: | ||
- | A constant of 68.98519 is a proportional gain to convert from angle to motor power and another constant of 10 is bias for dead-zone. Those constants can be determined by curve-fitting (see the Modeling section). | + | A constant of 68.98519 is a proportional gain to convert from angle to motor power and another constant of 10 is bias for dead-zone. Those constants can be determined by curve-fitting (see the **Modeling** section). |
- | == Input motor power == | + | 5. Input motor power |
{{ dcp: | {{ dcp: | ||
For safety and to limit motor rotation to a single direction, a motor power is constrained by in the range of 0 to 100. | For safety and to limit motor rotation to a single direction, a motor power is constrained by in the range of 0 to 100. | ||
- | == Save time and angle == | + | ** NB: If motor terminals are hooked up to an oscilloscope, |
+ | |||
+ | 6. Save time and angle | ||
{{ dcp: | {{ dcp: | ||
To calculate experiment time, read a current time before while loop, and then subtract the time from a time updated in while loop. Lastly, two local variables, Time and Angle, are written into a file after press a STOP button. | To calculate experiment time, read a current time before while loop, and then subtract the time from a time updated in while loop. Lastly, two local variables, Time and Angle, are written into a file after press a STOP button. | ||
Line 233: | Line 238: | ||
===== Final Words ===== | ===== Final Words ===== | ||
- | This tutorial' | + | This tutorial' |
\\ | \\ | ||
\\ | \\ | ||
For questions, clarifications, | For questions, clarifications, | ||
damped_compound_pendulum.1539818760.txt.gz · Last modified: 2018/10/17 16:26 by sangsinpark