Page 789 - Mechatronics with Experiments
P. 789

LABORATORY EXPERIMENTS  775
                                  integrator op-amp, and sketch (or take a digital picture of the oscilloscope screen) the
                                  input and output waveforms.
                                8. Connect the oscilloscope channel 1 to the input signal of the op-amp (output of the
                                  differential op-amp), and oscilloscope channel 2 to the output of the summing op-amp
                                  (which is the output of the PID controller circuit), sketch (or take a digital picture
                                  of the oscilloscope screen) the input and output waveforms. Confirm that the output
                                  voltage of the summing op-amp is the sum of the voltages from the P-I-D sections of
                                  the circuits (voltage outputs from P, I, and D circuits) multiplied with −1.
                                9. (Optional) Repeat the above 10-result test with the modified derivative (R is in the
                                                                                             1
                                  circuit) and the modified integral term (R is in the circuit). Note that the values of the
                                                                  4
                                  added R and R ’s affect the performance of the PID controller and must be selected
                                         1
                                               4
                                  properly for the intended performance.
                               10. (Optional) Repeat the above 10-result test with the modified derivative (R is in the
                                                                                             1
                                  circuit) and the modified integral term (R is in the circuit). Except that in this case,
                                                                   4
                                  select a poor value for R on purpose so that the circuit is not a good approximation
                                                      4
                                  to the integral function circuit.
                               11. (Optional) Closed loop control test: build a mathematical model of the PID circuit
                                                ®
                                                           ®
                                  (using MATLAB or Simulink ) and simulate for the same circuit parameters and
                                  input signal conditions, and compare your simulation results with the experiments.
                                  Comment on the causes of the differences between simulation and experimental
                                  results.
                               12. (Optional) Build a second-order system, that is double integrator (mass-force anal-
                                  ogy), circuit to “simulate” the plant dynamics. Simply connect two integrators in
                                  series. Then connect the output of the PID controller circuit to the input of the
                                  double-integrator (plant), and the output of the double integrator into the negative
                                  port of the PID’s comparator circuit at the input (Figures 2.35 and 2.36 in the text-
                                  book). Using a potentiometer, generate the desired (commanded) output voltage.
                                                                               ®
                                  Simulate the whole system in MATLAB ®  or Simulink .Testthesamesimulated
                                  conditions on the actual circuit and compare the closed loop system response results
                                  (simulation results and hardware test results). Digital implementation of the PID con-
                                  troller in real-time is given by Equations 2.42–2.44 in the textbook. If the sampling
                                  period T is fast relative to the bandwidth of the system, the digital implementation
                                  should give almost identical results to the analog implementation. The difference
                                  between digital and analog implementation can be tested in simulation only using
                                          ®
                                                    ®
                                  MATLAB /Simulink without any hardware involvement, in that we should be able
                                  to confirm a selection of a sampling period that is fast enough that the difference
                                  between analog and digital implementation of the PID controller is insignificant. In
                                  the simulation, we can also include the quantization errors due to finite word-length
                                  (finite resolution) of the ADC and DAC converters. Equations 2.42 and 2.44 do not
                                  include the effect of the quantization errors introduced by DAC and ADC.


                      11.7 EXPERIMENT 7: LED CONTROL USING
                              THE PIC MICROCONTROLLER

                             Objectives
                                1. Learn to use the integrated development environment (IDE) software and PIC micro-
                                  controller development board.
                                2. Learn basic hardware interface between a microcontroller, digital input devices (DIP
                                  switches in this case), and digital output devices (LEDs in this case).
   784   785   786   787   788   789   790   791   792   793   794