Fast and Spurious
Please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.mit.edu) to authenticate, and then you will be redirected back to this page.
Quick Reference
Serial Plotter Send Window Indices
Links
Task Summary
- FIND A PARTNER.
- Install Software.
- Build, Test, and Calibrate the Speed Control System (checkoff 1).
- Determine the roles of
TICKSPERUPDATE
, KFF, KP, REPEATS, FREQ, and AMP, andDisturbA
(checkoff 2).
- Extract coefficients from data for a 1st-order difference equation model.
- Use model to inter-relate gains, update period, and stability. Compare with experiments (checkoff 3).
- Investigate how gains effect tracking error and disturbance rejection, design controller (checkoff 4).
- Collect experimental data for the postlab (as screenshots) (Checkoff 5)
Safety First
Please read the EECS Lab Safety instructions.
- We will be building and debugging electrical systems. While everything we do in this subject is low-voltage, you should never modify or even touch a circuit without turning off its power.
- We will be using small but very high speed motors. If our systems go unstable, parts can fly off in any direction. Please wear safety goggles when using the high-speed motors with spinning propellers.
Fast and Spurious
The goal of this lab is to control the speed of a motor-driven rotor, while learning about
- Control system modeling,
- Feedback and Stability,
- Sample Rate Effects,
- Steady-state and Dynamic Tracking,
- Insensitivity to Disturbances and uncertainty,
As you will see, the issues associated with control will be obvious and direct, but the issues associated with modeling will be both pervasive and, unfortunately, subtle.
After constructing and testing the speed control system, you will collect data from which to calibrate a first-order difference equation model for the relationship between the Teensy-sketch-generated motor command and the measured rotor speed. You will then use this model to make reasonably good predictions about the interactions between sample rates, controller gains, stability, tracking errors, and disturbance insensitivity.
Then, in preparation for the post-lab, you will collect another data set, one specifically designed to expose inaccuracies in the first-order model. As part of the post-lab, you will derive, calibrate, and analyze an improved second-order model, and see if its predictions are better (spoiler alert, sometimes they are).
The take-away about modeling from this lab and post-lab is NOT (we repeat, NOT) that one model is good and the other is bad. As you will see in lab, a first-order model is accurate enough (and simple enough) to answer questions about the interaction between sample rate and stability, or feedback gain and disturbance rejection. But as you will see in the postlab, you'll need a second order model to accurately predict the stability limits on gain, or to predict waveforms near the stability limit.
So, The take-away from this lab and postlab about modeling? A good model is usually the simplest model that correctly answers your questions.
We use the Arduino IDE 2.0 software (with modifications and a 6.310 specific library) to communicate with, program, and plot results from our 6.310 controller board (based on the Teensy 4.1 microcontroller). Throughout the term, you will be using this software-board combination, along with lab-specific hardware, to design and experiment with algorithms that control rotor speed, rotating arm position, and even magnetic levitation.
For the first checkoff please:
Demonstrate your working and calibrated speed control system
As the above abstract block diagram suggests, controlling the rotation speed of a spinning object requires three interconnected functions. Foremost of the three is an actuator that can be commanded to either accelerate or decelerate the object. Second, one needs a sensor to verify the object's speed. And thirdly, the focus of much of this class, one must design a controller that can determine effective actuator commands given the desired and measured speeds of the object.
As you may have noticed when testing your speed-controlled rotor system, there is a nominal speed of 15 rotations/second (or 15RPS), and an associated nominal actuator command. All the other speeds and commands are offsets to these nominal values, so our system is more precisely described by the abstract diagram below. We formulated our speed control problem in terms of perturbations from nominal values partly because it is a natural fit to the common control problem, maintaining constant speed (think automobile cruise control). But more importantly for our purposes, relationships between perturbations are likely to be more linear, and therefore more easily modeled. And good models, as we shall see thoughout the term, are essential precursers to designing good controllers.
Below is a functional block diagram of our speed control system, based on its physical structures. What should be immediately clear is that the functional block diagram looks nothing like the abstract block diagrams above. For example, is the motor the actuator? Or is it the motor plus the H-Bridge drivers? Also, the combination of the white eight-bladed rotor and the optical sensor does not produce rotation speed, it produces a signal from which the speed can be deduced. So does the combination really form the sensor in our abstract model?
Whether the problem is software or hardware or some combination of the two, finding a good abstract model is often the central challenge in any engineering design. As we noted in the introduction, a good model has enough detail to accurately assess design tradeoffs, yet is simple enough to reveal alternative strategies. But, how does one find a model good enough to answer one's questions, if one needs the model to determine what questions to ask? And how does one find a model that reveals strategies one does not yet know?
Modeling, it is impossible to teach, but fortunately, not impossible to learn.
In the case of our speed control system, we can extract an abstract model like the one in section 3.1, provided we ignore the structural boundaries. The speed sensor is a combination of the rotor, the optical sensor, and the function getSpeed
in the Teensy sketch (which converts the time between falling edges in the optical sensor output into speed estimates, see the next section). The actuator in the abstract diagram is a combination of the function hbridgeBipolar
in the Teensy sketch (which converts a motor command into a pulse-width-modulated signal), the h-bridge driver, and the motor connected to the white rotor.
We summarize the connection between abstract model and structural implementation in the figure below.
As we can see from the figure in the previous subsection, there is a small part of the Teensy sketch that corresponds to the speed-controller block in the abstract block diagram. The actuator command, motorCmd
in the sketch, is computed from the nominal command, nomCmd
in the sketch, the desired perturbation in rotor speed, omega_d
in the sketch, and the measured perturbation in motor speed, omega
in the sketch. To make the meaning of omega
and omega_d
clearer, consider the example plot below. The plot was generated by running the speed control system in control mode (MODE 1), with omega_d
set to be a unit amplitude square wave, the controller gain Kff
set to 0.025, and the square wave frequency set to \frac{1}{25}.
Below we show an incomplete block diagram for the controller, showing how the motor command is computed from the desired and measured rotational speeds, as well as the nominal command (which is just added in). The block diagram shows how K_p, the proportional feedback gain, effects the motor command, but does not show the effect of K_{ff}. Be prepared to show how to add K_{ff} to the block diagram at checkoff.
The optical sensor generates a pulse every time a white encoder blade passes underneath it. More specifically, the propeller reflects the infrared light from the led on one side of the sensor to the optotransistor on the other side of the sensor, and when bombarded with infrared light, the optotransistor turns "on". The "on" transistor effectively "pulls-up" the IN5 input on the 6.310 controller board, increasing the voltage from close to zero to nearly three volts. Once the propeller blade passes out from under the sensor, the optotransistor turns "off", the IN5 voltage is pulled back down to zero by a resistor ground (see the schematic in the assembly guide).
The negative change in the voltage on IN5 "interrupts" the microcontroller, which determines the time since the last negative change, and computes the rotational speed.
The signal generated by the optical sensor circuit is plotted below (notice the y-axis is normalized, so that 1000 corresponds to three volts), along with a diagram showing when interrupts are triggered on the Teensy 4.1, as well as when a control loop (which updates the motor command) executes. As the diagram should make clear, interrupts are generated every time a propeller blade passes under the optical sensor (eight times per rotation for our eight-bladed rotor), but the control loop only runs every m^{th} interrupt, where m is the setting of ticksperupdate. Note that when ticksperupdate is zero, m is set to the maximum value of 8.
Demonstrate a working controller
STOP HERE FOR THE FIRST WEEK!!!!
Recall that when calibrating the speed control setup, we adjusted the potentiometer to find a constant motor command, C_0 (nomCmd in the Teensy sketch), that produces the desired steady-state rotational speed, \Omega_0 (Omega0 in the sketch). Then, using lower case letters to denote perturbations from from these steady-state values,
omega
in the sketch) is the perturbation in measured rotational speed and \omega_d[n] (corresponding to omega_d
in the sketch) is the desired perturbation in rotational speed.
Using a first-order difference equation model, we can relate perturbations in motor command to perturbations in rotational speed
One way to generate responses from which to calibrate the linearized model is to use the AMP index in the send window to set the maximum value of omega_d
to a few percent of the nominal speed, then use the KFF index to set K_{ff} so that omega
reaches a steady-state that matches omega_d
(once you set the input frequency low enough using the send window and the FREQ index).
For the above senario, and in steady-state, \omega[n] = \omega[n-1]= \omega_d[n]. Since
You can derive a second relation involving \beta and \gamma by examining the immediate (rather than steady-state) behavior of the perturbed rotational velocity, \omega[n], in response to the step changes in \omega_d[n]. And the analysis of \omega[n] dynamic behavior will simplify if you exploit the fact that the system is linear, and that both \omega and \omega_d are in steady-state before the step change.
Notice that there are two coefficients to estimate (\beta and \gamma), and two types of information in the step responses, how fast the measured speed changes and its steady-state value.
In the next checkoff, you can test your model to see if you can predict the stability properties when you use feedback control.
Determine \gamma and \beta for your system.
If you set the K_{ff} to zero, and set the K_p to a nonzero value, the c[n] for your system becomes,
Then use the TICKSPERUPDATE index in the send window to set the ticksperupdate to 4, then 2 and then 1. How will you change \Delta T in your difference equation model to reflect the changes? For each value of ticksperupdate, find the value of K_p for which the system is stable, and see if your experiments match your updated models.
Now set the DisturbA value to 0.5 (on line 14 of the Teensy sketch), and repeat the above experiments. How does the disturbance response change with increasing K_p? Can you use your model to predict how the disturbance response should change with K_p (hint, if you use a very low input frequency, the disturbance response will achieve steady-state, simplifying the analysis).
Be ready to show us both steady-state errors and disturbance rejection, and you should be able to use the difference equation model, and its natural frequencies as a function of K_p , to explain the disturbance rejection and stability.
Set ticksperupdate back to 8 (or 0), set DisturbA back to zero, pick the same frequency and amplitude for the input as you used in the model calibration, and examine the step response for values of K_p that are close to the stability limit. Then use the send window with the REPEATS index and a value of 3, to force the plotter to plots each point four times. These repeated plots will createa flat section for each sample, and make it easier to see the number of samples per period when there are oscillations. Look closely at step responses that oscillate before settling, could they be produced by a first order system? You should take screen shots of your results, you will need them for the postlab.
Then try setting ticksperestimate (NOT ticksperupdate!!) to 1 using the send window with the TICKSPERESTIMATE index, and increase K_p until the step response is almost unstable. Then try setting ticksperestimate to 2, then 3, and then 4. You should take screen shots of your results, you will need them for the postlab.
Something is not right, but the effect is subtle. Get the checkoff to get some some hints.