200 likes | 382 Views
Handheld Mastermind. Senior Design Projects II Carl Kelso, Mike Ellis, Ryan Shon. Agenda. Objective Example Hardware Firmware Interface Considerations Questions. Objective. Create a Handheld Replica of Mastermind Provide a Variety of Play Modes Single Player Time Challenges
E N D
Handheld Mastermind Senior Design Projects IICarl Kelso, Mike Ellis, Ryan Shon
Agenda • Objective • Example • Hardware • Firmware • Interface • Considerations • Questions
Objective • Create a Handheld Replica of Mastermind • Provide a Variety of Play Modes • Single Player • Time Challenges • Guess Challenges • Tournaments • Variable Difficulty Levels • Maintain User History • High Score List
Mastermind • A Game of Code Breaking • Pattern Keeper chooses and hides an ordered set of colored pegs • Pattern Guesser attempts to guess the peg colors and order • Pattern Keeper informs the Guesser of how many pegs are correct and how many are the right color but in the wrong place
An Example Game • A master code is created and hidden • Codes are made from a set of colors • The responses do not show which peg is correct, only how many • White means the correct color is in the wrong place • Black means the correct color is in the right place
Our System • Handheld Device • Selectable LEDs • Firmware Game Logic • Serial Graphics • Custom Controller
Hardware • Microprocessor • ATMEGA 8515, 16, or 164 (40pin DIP) • Peg Display • 4x RGB LEDs • Peg Selection • 4x Red LEDs • 4x Placement Tactile Switches • 2x Up/Down Tactile Switches • 1x Select Tactile Switches • Output Display • DB9 Serial Port ATMEGA164 ATMEGA16
ATMEGA 8515, 16, 164 • Onboard USART • 0-5V Inverted RS232 (vs. ±12V) • Maximum Current Limit Per Power Pin • Capable of driving or sinking 200mA • Maximum Current Limit Per IO Pin • Port A supports up to 100mA • Ports B, C, D, and E support up to 100mA total • Room for Growth • 40 pin DIP Package
VCC VCC VCC VCC VCC VCC VCC MPU MPU MPU MPU MPU MPU MPU MISO MOSI SCK 4 4 4 4 VCC RS232 IN VCC RS232 OUT RX TX Generalized Schematic
Safe Value Calculations • All considered microcontrollers support • 200mA total current along power pins • 100mA total current out of bank A • 100mA total current out of banks B, C, D, E • Power Sinks • 16x LEDs & USART RX/TX • 5mA×16 LEDs = 80mA • Between 3 and 5mA, the LED output is sufficient • Converting RS232 Voltages to 0-5V requires a pair of NPN or NMOS transistors and a diode. Doing this provides safe voltages to the chip itself, preventing a burnout
Controller Design • In Game Controls • Select buttons choose a single LED • Pressing the highlighted LED’s button deselects • Pressing up or down while an LED is selected changes the color • Pressing up or down while an LED is not selected pauses the game and switches to the pause menu • Pressing enter submits the code for comparison • Menu System • The up/down buttons highlightan item and the enter key chooses it • To go back, press the up key
RS232 Java Terminal Display • Raster Object Based Drawing Commands • Benefits over LCD • Lower Cost/Speed Requirements • $100-$300 for a 320x240xRGB LCD • Abstracted Rendering Commands • Simplified Circuit Design • RXTX based Serial Comm • Still Considering • LCD/OLED Display Addition
System Modes • Startup • Boot sequence initializes interrupts, USART, timers, memory, etc… • Menu • Allows player to select game modes and difficulties, as well as enter in their name • Single • Single player game where the computer selects a secret code • Multi • One of several multiplayer modes where two players compete for the fewest guesses, fastest time, or against one another • Tournament • System maintains a stack where several players compete for the fewest guesses across several games • Completed • Menu screen for acknowledging a player’s success
Firmware Modules • Abstraction to Simplify Assembly • EEPROM Control • Saving user data • Graphics Output • Rendering menus and output to the screen • Timer/RTC Control • Scoring in single and multiplayer modes • String Manipulation • LED Control
Root New Game High Scores New Game Single Player Multiplayer Difficulty Single Player Guest New User User List… Pause Resume Save Give Up Multiplayer Guess Challenge Speed Challenge Head to Head Tournament Tournament View Players Add Player Remove Player Mode Start Add Player New User User List… Menu System
Error Sources • Serial Communication • Terminal or Controller may request resend • Parity based error detection possible • Input • There are seven input tactile switches • All should be pressable at any point during operation
GUI Testing Command File Response Broken Command Tests Hardware Testing Oscilloscope Sanity Check Max Current Draw Tests Communication Testing Oscilloscope Sanity Check Streaming USART IO IO Error Detection Serial GUI Testing Independent Module Tests Menu Tests History and Memory Tests Basic Reads/Writes Complex Structure Save/Restore Timer Tests Extended Accuracy Check Gameplay Tests Volunteers Welcome! Test Procedure
Integration • Hardware Design Finalization • Assembly Module Development • Integration of Modules • Module Level Testing and Hardware Integration • Successive Game Mode Development • Menu Development • Integration of Game Modes and Menu System • Final Hardware Integration • Optional LCD/OLED Display Module and Hardware Integration
Feasibility Concerns • Expected Bottlenecks • Assembly Language Programming • Expected Challenges • MPU Power Limitations • RS232 Communications • LCD Integration