This is an application that integrates robotics and chess. It utilizes a uFactory Lite 6 robot arm and Certabo chessboard; a smart chessboard that uses RFID chips and LEDs to indicate what the chess engine has converged to as best move. The system uses Stockfish as chess engine to drive the robot's movement.
Note
The uFactory robot and Certabo board is not originally compatible. This means that the original gripper may result in malfunctioning movement, due to various sizes and shapes of chess pieces. To remedy this custom made props including pieces and a 3D printed gripper extension are provided.
graph TD
User[User] --> |Interacts with| UI[Frontend UI]
UI --> |HTTP Requests| Server[Backend Server]
Server --> |Queries| DB[(PostgreSQL Database)]
Server --> |Controls| Robot[uFactory Lite 6 Robot]
Server --> |Reads| Board[Certabo Chessboard]
Server --> |Uses| Stockfish[Stockfish Chess Engine]
subgraph Frontend
UI
end
subgraph Backend
Server
Stockfish
end
subgraph Hardware
Robot
Board
end
subgraph Database
DB
end
classDef frontend fill:#f9f,stroke:#333,stroke-width:2px;
classDef backend fill:#bbf,stroke:#333,stroke-width:2px;
classDef hardware fill:#bfb,stroke:#333,stroke-width:2px;
classDef database fill:#fbb,stroke:#333,stroke-width:2px;
class UI frontend;
class Server,Stockfish backend;
class Robot,Board hardware;
class DB database;
This diagram illustrates the main components of the Miles Chess Robot system:
- User: Represents the person interacting with the system.
- Frontend UI: The user interface, built with React and Vite.
- Backend Server: The Python-based server handling game logic and communication between components.
- PostgreSQL Database: Stores game data and other relevant information.
- uFactory Lite 6 Robot: The robotic arm that physically moves chess pieces.
- Certabo Chessboard: The smart chessboard with RFID chips and LEDs.
- Stockfish Chess Engine: Used to calculate the best moves for the AI opponent.
The diagram shows how these components interact to create an integrated robotics and chess experience.
As of now the board only allows for white to start at USB-side of the board. This means that the chosen color must be oriented towards the user by physically rotating the board. It's essential to ensure precise centering of the board for the robot to effectively handle the chess pieces.
Piece placement
While playing, aim to position the pieces squarely in the middle of each chessboard square, maintaining an equal distance to all sides in the square.
Note
While playing make sure the side panels of the board remain free from pieces. This area is is used by the robot to store captured pieces.
- Certabo chessboard.
- uFactory Lite 6 (with power supply).
- Emergency Stop button.
- PC or Tablet for Chess robot user interface.
- Ethernet cable (between robot and pc).
- USB cable (between chess board and pc).
- Press down the emergency stop button and connect this to the socket labeled safety on the backplane of the robot arm.
- Attach the robot to a stable surface using the provided clamps.
- Disconnect the AC lead in the power supply and connect the 24V connector to the socket labeled ROBOT 24V on the backplane of the robot arm.
- Allign the board infront of the robot using the marks notated on the board, ensuring centering of the base of the robot and board.
- Connect the ethernet cable from robot and the USB from the board to the computer.
- Connect the power supply to a power source.
- Once plugged in and a beep sound is emitted, release the emergency stop button.
CAUTION
The uFactory robot arm is strong and is suited for more than chess play and use various sensors to detect collision.
However, as these collisions are occasionally identified with major delays, users have to be cautious when interacting with the robot.This collision sensivity can be altered through arm.set_collision_sensitivity(). 1-5, where 5 is most sensitive.
Require npm >= 9.5.1
cd frontend
npm install
npm install --legacy-peer-deps
cd ..
Require Python >= 3.9.13
and pip >= 23.2
Install pip:
python install pip
cd backend
MAC:
pip install virtualenv
Create:
virtualenv venv
or
python -m virtualenv venv
Activate it:
source venv/bin/activate
Windows:
pip install virtualenv
python -m virtualenv --python venv
.\venv\Scripts\activate
Make sure the virtualenv is activated before installing the requirements.
pip install -r requirements.txt
Require Stockfish
Installation for MAC:
brew install stockfish
Installation for Windows 64-bit:
Install Stockfish for Windows 64-bit: https://stockfishchess.org/download/windows/
Assign Stockfish Path:
Create config.py
in /backend
.
Assign variable STOCKFISH_PATH
to Stockfish installation location.
Default path for MAC:
STOCKFISH_PATH = "/usr/local/opt/stockfish/bin/stockfish"
or
STOCKFISH_PATH = "/opt/homebrew/opt/stockfish/bin/stockfish"
Default path for Windows:
Default path for Windows will be stockfish-windows-x86-64.exe
location
Require postgresql@14
Start postgres on MAC:
brew services start postgresql@14
Check status
brew services
If error, check process for default port for postgresql, and terminate if in use, or change default port. And then restart service.
brew services restart postgresql@14
Start postgres on Windows:
net start postgresql-x64-14
To setup database for MAC and Windows
Activate postgresql environment with user "postgres":
psql -U postgres
Run within psql environment:
CREATE ROLE username WITH LOGIN PASSWORD 'password'; ALTER ROLE username CREATEDB;
CREATE DATABASE databasename;
GRANT ALL PRIVILEGES ON DATABASE databasename TO username;
Create database.ini
in /backend/database
with the following content:
[postgresql]
host = localhost
database = databasename
user = username
password = password
Download Certabo board drivers from: https://www.certabo.com/download/
Follow the instructions provided on the download page.
For Mac, download Certabo software - MAC OSx
.
For Windows, download Certabo software – PC 4.1 – 64 bit
.
Within the chess-robot
project folder in /backend
, run the script and follow the instructions in the terminal
python setup.py
To set up the system and start the application, run:
./setup_and_start.sh
This script will:
- Install the Certabo board drivers
- Install necessary dependencies
- Set up the database
- Set up the backend and frontend
- Start the application
To run the setup.py script as well, use:
./setup_and_start.sh --run-setup
Note: You may need to provide administrator privileges for driver installation.
Open two terminals, one for backend and one for frontend.
In backend terminal:
cd backend
Activate virtualenv
python server.py
In frontend terminal:
cd frontend
npm start
MAC:
deactivate
Windows
venv\scripts\deactivate
MAC:
brew services stop postgresql@14
Windows:
net stop postgresql-x64-14