Matthew's Portfolio
Week 2: Introduction to Quadrature Encoders

In the second week of the final project, we got our first taste for using the encoders in our hardware kit.

Using the method derived in class, we wrote an encoder class (seen in encoder.encoder.py) that implemented an algorithm to prevent overflow and underflow as the motor shaft was spun. For the first week, the motors weren't powered, and the shafts were handspun to test the implementation. More commands were added to our front end, such as a 'p' to get the position, 'd' to get the delta in ticks, 'v' to get the velocity, and 'z' to zero the encoder. By spinning the encoder with one hand and pressing key commands with the other, the system could be tested to ensure that the keyboard commands correctly sent information to the Spyder Console window for printing.

Code for this part of the project has since been written over, but their final forms can be viewed at the following files.

PC_FrontEnd.py

uiTask.py

encoder.py

Below is a summary of the state diagrams utilized for the week. These stayed fairly consistent between weeks (the overall flow stayed the same, we were just exporting/sending more data with each week).


Figure 1. Week 2 Deliverable: Front End State Diagram



Figure 2. Week 2 Deliverable: UI Task State Diagram



Figure 3. Week 2 Deliverable: Controller Task State Diagram