Skip to content

mrguenther/ECE-372A-Honors-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project Name: lab3-part1
Authors:
NetIDs:
Date:

Description

For this lab, you will expand on your two-motor lab by changing the control method and displaying the input value on two seven-segment displays. The potentiometer will be replaced with a rotary encoder, whose angular position will control the PWM outputs to the motors. In addition, the angular position of the rotary encoder will be displayed on two seven-segment displays.

Expected Outcome

The motors should behave as before, but they will now be controlled by a rotary encoder. The angular position of this rotary encoder should be limited to a reasonable range of values requiring two seven-segment displays to show in full. The example from the videos below below uses a range of 0 to 32 so that there is an exact 50% position at 16, but the minutiae of the range you use are up to you.

Example

Example Video

Instructions

As before, this lab will require two motors to operate in one of three states: forward, reverse, and idle. The state changes should still be controlled by a button, though the rotary encoder's knob can be pressed to act as such if you wish. To recap, one motor should be at 100% on one half of the input spectrum, linearly decreasing to 0% from the midpoint to the opposite end; the other motor should do the same, but with the input spectrum reversed. That is to say that one motor will be at 100%, the other at 0%, at each end of the input spectrum; which motor is active depends on the end. At the midpoint, they should both be at 100%.

Rotary encoders use discrete changes in rotation to measure their angular positions or changes therein. They come in two varieties, absolute and incremental; an absolute rotary encoder outputs its angular position, while an incremental one outputs changes in its angular position. The rotary encoders in your Arduino kits are incremental.

The seven-segment displays can be controlled in either of two ways: one option is to connect each individual segment to its own pin on the board; the other option is to use shift registers, found in your kits, to reduce pin usage.

Rubric

Lab Participation Attended
5 points
Not Attended
0 points
Lab Attendance Attended Scheduled Lab Time. Did not attend Scheduled Lab Time.
Demonstration Complete
15 points
Nearly Complete
12 points
Attempted
9 points
Minor Attempt
3 points
No Attempt
0 points
Demonstration Motor state transitions are smooth.

Potentiometer is replaced with rotary encoder.

No Arduino libraries are used.

Both motors are on at full power when the rotary encoder is in the middle.

Motors have soldered connections.

PWM is done using the output-compare modules.

L293D is used to power the motors.

Rotary encoder's angular position is represented on two seven-segment displays.
No Arduino libraries are used.

PWM is done using the output-compare modules.

Potentiometer is replaced with rotary encoder.

AND 1 of the following is unsatisfied:

Motor state transitions are smooth.

Both motors are on at full power when the rotary encoder is in the middle.

Motors have soldered connections.

L293D is used to power the motor.

Rotary encoder's angular position is represented on two seven-segment displays.
No Arduino libraries are used.

PWM is done using the output-compare modules.

Potentiometer is replaced with rotary encoder.

AND 2 of the following are unsatisfied:

Motor state transitions are smooth.

Both motors are on at full power when the rotary encoder is in the middle.

Motors have soldered connections.

L293D is used to power the motor.

Rotary encoder's angular position is represented on two seven-segment displays.
No Arduino libraries are used.

PWM is done using the output-compare modules.

Potentiometer is replaced with rotary encoder.

AND 3 of the following are unsatisfied:

Motor state transitions are smooth.

Both motors are on at full power when the rotary encoder is in the middle.

Motors have soldered connections.

L293D is used to power the motor.

Rotary encoder's angular position is represented on two seven-segment displays.
No Attempt

OR

Arduino libraries are used.

OR

PWM is done using the output-compare modules.

OR

Potentiometer is not replaced with rotary encoder.
Coding Requirements Perfect
2.5 points
Lacking
0 points
State Machine Implementation A state machine implementation is used in the while loop of the program. Functionality may have been achieved, but no state machine is used.
States as Enums States are not simply done as numbers, but rather as a typedef enum for readability. States are done on an integer or some other primitive type, reducing readability.
Function Decomposition Main function does not have multi-line code snippets with direct usage of SFRs. Main function has multi-line code snippets with direct usage of SFRs.

In other words, instead of a function like initPWM() or turnOnLED(), SFRs are directly manipulated in main.cpp
Project Structure All functions having to do with a particular device are placed in an appropriately named file.

LED functions go in led.h, etc.
Some functions having to do with different devices are grouped together in one file.

LED functions are in switch.cpp, etc.
Git Completed
6 points
No Attempt
0 points
Commit History Commit to GitLab is created with correct format. When submitting to GitLab "Thanks! Got your submission" is seen. No project on GitLab or project has no commits.
Turn-In Time Early
15 points
On Time
10 points
Late 1 Day
5 points
Late 2 Days
0 points
Turn-In Turned in the whole project 1 day early. Turned in the whole project on time. Turned in the whole project 1 day late. Turned in the whole project 2 days late.
Coding Guidelines Perfect
1 point
Lacking
0 points
Function and Variable Names Variable and function names are appropriate. A few variable or function names do not make sense or are single letters.
Function and Variable Names 2 Variable and function names are in a consistent format. A few variable or function names do not have consistent camelCase or snake_case formatting.
"Magic" Numbers "Magic" numbers are defined in #define macros. Numbers exist that have no discernible meaning and are not defined in macros.
Comments Comments are included over each function and file. Some functions are uncommented and important program logic is not explained.
Overall Score Level 5
50 or more
Level 4
45 or more
Level 3
40 or more
Level 2
35 or more
Level 1
0 or more

About

New lab design for honors credit in ECE 372A.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published