Project

# Title Team Members TA Documents Sponsor
33 Chess Playing Robot with Computer Vision
Honorable Mention
Jose Flores
Joshua Hur
Zack Alonzo
Zicheng Ma design_document1.pdf
design_document2.pdf
final_paper2.pdf
photo1.jpg
presentation1.pdf
proposal1.pdf
proposal2.pdf
video
# Chess Playing Robot with Computer Vision
jhur22, joseaf3, zalonzo2

## Problem
Our project’s goal is to address the need for a tangible and interactive chess-playing device, enabling users to play in the physical world against a chess AI rather than relying on digital platforms. Designed for both beginners and advanced players, the chess-playing robot would provide an engaging alternative to mobile apps, allowing for skill development and strategic thinking in a hands-on manner.

## Solution
We plan to develop an autonomous chess-playing robot that eliminates the need for a human opponent by incorporating our own chess algorithm with varying difficulty levels. Using a system involving a magnet and motors beneath the board, the computer opponent’s chess pieces will move autonomously while the human player will simply pick up and place their pieces. Then, our robot will analyze the current board position by capturing an image through a camera and will identify all the pieces on the board by identifying each piece's color, associating it with the corresponding chess piece. With this updated board, we will now be able to determine the optimal move based on the chosen difficulty level and current board position. When identified, our code will output the necessary information to the system with the magnet and the motors underneath the board to move its intended piece and wait for the subsequent human player’s move (additionally, a button press will “submit” the player’s move).

## Solution Components
The project contains three major subsystems to accomplish its task.
- Magnetic Chess Board
- Computer Vision-based Chess Board Visualizer
- AI Chess Algorithm

## Subsystem 1: Magnetic Chess Board
A version of this board already exists in the machine shop from a previous student project, so this part is mostly complete. However, our goal will still be to improve upon the design of the board, as the current board has some issues with the main magnet and its consistency in grabbing the chess pieces.
The chess board itself consists of 3 motors: 2 for one axis (AXIS1) and 1 for the other axis (AXIS2). The purpose of having 2 motors for AXIS1 is to prevent AXIS2 from tilting and being offset. Connected to AXIS2 is a magnet that will be responsible for moving pieces on the computer’s side of the board. When the computer executes a ply, the code running on the microcontroller will move the magnet to the piece’s starting position. Once it arrives, it will activate a voltage high to enable the magnet to grab the chess piece. Once held, it will navigate through the board to the desired end location, activate a voltage low, and finish its ply. Because the pieces will be sliding around flush with the board, the pieces or board need to be modified. In chess, knights can move over other pieces so to avoid collisions with other pieces, we thought of centering all chess pieces in their respective tiles and guiding chess pieces along the lines or borders of a board. To complete the solution, we thought of two ideas:
Method 1: Enlarge the board to grant the pieces more clearance when moving around the board.
Method 2: Reduce the size of the pieces to give them more space when moving around.
The method we go with will depend on where we can store the board because we want it to be large but not so big that we can’t easily move it somewhere, such as between the machine shop and the lab room.

Parts:
- Motor: Mercury Motor SM-42BYG011-25 2 Phase 1.8° 32/20 (x3) (already have)
- Large Magnet (already have)
- Chess Board with Plastic Sheet Covering
- ESP32 S3 Microcontroller (we can get this from the ECE supplies instead of using our budget)

## Subsystem 2: Chess Board Visualizer with Computer Vision
This will be the main challenge of the project. First, we require an arduino camera that will be mounted above the chess board, enabling us to have a top-down view of all of the chess pieces. This camera will utilize a MIPI interface, allowing us to connect it to the CSI port of a Raspberry Pi and run all of our code for the computer vision part (and the Raspberry Pi will be mounted on our PCB to create a Pi HAT). Next, each of the 32 magnetic chess pieces will be color coded. With 6 types of pieces, we will use the 3 primary colors (red, blue, and yellow) along with the 3 colors in between the primary ones (purple, green, and orange). To differentiate between the opposing sides, the human player will have a darker shade of these colors and the robot will use lighter shades.

Parts:
- Colored Chess Pieces with Magnetic Bottoms (x32): (will 3D print our own)
- Neodymium Magnets (x32): https://www.amazon.com/dp/B0BVYFSDNS/ref=twister_B0C6X3LNB9?_encoding=UTF8&psc=1 [$13]
- Raspberry Pi: (SC0685 Raspberry Pi | Embedded Computers | DigiKey) [$60]
- MIPI Camera: (SC0194(9) Raspberry Pi | Embedded Computers | DigiKey) [$55]

## Subsystem 3: AI Chess Algorithm
The artificial intelligence agent will need to calculate optimal moves of various proficiency based on Subsystem 2’s computer vision. The agent’s logic will be based on Python’s chess library to calculate effective moves, check the legality of said moves, and judge a game’s outcome (a win, defeat, or stalemate). To check the status of the chess board (e.g. piece positions), Python’s chess library needs to parse in a string to describe the board. The syntax of the string needs to be in Forsyth-Edwards Notation (FEN) and it denotes the following.
- Piece locations
- Active color’s ply
- Castling availability
- Enpassant possibilities
- Half move clock
- Full move number

An example board for FEN could be "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR".

More details for parsing and other information can be found here: https://python-chess.readthedocs.io/en/latest/core.html

## Criteria for Success (5 things)
- Computer vision algorithm correctly identifies piece positions on the board with high accuracy
- Successfully update internal representation of board
- Magnet correctly grabs intended piece and does not make the current piece bump into others
- Robot will successfully detect if the human player cheats/performs an illegal move
- Chess board moves the pieces to the intended positions with high accuracy

## Proposal for Expansion
A really fun expansion that we want to do is to make this a more universal game-playing robot rather than just a chess-playing robot by adding games like Checkers, Go, Sorry, etc. Once we have the base chess game working with the magnetic arm on the bottom and the CV, all we would have to do is 3D print more pieces, make a new sheet to put on top of the board, and use other libraries for rules for other games and interface that with how to move the magnetic arm for the specific game.

Wireless IntraNetwork

Daniel Gardner, Jeeth Suresh

Wireless IntraNetwork

Featured Project

There is a drastic lack of networking infrastructure in unstable or remote areas, where businesses don’t think they can reliably recoup the large initial cost of construction. Our goal is to bring the internet to these areas. We will use a network of extremely affordable (<$20, made possible by IoT technology) solar-powered nodes that communicate via Wi-Fi with one another and personal devices, donated through organizations such as OLPC, creating an intranet. Each node covers an area approximately 600-800ft in every direction with 4MB/s access and 16GB of cached data, saving valuable bandwidth. Internal communication applications will be provided, minimizing expensive and slow global internet connections. Several solutions exist, but all have failed due to costs of over $200/node or the lack of networking capability.

To connect to the internet at large, a more powerful “server” may be added. This server hooks into the network like other nodes, but contains a cellular connection to connect to the global internet. Any device on the network will be able to access the web via the server’s connection, effectively spreading the cost of a single cellular data plan (which is too expensive for individuals in rural areas). The server also contains a continually-updated several-terabyte cache of educational data and programs, such as Wikipedia and Project Gutenberg. This data gives students and educators high-speed access to resources. Working in harmony, these two components foster economic growth and education, while significantly reducing the costs of adding future infrastructure.