Knight Light - ECE

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

Transcript of Knight Light - ECE

Page 1: Knight Light - ECE

Knight LightLED ChessNick DeSantisAlex HaasBryan Salicco

Senior DesignGroup 16

Spring 2013

Page 2: Knight Light - ECE

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).

Page 3: Knight Light - ECE

Chess with Friends● iOS app by Zynga.

Page 4: Knight Light - ECE

Goals and Objectives● Accurate tracking of piece locations.

● Lighting of possible moves.

● Recognize invalid moves.

● Detect piece movement.

● Two player game mode.

Page 5: Knight Light - ECE

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

Page 6: Knight Light - ECE
Page 7: Knight Light - ECE

Overall Block Diagram

MCU

Power

I/O Expanders

IR Sensors

LED Matrix

Page 8: Knight Light - ECE

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

Page 9: Knight Light - ECE

LED/Sensor Subsystem

I/O Expanders

IR Sensors

LED Matrix

QRD1114MCP23017

Common Cathode RGB LEDs

Page 10: Knight Light - ECE

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.

Page 11: Knight Light - ECE

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.

Page 12: Knight Light - ECE

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

Page 13: Knight Light - ECE

I2C Communication● Two wire interface● Message format is

dependant on the device

● Analyze with an oscilloscope to check values

Page 14: Knight Light - ECE

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

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

Page 15: Knight Light - ECE

LED/Sensor Configuration

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

Page 16: Knight Light - ECE

Initial PCB Plan

MCU Board

Expander Board

Expander Board

Vector Board

Page 17: Knight Light - ECE

Second PCB Plan

MCU Board

I/O Boards

Page 18: Knight Light - ECE

Final PCB Plan

Vector Board

Development Board

PCB12" x 12"

Page 19: Knight Light - ECE

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.

Page 20: Knight Light - ECE

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

Page 21: Knight Light - ECE
Page 22: Knight Light - ECE

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

Page 23: Knight Light - ECE

PawnsBlack Arrow: standard movement, forward one tile.

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

Red Arrow: attack diagonally only.

Page 24: Knight Light - ECE

KnightsTwo tiles horizontally, one tile vertically.

or

One tile horizontally, two tiles vertically.

Leap!

Page 25: Knight Light - ECE

RooksHorizontally any number of tiles.

or

Vertically any number of tiles.

Page 26: Knight Light - ECE

BishopsAny diagonal direction any number of tiles.

Page 27: Knight Light - ECE

QueensAny diagonal, horizontal, or vertical direction.

Any number of tiles.

Page 28: Knight Light - ECE

KingsAny diagonal, horizontal, or vertical direction.

Only one tile.

Page 29: Knight Light - ECE

Illuminating Tiles

Not Awesome Awesome

Page 30: Knight Light - ECE

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

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

}

Page 31: Knight Light - ECE
Page 32: Knight Light - ECE

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

Page 33: Knight Light - ECE

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

Page 34: Knight Light - ECE

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%

Page 35: Knight Light - ECE

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

Page 36: Knight Light - ECE

LCD ScreenDisplay to the user...

● Incorrect move

● Time of game

● Game mode

● Player's turn

● Game status

Page 37: Knight Light - ECE

Special Conditions● Chess has special rules in the

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

● Endgame Scenarios

Page 38: Knight Light - ECE

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

Pawn 1

Knight 3

Bishop 3

Rook 5

Queen 9

Page 39: Knight Light - ECE

Thanks!... any questions?