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-lab6a:start [2017/04/14 17:52] – [5. Fundamental Concepts] Marthalearn:courses:unit-6-lab6a:start [2022/10/04 11:38] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== Lab 6a: Open-loop Process Control ====== ====== Lab 6a: Open-loop Process Control ======
 +[[{}/learn/courses/unit-6/start|Back to Unit 6]]
  
 === Download This Document === === Download This Document ===
-  * {{ :learn:courses:unit-6-lab6a:lab_6a.pdf |Lab 6a PDF}}+{{ :learn:courses:unit-6-lab6a:lab_6a.pdf |Lab 6a 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 open-loop and closed-loop motor control. +  - Develop MPLAB X projects that implement open-loop and closed-loop motor control. 
-  * Develop C program code to implement a PI controller and a moving averaging digital filter. +  - Develop 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 monitoring devices.+  - Send real time data monitoring devices.
  
  
Line 17: Line 18:
  
 ===== 2. Basic Knowledge ===== ===== 2. Basic Knowledge =====
-  * How to configure pins on a Microchip® PIC32 PPS microprocessor.  +  - How to configure 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 29:
 ===== 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/|12 V 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]]  
-  * [[http://store.digilentinc.com/autorange-digital-multimeter-ms8217/|Digital Multimeter]]+  - [[https://digilent.com/shop/ms8217-autorange-digital-multimeter/|Digital Multimeter]]
  
  
 ==== 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 53: Line 54:
  
 ===== 4. Project Takeaways ===== ===== 4. Project Takeaways =====
-  * How to read analog voltage with a PIC32 processor. +  - How to read 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 and Input Capture to implement a tachometer. +  - How to use the PIC32 Timer and Input Capture to implement a tachometer. 
-  * Fundamental analog and filtering concepts for data smoothing and open-loop control.+  - Fundamental analog and filtering concepts for data smoothing and open-loop control.
  
  
Line 81: Line 82:
 The potentiometer labeled the Analog Input Control (R134) on the Basys MX3 trainer board, as shown in Fig. 7.1, will be used as the input for controlling the motor speed. The potentiometer wiper terminal is connected to the PIC32MX370 processor Port B pin 2. Using the PIC32 analog-to-digital converter (ADC) is rather straightforward with the aid of the example code provided by the MPLAB X Help for the XC32 Peripheral Libraries. Listing B.1 in Appendix B shows how to initialize an ADC channel to continuously sample and convert analog data. Listing B.2 is example code to read the most recent ADC conversion and call functions to set the motor direction of rotation and speed. The motor control is discussed in section 7.4 below.   The potentiometer labeled the Analog Input Control (R134) on the Basys MX3 trainer board, as shown in Fig. 7.1, will be used as the input for controlling the motor speed. The potentiometer wiper terminal is connected to the PIC32MX370 processor Port B pin 2. Using the PIC32 analog-to-digital converter (ADC) is rather straightforward with the aid of the example code provided by the MPLAB X Help for the XC32 Peripheral Libraries. Listing B.1 in Appendix B shows how to initialize an ADC channel to continuously sample and convert analog data. Listing B.2 is example code to read the most recent ADC conversion and call functions to set the motor direction of rotation and speed. The motor control is discussed in section 7.4 below.  
  
-{{ :learn:courses:unit-6-lab6a:lab6a-fig-7-1.jpg?nolink&600 |Figure 7.1. Analog Input Control schematic diagram.}}+{{ :learn:courses:unit-6-lab6a:lab_6a_fig_7.1.jpg?nolink&700 |Figure 7.1. Analog Input Control schematic diagram.}}
 //Figure 7.1. Analog Input Control schematic diagram.// //Figure 7.1. Analog Input Control schematic diagram.//
 +
  
 ==== 7.2. Motor Speed Indication ==== ==== 7.2. Motor Speed Indication ====
Line 104: Line 106:
  
  
-{{ :learn:courses:unit-6-lab6a:lab6a-fig-7-3.jpg?nolink&600 |Figure 7.3. Basys MX3 Motor driver circuit.}}+{{ :learn:courses:unit-6-lab6a:lab_6a_fig_7.3.jpg?nolink&600 |Figure 7.3. Basys MX3 Motor driver circuit.}}
 //Figure 7.3. Basys MX3 Motor driver circuit.// //Figure 7.3. Basys MX3 Motor driver circuit.//
 +
  
 **Table 7.1. Motor driver IC7 connection to PIC32 processor.** **Table 7.1. Motor driver IC7 connection to PIC32 processor.**
Line 190: Line 193:
   - Phase 2 Construction   - Phase 2 Construction
     - Attach the workstation monitor and launch the terminal emulator application.     - Attach the workstation monitor and launch the terminal emulator application.
-    - Port in the LCD code from [[https://reference.digilentinc.com/learn/courses/unit-3-lab3a/start|Lab 3a]] or [[https://reference.digilentinc.com/learn/courses/unit-3-lab3b/start|3b]] into this project and display the motor Analog Control Input value, the percentage PWM and the motor speed in RPM. +    - Port in the LCD code from [[/learn/courses/unit-3-lab3a/start|Lab 3a]] or [[/learn/courses/unit-3-lab3b/start|3b]] into this project and display the motor Analog Control Input value, the percentage PWM and the motor speed in RPM. 
-    - Port the UART code from [[https://reference.digilentinc.com/learn/courses/unit-4-lab4a/start|Lab 4a]] into this project and initialize for 38000 BAUD with no parity.+    - Port the UART code from [[/learn/courses/unit-4-lab4a/start|Lab 4a]] into this project and initialize for 38000 BAUD with no parity.
     - Modify the background task to update the LCD and UART once each 250 ms.      - Modify the background task to update the LCD and UART once each 250 ms. 
  
Line 208: Line 211:
     - Plot the motor speed vs. percent PWM as demonstrated in Fig. 8.3. All motors have different power-speed characteristics.     - Plot the motor speed vs. percent PWM as demonstrated in Fig. 8.3. All motors have different power-speed characteristics.
  
-{{ :learn:courses:unit-6-lab6a:lab6a-fig-8-1.png?nolink |Figure 8.1. H-Bridge inputs for CW motor rotation for 60% PWM.}}+{{ :learn:courses:unit-6-lab6a:lab_6a_fig_8_1.png?nolink&1100 |Figure 8.1. H-Bridge inputs for CW motor rotation for 60% PWM.}}
 //Figure 8.1. H-Bridge inputs for CW motor rotation for 60% PWM.// //Figure 8.1. H-Bridge inputs for CW motor rotation for 60% PWM.//
  
-{{ :learn:courses:unit-6-lab6a:lab6a-fig-8-2.png?nolink |Figure 8.2. H-Bridge inputs for CCW motor rotation for 60% PWM.}}+{{ :learn:courses:unit-6-lab6a:lab_6a_fig_8_2.png?nolink&1100 |Figure 8.2. H-Bridge inputs for CCW motor rotation for 60% PWM.}}
 //Figure 8.2. H-Bridge inputs for CCW motor rotation for 60% PWM.// //Figure 8.2. H-Bridge inputs for CCW motor rotation for 60% PWM.//
 +
  
 {{ :learn:courses:unit-6-lab6a:lab6a-fig-8-3.png?nolink&600 |Figure 8.3. Example plot of motor speed vs. %PWM.}} {{ :learn:courses:unit-6-lab6a:lab6a-fig-8-3.png?nolink&600 |Figure 8.3. Example plot of motor speed vs. %PWM.}}
Line 459: Line 463:
 } }
 </code> </code>
 +
 +----
 +
 +[[{}/learn/courses/unit-6/start|Back to Unit 6]]
 +[[{}/learn/courses/unit-6-lab6b/start|Go to Lab 6b]]
 +[[{}/learn/courses/unit-7/start|Go to Unit 7]]