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.

Modularized Electronic Locker

Jack Davis, Joshua Nolan, Jake Pu

Modularized Electronic Locker

Featured Project

Group Member: Jianhao (Jake) Pu [jpu3], Joshua Nolan [jtnolan2], John (Jack) Davis [johnhd4]

Problem:

Students living off campus without a packaging station are affected by stolen packages all the time. As a result of privacy concerns and inconsistent deployment, public cameras in Champaign and around the world cannot always be relied upon. Therefore, it can be very difficult for victims to gather evidence for a police report. Most of the time, the value of stolen items is small and they are usually compensated by the sellers (Amazon and Apple are very understanding). However, not all deliveries are insured and many people are suffering from stolen food deliveries during the COVID-19 crisis. We need a low-cost solution that can protect deliveries from all vendors.

Solution Overview:

Our solution is similar to Amazon Hub Apartment Locker and Luxer One. Like these services, our product will securely enclose the package until the owners claim the contents inside. The owner of the contents can claim it using a phone number or a unique user identification code generated and managed by a cloud service.

The first difference we want to make from these competitors is cost. According to an article, the cost of a single locker is from $6000 - $20000. We want to minimize such costs so that we can replace the traditional mailbox. We talked to a Chinese manufacturer and got a hardware quote of $3000. We can squeeze this cost if we just design our own control module on ESP32 microcontrollers.

The second difference we want to make is modularity. We will have a sensor module, a control module, a power module and any number of storage units for hardware. We want to make standardized storage units that can be stacked into any configuration, and these storage units can be connected to a control module through a communication bus. The control module houses the hardware to open or close all of the individual lockers. A household can purchase a single locker and a control module just for one family while apartment buildings can stack them into the lockers we see at Amazon Hub. I think the hardware connection will be a challenge but it will be very effective at lowering the cost once we can massively manufacture these unit lockers.

Solution Components:

Storage Unit

Basic units that provide a locker feature. Each storage unit will have a cheap microcontroller to work as a slave on the communication bus and control its electronic lock (12V 36W). It has four connectors on top, bottom, left, and right sides for stackable configuration.

Control Unit

Should have the same dimension as one of the storage units so that it could be stacked with them. Houses ESP32 microcontroller to run control logics on all storage units and uses the built-in WiFi to upload data to a cloud server. If sensor units are detected, it should activate more security features accordingly.

Power Unit

Power from the wall or from a backup battery power supply and the associated controls to deliver power to the system. Able to sustain high current in a short time (36W for each electronic lock). It should also have protection against overvoltage and overcurrent.

Sensor Modules

Sensors such as cameras, motion sensors, and gyroscopes will parlay any scandalous activities to the control unit and will be able to capture a photo to report to authorities. Sensors will also have modularity for increased security capabilities.

Cloud Support

Runs a database that keeps user identification information and the security images. Pushes notification to end-users.

Criterion for Success:

Deliverers (Fedex, Amazon, Uber Eats, etc.) are able to open the locker using a touchscreen and a use- provided code to place their package inside. Once the package is inside of the locker, a message will be sent to the locker owner that their delivery has arrived. Locker owners are able to open the locker using a touchscreen interface. Owners are also able to change the passcode at any time for security reasons. The locker must be difficult to break into and offer theft protection after multiple incorrect password attempts.

Project Videos