niryo-chess-bot
1. Features
- Création de l’échiquier et des pièces : La partie d’échecs se déroule sur un échiquier de 64 cases alternées sur lequel il sera nécessaire de placer 32 pièces (16 blanches et 16
noires). Cet échiquier et les pièces seront créés par impression 3D grâce aux imprimantes FDM et SLA.
- Prise en charge des déplacements : Le robot doit pouvoir de lui-même déplacer des pièces, effectuer des captures de ces dernières, effectuer les roques etc. Il doit également pouvoir se mettre en position d’attente lorsque c’est au joueur de jouer. Ces positions
doivent être calculées en temps réel.
- Choix du type de prise : Lors du déplacement de pièces, le robot doit utiliser un outil de saisie (pince, électro-aimant, pompe à vide et ventouse etc.). Nous devons veiller à utiliser un de ces outils assurant à la fois performance et précision.
- Détection de l’échiquier : Nous devons être capables de repérer et d’enregistrer les positons des cases de l’échiquier dans l’espace de travail du robot à n’importe quel instant.
- Détection des pièces : Il est nécessaire de pouvoir détecter les pièces présentes sur l’échiquier en temps réel et de déterminer leurs positions sur ce dernier. De cette manière nous pourrons récupérer un échiquier complet avec des cases vides ou munies d’une
pièce spécifique si la case est occupée. Il faudra donc utiliser un réseau de neurones convolutifs pour l’analyse d’images.
- Intégrer le modèle d’apprentissage par renforcement : Il est question d’intégrer à la boucle de jeu l’appel au modèle nous permettant de générer le prochain coup que le robot va devoir jouer. La boucle de jeu se constitue en cycles où le joueur joue, puis
le robot répond en capturant ou déplaçant une pièce, jusqu’à la fin de partie.
2. Required Material
For this project, you will need:
- Niryo Ned2 Robot
- Vision Set
- Electro-magnet for the robot
- 3D Printer
- Black and white filaments
- Regular Printer (sticker printer would be better)
- 10mm x 1mm magnets (at least 96 [64 tiles + 32 pieces])
- 13mm x 1mm steel washers (at least 32 for each piece)
3. Material Recreation
3.1 The Board
The board is made of 64 separated tiles that you can print individually. The .stl files are located in /assets/3D/board
. You will need to print:
- 30 × black main_tile.stl
- 30 × white main_tile.stl
- 2 × black corner_tile.stl
- 2 × white corner_tile.stl
- 112 × white or black tile_clipper.stl

Note: corner_tile.stl
is a bit different than the other tiles. It features a thin indentation for the NiryoMarker emplacement.
3.2 Pieces
You can find .stl files in /assets/3D/pieces
. If you're using an FDM printer, set the infill to 80% or more to get a better feeling and weight while manipulating the pieces. I used an SLA printer for the pieces (resin type printer).

3.3 Niryo Markers & Stickers
For the robot workspace visualisation, print Niryo_Markers in /assets/2D/
and stick them in the 4 corners of the board. Note that the one different marker from the others should be on a white tile and on the top-left corner when looking towards the robot.
For the pieces stickers, print them via /assets/2D/sticker_chess
and place them on top of each piece on the steel washers.
3.4 Assembly
The player can move a piece inaccurately on a tile and the robot can have issues lifting it up. So we place magnets in the board and under the pieces to solve this issue. The holes are planned in the .stl files for the 10×1mm neodymium magnets.
Magnet Configuration:
- N – North magnet pole on the piece
- S – South magnet pole on the board tiles
Example (Visual representation skipped due to Moodle limitations):
Each piece has a magnet (N pole), and board tiles contain S-pole magnets. This setup ensures stable alignment and grip for robotic manipulation.
4. Environment Setup
4.1 Requirements
To run pipeline.py
, you need to execute the script in a conda environment. Install from https://anaconda.org/anaconda/conda.
conda env create -f environment.yml
4.2 Config
There might be changes to apply to constants in pipeline.py
:
- If you changed the pieces, change the
PIECE_HEIGHT
values.
- If you changed the board, change the
CELL_SIZE
to match yours.
- Change
ROBOT_IP
if needed (default: 10.10.10.10
).
4.3 Import Audio Files
In future releases, the robot will pronounce the move it plays. Sounds have to be uploaded into the robot's memory card.
python import_sounds.py
4.4 Load AI Model
pipeline.py
uses PyTorch to load the next-move prediction AI model.
Download the model_data
archive. Unzip it and place the folder inside ChessUtils/
.
4.5 Calibrate the Workspace
Download NiryoStudio: https://niryo.com/niryostudio/
Connect to the robot with the application and go to Library > Workspaces > Add+ and calibrate the new workspace. Make sure to name the workspace "ChessBoard"
.
4.6 (Optional) Train Your Own Model
If you have different pieces than the provided .stl ones, you might want to train your own piece detection model.
I used a YOLOv5 model. Annotated data with LabelStudio and trained in a Google Colab instance. Save the model weights (best.pt
or last.pt
) and place it in src/
.
The full project with all the codes and files is available here.