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.

Resonant Cavity Field Profiler

Salaj Ganesh, Max Goin, Furkan Yazici

Resonant Cavity Field Profiler

Featured Project

# Team Members:

- Max Goin (jgoin2)

- Furkan Yazici (fyazici2)

- Salaj Ganesh (salajg2)

# Problem

We are interested in completing the project proposal submitted by Starfire for designing a device to tune Resonant Cavity Particle Accelerators. We are working with Tom Houlahan, the engineer responsible for the project, and have met with him to discuss the project already.

Resonant Cavity Particle Accelerators require fine control and characterization of their electric field to function correctly. This can be accomplished by pulling a metal bead through the cavities displacing empty volume occupied by the field, resulting in measurable changes to its operation. This is typically done manually, which is very time-consuming (can take up to 2 days).

# Solution

We intend on massively speeding up this process by designing an apparatus to automate the process using a microcontroller and stepper motor driver. This device will move the bead through all 4 cavities of the accelerator while simultaneously making measurements to estimate the current field conditions in response to the bead. This will help technicians properly tune the cavities to obtain optimum performance.

# Solution Components

## MCU:

STM32Fxxx (depending on availability)

Supplies drive signals to a stepper motor to step the metal bead through the 4 quadrants of the RF cavity. Controls a front panel to indicate the current state of the system. Communicates to an external computer to allow the user to set operating conditions and to log position and field intensity data for further analysis.

An MCU with a decent onboard ADC and DAC would be preferred to keep design complexity minimum. Otherwise, high MIPS performance isn’t critical.

## Frequency-Lock Circuitry:

Maintains a drive frequency that is equal to the resonant frequency. A series of op-amps will filter and form a control loop from output signals from the RF front end before sampling by the ADCs. 2 Op-Amps will be required for this task with no specific performance requirements.

## AC/DC Conversion & Regulation:

Takes an AC voltage(120V, 60Hz) from the wall and supplies a stable DC voltage to power MCU and motor driver. Ripple output must meet minimum specifications as stated in the selected MCU datasheet.

## Stepper Drive:

IC to control a stepper motor. There are many options available, for example, a Trinamic TMC2100. Any stepper driver with a decent resolution will work just fine. The stepper motor will not experience large loading, so the part choice can be very flexible.

## ADC/DAC:

Samples feedback signals from the RF front end and outputs the digital signal to MCU. This component may also be built into the MCU.

## Front Panel Indicator:

Displays the system's current state, most likely a couple of LEDs indicating progress/completion of tuning.

## USB Interface:

Establishes communication between the MCU and computer. This component may also be built into the MCU.

## Software:

Logs the data gathered by the MCU for future use over the USB connection. The position of the metal ball and phase shift will be recorded for analysis.

## Test Bed:

We will have a small (~ 1 foot) proof of concept accelerator for the purposes of testing. It will be supplied by Starfire with the required hardware for testing. This can be left in the lab for us to use as needed. The final demonstration will be with a full-size accelerator.

# Criterion For Success:

- Demonstrate successful field characterization within the resonant cavities on a full-sized accelerator.

- Data will be logged on a PC for later use.

- Characterization completion will be faster than current methods.

- The device would not need any input from an operator until completion.

Project Videos