Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
learn:courses:unit-6-lab6b:start [2017/03/28 22:00] – Marthalearn:courses:unit-6-lab6b:start [2022/10/04 11:38] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== Lab 6b: Closed-loop Process Control ====== ====== Lab 6b: Closed-loop Process Control ======
 +[[{}/learn/courses/unit-6/start|Back to Unit 6]]
 +[[{}/learn/courses/unit-6-lab6a/start|Back to Lab 6a]]
  
 === Download This Document === === Download This Document ===
-  * {{ :learn:courses:unit-6-lab6b:lab_6b.pdf |Lab 6b PDF}}+{{ :learn:courses:unit-6-lab6b:lab_6b.pdf |Lab 6b PDF}}
  
  
 ===== 1. Objectives ===== ===== 1. Objectives =====
-  * Generate PWM outputs to implement analog motor supply voltage. +  - Generate PWM outputs to implement analog motor supply voltage. 
-  * Implement a tachometer operation using PIC32 Timers. +  - Implement a tachometer operation using PIC32 Timers. 
-  * Develop MPLAB X projects that implement closed-loop motor control. +  - Develop MPLAB X projects that implement closed-loop motor control. 
-  * Develop the C program code to implement a PI controller and a moving averaging digital filter. +  - Develop the C program code to implement a PI controller and a moving averaging digital filter. 
-  * Manage multiple background tasks in an interrupt driven system. +  - Manage multiple background tasks in an interrupt driven system. 
-  * Send real-time data to monitoring devices.+  - Send real-time data to monitoring devices.
  
  
Line 17: Line 19:
  
 ===== 2. Basic Knowledge ===== ===== 2. Basic Knowledge =====
-  * Fundamental knowledge of linear systems.  +  - Fundamental knowledge of linear systems.  
-  * How to configure IO pins on a Microchip® PIC32 PPS microprocessor.  +  - How to configure IO pins on a Microchip® PIC32 PPS microprocessor.  
-  * How to implement a real-time system using preemptive foreground-background task control. +  - How to implement a real-time system using preemptive foreground-background task control. 
-  * How to generate a PWM output with the PIC32 processor. +  - How to generate a PWM output with the PIC32 processor. 
-  * How to configure the Analog Discovery 2 to display logic traces. +  - How to configure the Analog Discovery 2 to display logic traces. 
-  * How to implement the design process for embedded processor based systems.+  - How to implement the design process for embedded processor based systems.
  
 ---- ----
Line 28: Line 30:
 ===== 3. Equipment List ===== ===== 3. Equipment List =====
 ==== 3.1. Hardware ==== ==== 3.1. Hardware ====
-  * [[http://store.digilentinc.com/basys-mx3-pic32mx-trainer-board-recommended-for-embedded-systems-courses/|Basys MX3 trainer board]] +  - [[https://digilent.com/shop/basys-mx3-pic32mx-trainer-board-for-embedded-systems-courses/|Basys MX3 trainer board]] 
-  * Workstation computer running Windows 10 or higher, MAC OS, or Linux +  - Workstation computer running Windows 10 or higher, MAC OS, or Linux 
-  * 2 [[http://store.digilentinc.com/usb-a-to-micro-b-cable/|Standard USB A to micro-B cables]] +  - 2 [[https://digilent.com/shop/usb-a-to-micro-b-cable/|Standard USB A to micro-B cables]] 
-  * [[http://store.digilentinc.com/motor-gearbox-1-19-gear-ratio-custom-12v-motor-designed-for-digilent-robot-kits/|5V DC motor with tachometer]] +  - [[https://digilent.com/shop/dc-motor-gearbox-1-19-gear-ratio-custom-12v-motor-designed-for-digilent-robot-kits/|12V DC motor with tachometer]] 
-  * [[http://store.digilentinc.com/5v-2-5a-switching-power-supply/|5V, 2.5A power supply]]+  - [[https://digilent.com/shop/5v-4a-switching-power-supply/|5V, 4A DC power supply]]
  
 In addition, we suggest the following instruments: In addition, we suggest the following instruments:
  
-  * [[http://store.digilentinc.com/analog-discovery-2-100msps-usb-oscilloscope-logic-analyzer-and-variable-power-supply/|Analog Discovery 2]] +  - [[https://digilent.com/shop/analog-discovery-2-100ms-s-usb-oscilloscope-logic-analyzer-and-variable-power-supply/|Analog Discovery 2]] 
  
  
 ==== 3.2. Software: ==== ==== 3.2. Software: ====
 The following programs must be installed on your development workstation: The following programs must be installed on your development workstation:
-  * [[http://www.microchip.com/mplab/mplab-x-ide|Microchip MPLAB X® v3.35 or higher]] +  - [[http://www.microchip.com/mplab/mplab-x-ide|Microchip MPLAB X® v3.35 or higher]] 
-  * [[http://www.microchip.com/SWLibraryWeb/product.aspx?product=PIC32%20Peripheral%20Library|PLIB Peripheral Library]] +  - [[http://www.microchip.com/SWLibraryWeb/product.aspx?product=PIC32%20Peripheral%20Library|PLIB Peripheral Library]] 
-  * [[http://www.microchip.com/xcdemo/xcpluspromo.aspx|XC32 Cross Compiler]] +  - [[http://www.microchip.com/xcdemo/xcpluspromo.aspx|XC32 Cross Compiler]] 
-  * [[http://store.digilentinc.com/waveforms-2015-download-only/|WaveForms 2015]] (if using the Analog Discovery 2) +  - [[https://digilent.com/shop/software/digilent-waveforms/|WaveForms]] (if using the Analog Discovery 2) 
-  * [[http://www.putty.org/|PuTTY Terminal Emulation]] +  - [[http://www.putty.org/|PuTTY Terminal Emulation]] 
-  * Spreadsheet application (such as Microsoft Excel)+  - Spreadsheet application (such as Microsoft Excel)
  
  
Line 52: Line 54:
  
 ===== 4. Project Takeaways ===== ===== 4. Project Takeaways =====
-  * How to read an analog voltage with a PIC32 processor. +  - How to read an analog voltage with a PIC32 processor. 
-  * How to use the PIC32 Output Compare to implement a PWM analog output. +  - How to use the PIC32 Output Compare to implement a PWM analog output. 
-  * How to use the PIC32 Timer external input to measure frequency to implement a tachometer. +  - How to use the PIC32 Timer external input to measure frequency to implement a tachometer. 
-  * How to use the PIC32 Input Capture period measurement to implement a tachometer. +  - How to use the PIC32 Input Capture period measurement to implement a tachometer. 
-  * Fundamental analog and filtering concepts for data smoothing and closed-loop control.+  - Fundamental analog and filtering concepts for data smoothing and closed-loop control.
  
  
Line 134: Line 136:
 Figure 7.1 was generated by monitoring the motor tachometer using the SPI_CK DIO 4 pin on the Analog Discovery 2 connector that is toggled in the input capture ISR, as shown in Listing B.4 of Lab 6a. Examining the plot for the tachometer in Fig. 7.1, we see than the PI algorithm requires about 150 ms to achieve steady state. Figure 7.1 was generated by monitoring the motor tachometer using the SPI_CK DIO 4 pin on the Analog Discovery 2 connector that is toggled in the input capture ISR, as shown in Listing B.4 of Lab 6a. Examining the plot for the tachometer in Fig. 7.1, we see than the PI algorithm requires about 150 ms to achieve steady state.
  
-{{ :learn:courses:unit-6-lab6b:lab6a-fig-7-1.png?nolink |Figure 7.1. Motor speed response for a step input from CW to CCW at 30% PWM for PI closed-loop control.}}+{{ :learn:courses:unit-6-lab6b:lab_6b_fig_7_1.png?nolink&1100 |Figure 7.1. Motor speed response for a step input from CW to CCW at 30% PWM for PI closed-loop control.}}
 //Figure 7.1. Motor speed response for a step input from CW to CCW at 30% PWM for PI closed-loop control.// //Figure 7.1. Motor speed response for a step input from CW to CCW at 30% PWM for PI closed-loop control.//
 +
  
  
 ---- ----
  
-===== 8. Lab 8b =====+===== 8. Lab 6b =====
 The DC motor used in Lab 6a and 6b has a 19 to one reduction gear on the output shaft. The Hall Effect sensor used for the tachometer is mounted to the motor shaft and hence will be rotating 19 times faster than the output shaft. All motor speed measurements are based on the tachometer. The DC motor used in Lab 6a and 6b has a 19 to one reduction gear on the output shaft. The Hall Effect sensor used for the tachometer is mounted to the motor shaft and hence will be rotating 19 times faster than the output shaft. All motor speed measurements are based on the tachometer.
  
Line 187: Line 190:
       - Write to the output compare secondary registers (OCxRS) that generate the PWM output.       - Write to the output compare secondary registers (OCxRS) that generate the PWM output.
  
-{{ :learn:courses:unit-6-lab6b:unit_6_-_photo_6.jpg?nolink |Figure 8.1. LCD display for closed loop operation.}}+{{ :learn:courses:unit-6-lab6b:unit_6_-_photo_6.jpg?nolink&500 |Figure 8.1. LCD display for closed loop operation.}}
 //Figure 8.1. LCD display for closed loop operation.// //Figure 8.1. LCD display for closed loop operation.//
  
-{{ :learn:courses:unit-6-lab6b:lab6b-fig-8-2.png?nolink |Figure 8.2. Terminal screen for closed loop motor control.}}+{{ :learn:courses:unit-6-lab6b:lab6b-fig-8-2.png?nolink&500 |Figure 8.2. Terminal screen for closed loop motor control.}}
 //Figure 8.2. Terminal screen for closed loop motor control.// //Figure 8.2. Terminal screen for closed loop motor control.//
  
Line 198: Line 201:
 | SW6           | Run the motor according to the direction set by SW7  | Brake (STOP)                                    | | SW6           | Run the motor according to the direction set by SW7  | Brake (STOP)                                    |
 | SW7           | Rotate CCW at speed set by analog input control      | Rotate CW at speed set by analog input control  | | SW7           | Rotate CCW at speed set by analog input control      | Rotate CW at speed set by analog input control  |
 +
 +
 +----
 +
 +[[{}/learn/courses/unit-6/start|Back to Unit 6]]
 +[[{}/learn/courses/unit-6-lab6a/start|Back to Lab 6a]]
 +[[{}/learn/courses/unit-7/start|Go to Unit 7]]