Knight Light - UCF Department of EECS · Knight Light LED Chess Nick DeSantis Alex Haas ... I2C bus...

39
Knight Light LED Chess Nick DeSantis Alex Haas Bryan Salicco Senior Design Group 16 Spring 2013

Transcript of Knight Light - UCF Department of EECS · Knight Light LED Chess Nick DeSantis Alex Haas ... I2C bus...

Knight LightLED ChessNick DeSantisAlex HaasBryan Salicco

Senior DesignGroup 16

Spring 2013

Motivation● Chess is a tricky game to learn.

● Video games have taken over and kids don't learn about classic games like Chess.

● Rehashed visuals bring interest back to old products/ideas (ask Disney).

Chess with Friends● iOS app by Zynga.

Goals and Objectives● Accurate tracking of piece locations.

● Lighting of possible moves.

● Recognize invalid moves.

● Detect piece movement.

● Two player game mode.

Specifications● 8x8 grid of 64 tiles (12" x 12")

● Acrylic housing (17" x 13" x 2.5")

● Each tile contains: ○ one RGB LED

○ one optical detector / photosensor

Overall Block Diagram

MCU

Power

I/O Expanders

IR Sensors

LED Matrix

Microcontroller SelectionSPECS LPC2148 Atmega128

Flash 512kb 128kb

Max Op Frequency 60MHz 12MHz

CPU 32bit 8bit

GPIO 48 53

I2C Serial Interfaces 2 1

RAM 32kb + 8kb USB 4kb

SPI 2 1

COST $15.00 $10.00 - $15.00

LED/Sensor Subsystem

I/O Expanders

IR Sensors

LED Matrix

QRD1114MCP23017

Common Cathode RGB LEDs

Placement SensingQRD1114 Optical Detector / Phototransistor

Emits an infrared signal and measures the reflectance.

Pull-up resistor sets the amount of reflectance that will trigger a high signal.

Capacitor and 220 Resistor are not necessary.

LED DisplayRGB LEDs will be placed on each spot on the game board.

Common Cathode allows fourth pin to go to ground.

Colors can be used to signify different events.

Input current <= 20 mA will extend life.

I/O Expanders● MCP23017● 16 GPIO pins● Works on high speed

I2C bus● 3 Hardware address

pins allow up to 8 devices on the bus

I2C Communication● Two wire interface● Message format is

dependant on the device

● Analyze with an oscilloscope to check values

MCP23017 and I2CTransmit: Start, Address+Write, Register, Data,Stop

Read: Start, Address+Write, Register, Restart, Address+Read,Stop

LED/Sensor Configuration

4 LEDs X 3 Pins = 12, 4 Sensors X 1 Pin = 412 + 4 = 16 Pins... Same as our expander!

Initial PCB Plan

MCU Board

Expander Board

Expander Board

Vector Board

Second PCB Plan

MCU Board

I/O Boards

Final PCB Plan

Vector Board

Development Board

PCB12" x 12"

MCU BoardInitially planned to design the MCU board from scratch.Due to the size of the PCB we decided to use the LPC2148 development board.

MCU BoardHeaders are arranged to to provide power and data from the LPC2148 to the components on other boards.

● I/O boards need power, clock, and data

Software● All game logic must be programmed

○ Standard piece movements○ Special moves (Future Addition)○ Endgame scenarios (Future Addition)

● The C Programming Language○ Functions to execute algorithms○ Arrays to store piece positions○ Memory to track positions and state, allowing the

hardware to be more simple

PawnsBlack Arrow: standard movement, forward one tile.

Green Arrow: option on piece move, forward two tiles.

Red Arrow: attack diagonally only.

KnightsTwo tiles horizontally, one tile vertically.

or

One tile horizontally, two tiles vertically.

Leap!

RooksHorizontally any number of tiles.

or

Vertically any number of tiles.

BishopsAny diagonal direction any number of tiles.

QueensAny diagonal, horizontal, or vertical direction.

Any number of tiles.

KingsAny diagonal, horizontal, or vertical direction.

Only one tile.

Illuminating Tiles

Not Awesome Awesome

Software Gameplay3500+ lines of code represented in 8...

while (!gameOver) {scan(); // listening for liftdeterminePossibleMoves();illuminateLEDs();scan(); // listening for drop or attackupdatePositions();turnOffLEDs();

}

Modified BudgetComponent Quantity Price PurchasedLPC2148 1 $15.00 Y

RGB LED (25 pk) 3 $19.95 Y

LCD Monitor 1 $14.00 Y

Button 3 $2.00 Y

MCP23016 28 $2.00 Y

QRD1114 70 $1.00 Y

JTAG Programmer 1 $51.95 Y

USB Cable 2 $4.00 Y

Power Regulator 2 $1.95 N

Modified Budget (cont)Component Quantity Price PurchasedDevelopment Board

1 $40.00 Y

Chess Pieces 1 $10.00 Y

Resistors/Caps/etc xx $30.00 Y

PCB Orders xx $300 Y

Total = $664.70

Up from originally planned $470.00

Progress

Research 100%

Parts Testing 100%

Hardware Prototype 100%

Hardware Assembly 100%

Parts Ordered 100%

Software Pseudo Code 100%

Software Coding 100%

0% 50% 100%

Future Modifications● LCD Screen● Special game conditions● Buttons for game mode and power● A.I. for single player mode

LCD ScreenDisplay to the user...

● Incorrect move

● Time of game

● Game mode

● Player's turn

● Game status

Special Conditions● Chess has special rules in the

game that otherwise follow no traditional pattern.○ Castling ○ En Passant○ Pawn Promotion

● Endgame Scenarios

Artificial Intelligence● Chess piece relative values● Standard valuations● Weighted moves Piece Point Value

Pawn 1

Knight 3

Bishop 3

Rook 5

Queen 9

Thanks!... any questions?