WordBuddy is an interactive robotic system designed to assist users in learning English vocabulary through physical interaction with letter blocks. The project integrates a UR3 collaborative robot, a custom CNN-based computer vision pipeline, and an adaptive game logic engine.
Project Status: Complete MVP β Hybrid Motion Control (MoveJ/MoveL), CNN Vision System (F1-Score 0.72), 3 Game Modes.
- Overview
- Game Modes
- System Architecture
- Hardware Requirements
- Installation
- Configuration
- Usage
- Training the CNN
- Calibration
- Project Structure
- Results
- Contributing
- Citation
- License
WordBuddy combines physical robotics with computer vision and natural language feedback to create an engaging learning experience. A child interacts with a physical board containing letter slots. The UR3 robot arm picks and places letter blocks while a camera-based CNN classifier reads the board state in real time. Text-to-speech provides spoken instructions and feedback throughout each session.
The system was developed as part of the Cognitive Interactions with Robots course (Erasmus programme, 2025β2026).
The robot announces a word via TTS (the word is hidden on screen). The user must find the correct letter blocks and place them in the board slots from left to right. A contextual hint is provided.
The robot places some letters of a word on the board (configurable difficulty: easy / normal / hard) and the user must complete the remaining slots. In easy mode the robot places ~70% of the letters; in hard mode only ~30%.
The robot spells a word on the board with one deliberate mistake. The user must identify the wrong letter block and replace it with the correct one.
All modes share the same validation loop: the CNN reads the board after each interaction, compares the detected letters against the target word, and the robot provides spoken feedback on success or failure.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β WordBuddy System β
βββββββββββββββββ¬βββββββββββββββββββ¬βββββββββββββββββββββββββββ€
β Robot Layer β Vision Layer β Game Layer β
β β β β
β UR3 arm β Webcam β Word selection β
β MoveJ / MoveLβ ArUco calibrationβ Difficulty control β
β Gripper ctrl β Perspective warpβ 3 game modes β
β TCP socket β CNN classifier β TTS feedback β
β β (F1 = 0.72) β Session logging β
βββββββββββββββββ΄βββββββββββββββββββ΄βββββββββββββββββββββββββββ
Key modules:
| Module | Purpose |
|---|---|
src/new_robot_control.py |
UR3 TCP socket control, MoveJ/MoveL, gripper |
src/board_vision.py |
ArUco-based perspective warp, slot ROI extraction |
src/cnn_classifier.py |
CNN letter prediction with empty-slot heuristic |
src/game_logic.py |
Word selection (isograms only), difficulty splitting, error injection |
src/new_main.py |
Session orchestrator β ties all layers together |
src/utils.py |
Config and word dictionary loading |
| Component | Specification |
|---|---|
| Robot arm | Universal Robots UR3 (tested) |
| Camera | USB webcam (OpenCV-compatible) |
| Board | Physical letter-slot board with ArUco markers at corners |
| Letter blocks | 26 physical letter blocks (AβZ) |
| Network | Robot and PC on the same local network |
| PC | Windows 10/11 or Linux, Python 3.10+ |
The robot communicates via TCP socket on port 30002. A physical E-Stop must
be within reach when running any mode that involves robot motion.
git clone https://github.com/diego-terzi/WordBuddy-Cognitive_Interactions_with_Robots.git
cd WordBuddy-Cognitive_Interactions_with_Robotspython -m venv .venv
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activatepip install -r requirements.txtpyttsx3 uses the Windows SAPI5 engine by default. No additional setup is
needed on Windows 10/11. On Linux, install espeak:
sudo apt-get install espeakAll system parameters are in data/config.yaml:
settings:
verbose: false # Set true to print coordinates and debug info
robot:
ip: "10.10.73.237" # Replace with your UR3 IP address
port: 30002
home_joints: [...] # Home joint configuration
camera_id: 0 # OpenCV camera index (0 = first USB camera)
safety:
speed: 0.2 # Robot speed (0β1)
acc: 0.2 # Robot acceleration (0β1)
safe_height: 0.25 # Safety clearance height (metres)
vision:
aruco_dict: "DICT_4X4_50"
classifier_model_path: "data/models/cnn_savedmodel"
classifier_min_conf: 0.30Before first run:
- Set
robot.ipto your UR3's IP address - Set
camera_idto the correct camera index - Run the slot calibration script (see Calibration)
python src/new_main.pyThe system will:
- Connect to the UR3 robot and move to the home position
- Initialize the vision pipeline and CNN classifier
- Present a mode selection menu
βββββββββββββββββββββββββββββββββββββββββββββ
β SELECT YOUR CHALLENGE β
βββββββββββββββββββββββββββββββββββββββββββββ
[1] SPELLING BEE π (Listen and spell)
[2] FILL THE GAP π§© (Complete the word)
[3] FIND THE ERROR π (Fix my mistake)
[Q] QUIT SESSION π
python scripts/test_offline_photo.py
python scripts/test_read_letters_from_image.pypython scripts/benchmark_vision.pyGenerates a confusion matrix and classification report saved to data/test_logs/.
The CNN classifier recognises 27 classes: empty slot (_) plus letters AβZ.
# 1. Collect raw slot images
python scripts/collect_dataset_slots.py
# 2. Generate augmented training data
python scripts/generate_augmented.py
# 3. Train the model (saves to data/models/cnn_savedmodel)
python scripts/train_cnn.pyTraining configuration (top of scripts/train_cnn.py):
- Input size: 64Γ64 px, grayscale
- Dataset split: 80% train / 20% test
- Architecture: lightweight CNN with Conv2D + MaxPooling + Dense layers
ArUco markers at the four corners of the board are used to compute a perspective warp transform. Run the calibration helper before first use or after moving the camera:
python scripts/calibrate_slots.pyFollow the on-screen instructions to define the five slot ROIs. The resulting
coordinates are written to data/config.yaml under vision.slots_roi_px.
WordBuddy-Cognitive_Interactions_with_Robots/
β
βββ data/ # Configuration and resources
β βββ calibration/ # ArUco calibration files
β βββ dataset_augmented/ # Augmented training images
β βββ dataset_slots/ # Original raw slot images
β βββ models/ # Saved CNN model (tf.keras SavedModel)
β βββ test_logs/ # Session logs and confusion matrices
β βββ config.yaml # Main system configuration
β βββ words.json # Word dictionary with hints
β βββ robot_performance_metrics.csv # Session performance log
β
βββ scripts/ # Executable scripts
β βββ benchmark_vision.py # Generates confusion matrix and metrics
β βββ calibrate_slots.py # Interactive slot ROI calibration
β βββ collect_dataset_slots.py # Training image collection tool
β βββ generate_augmented.py # Offline data augmentation pipeline
β βββ train_cnn.py # CNN training script
β βββ test_*.py # Offline and unit tests
β
βββ src/ # Core library modules
β βββ board_vision.py # Perspective warp and ROI extraction
β βββ cnn_classifier.py # CNN inference and empty-slot heuristic
β βββ game_logic.py # Word selection, difficulty, error injection
β βββ new_robot_control.py # UR3 TCP socket control (MoveJ/MoveL)
β βββ new_main.py # Session orchestrator (main entry point)
β βββ utils.py # Config and word dictionary loading
β
βββ CHANGELOG.md
βββ CITATION.cff
βββ CODE_OF_CONDUCT.md
βββ CONTRIBUTING.md
βββ LICENSE
βββ NOTES.ipynb # Development notes
βββ README.md
βββ SECURITY.md
βββ requirements.txt
| Metric | Value |
|---|---|
| CNN F1-Score (test set) | 0.72 |
| Motion control | Hybrid MoveJ / MoveL |
| Game modes | 3 (Spelling Bee, Fill the Gap, Find the Error) |
| Word dictionary | 14 entries (3β5 letter isograms) |
| Session logging | CSV (data/robot_performance_metrics.csv) |
Contributions are welcome. Please read CONTRIBUTING.md for setup instructions and contribution guidelines.
If you use this work in your research, please cite it using the metadata in CITATION.cff or the following reference:
Diego Terzi. WordBuddy: Cognitive Interactions with Robots for Educational
Purposes. GitHub, 2026. https://github.com/diego-terzi/WordBuddy-Cognitive_Interactions_with_Robots
This project is licensed under the MIT License. See LICENSE for details.