An interactive robotic system (MeArm) capable of challenging a human to a game of Tic-Tac-Toe

Devices & Components

Arduino Uno Rev3
1 
Robot Arm Kit
TrisVision MeArm
Mixed Reality and Computer Vision
Introduction
The project consists of the development of an interactive robotic system based on a 4 degrees of freedom (4DOF) arm with a parallelogram structure (MeArm). The system is capable of challenging a human to a game of Tic-Tac-Toe, identifying moves (X) on a sheet of paper via a webcam and physically responding on the board (O).The software is written in Python and communicates with a microcontroller via a BT-24 Bluetooth Low Energy module.
Software
The architecture is modular, separating the vision logic, artificial intelligence, and hardware communication:Vision/Main (`trisvision.py`): Uses OpenCV to track the playing field, recognize symbols (X and O), and render graphics in Mixed Reality.Logic (`tris_logica.py`): Contains the algorithm (Minimax) to calculate the robot's move.Communication (`ble_link.py`, `config.py`): Interface using the `bleak` library for asynchronous sending of commands (servo motor angles) to the Arduino via Bluetooth.
Calibration
To allow the robot to interact accurately with the real world, several calibration phases were necessary.
Spatial Calibration
Since the camera frames the table, the image has perspective distortions. The software dynamically searches for the 4 sides of the white paper and applies perspective correction (`warpPerspective`). By pressing the 'B'*key (Memory Lock), the system freezes the transformation matrix, allowing the robot to enter the scene without disrupting the geometric recognition of the board.
Color Calibration
Target objects were isolated from the environment by adjusting the Min/Max thresholds for Hue (H), Saturation (S), and Value (V). In this case, the color of a yellow circle glued to the gripper was calibrated (`calibra_EE.py`), which is essential for visually tracking the position of the end-effector.
Electromechanical Calibration
The hardware (SG90 micro-servo motors) has significant mechanical tolerances. Instead of using complex kinematic calculations, the system uses a static mapping (`MAPPA_CASELLE`) where a safe combination of angles (Base, Shoulder, Elbow) has been saved for each of the 9 Tic-Tac-Toe squares. This decouples the mathematical model from the physical problem, offloading hardware imperfections onto a manually tunable configuration file (via `test_ble.py`).
CODE --> MeArm_Tic_Tac_Toe