Mechatronics Portfolio
Logan Williamson's Mechatronics Portfolio and Documentation Repository
Lab 4 Deliverables

*Please see the files tab for file documentation

Lab 4 source code

The source code files for Lab 4 can be found at https://bitbucket.org/wokka29/me305_labs/src/master/Lab%200x04/

Introduction

This program consists of nine files which together generate and present a user interface for control of and data collection from two small permanent magnet DC motors connected
to an STM32 Nucleo development board. Data collection in this program is performed using an encoder object from the encoder.py class file, which records position and speed data
associated with the encoder iteratively in the taskEncoder.py file, and prints the results to the console via shares.Share variables passed to the taskUser.py file. Additionally,
this program generates two motor.Motor objects from the motor.py class file, which are used to control the operation of two physical motors connected to the STM32 Nucleo board used for
this project. Higher level control of these motor objects is performed by a motor driver object instantiated from the DRV8847.py class which can be used to enable and disable
operation of the subservient motor objects in this class heirarchy. The DRV8847.DRV8847 and motor.Motor objects are instantiated and managed by the taskMotor.py task file.
Finally, this program instantiates a closed-loop controller object from the closedLoop.py class within the taskMotor task as well. This object serves as a closed-loop controller
which allows the user to set controller parameters for managing the motor operation rather than directly controlling the motor duty cycle with user input (i.e. open-loop control).
Management of multitasking between the taskUser.py, taskEncoder.py, and taskMotor.py task files is handled within the main.py file.

Lab 4 Diagrams

Lab0x04 updated Task Sharing Diagram
Lab0x04 updated taskUser.py Finite State Machine
Lab0x04 updated taskMotor.py Finite State Machine
Lab0x04 taskEncoder.py Finite State Machine
Lab0x04 Closed-Loop Motor Controller Block Diagram

Lab 4 Figures

Step Response Plot 1: Maximum Reference Velocity, Small Gain
Step Response Plot 2: Maximum Reference Velocity, Medium Gain
Step Response Plot 3: Maximum Reference Velocity, Large Gain
Step Response Plot 4: Medium Reference Velocity, Medium Gain
Step Response Plot 5: Maximum Reference Velocity, Medium Gain

Demonstration of Step Response Using Closed-Loop Control:

ME305_Lab0x04 from Brianna Roberts on Vimeo.

Author
Logan Williamson
Brianna Roberts
Date
February 21, 2022