In this lab, you will construct and control of a one-degree-of-freedom helicopter. A small drone motor is rigidly attached to the end of a lever-arm, the other end of which is attached to a low-torque potentiometer. The drone motor can lift the arm, and the angle of the arm is measured by the potentiometer. The user can select a target arm-angle and a PID controller will drive the arm to that angle.
The target and measured angle are displayed on the oscilloscope or the VGA screen and the user specifies new target angles through a serial interface to the RP2040.
Experience shows that students prefer these webpages short. For that reason, please find the reading and background materials on the webpages linked below. Please note that the information in these readings will be critical for completing the lab.
- Phenomenological introduction to PID controllers: This document focuses on building a phenomenological understanding of PID controllers through demos. The hope is that this document will help you debug your system based on the behavior that you observe in lab, and the one below will help you understand that behavior.
- Analytical introduction to PID controllers: This document focuses on building an analytical understanding of these controllers. The hope is that the phenomenological document will help you debug your system based on the behavior that you observe in lab, and this one will help you understand that behavior.
- Mechanical contruction of the lever arm: This webpage provides instructions for the mechanical construction of the lever arm.
- Motor circuit and PWM: This webpage describes the circuit that you will construct to safely drive the DC motor, and how to generate PWM.
- Angle sensing circuit: This webpage describes the potentiometer circuit that you will use to measure the arm's position, and how to setup/read the ADC.
- Data display: This webpage describes the data that you must visualize in realtime, and some strategies for visualizing that data.
- RP2040 datasheet: See chapters on PWM and ADC.
- RP2040 C SDK: See chapters on PWM and ADC.
You may organize your program however you like. Here is a suggestion:
- Clears the interrupt flag
- Reads the ADC to get the actual beam angle
- Runs the PID control loop at 1000/sec using the angle measurements from the potentiometer
- Sets a hardware PWM signal using output-compare unit to control the motor using the command:
pwm_set_chan_level(slice_num, PWM_CHAN_X[A or B], pwm_on_time);.
- (possibly) communicates measured angle and low-passed control input to DAC
- Takes user input from the serial interface to setup PID parameters and the desired angle.
- (possibly) diplays measured angle and low-passed control input on VGA display
Note that these checkpoints are cumulative. In week 2, for example, you must have also completed all of the requirements from week 1.
By the end of the lab session in week one of the lab you must have:
By the end of the lab session in week two of the lab you must have:
- Set the desired beam angle
- Set the PID proportional gain
- Set the PID differential gain
- Set the PID integral gain
- The new values should take effect immediately
- One set of coefficients should produce stable behavior over the range of desired hover angles
- Before time=0, while holding the button, the beam should be hanging vertically down (motor off)
- When the button is released at time=0, target angle should be set to horizontal
- At time=5 seconds, target angle should be set to approximately 30 degrees above horizontal
- At time=10, target angle should be set to approximately 30 degrees below horizontal
- At time=15, target angle should be set to horizontal
You will demo all of the features above to a course staff member. You program should not need to be reset during the demo.
Your written lab report should include the sections mentioned on the policy page, and: