Skip to content

G-IV/Dice_Tester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

137 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dice Tester

Automated fairness testing for physical dice — roll them by the hundreds, read every face with computer vision, and quantify the bias.

Python License: MIT

Project Site · Devlog · Issues


What it does

Dice Tester is a hardware + software system that rolls dice mechanically, photographs each roll, reads the face value using a YOLO object-detection model, and logs results to a SQLite database. The collected data is then analyzed with a chi-square test to determine whether the dice are statistically fair.

The long-term goal is to support any die type — not just six-sided pip dice.


Demo

Screenshot / GIF coming soon.


Hardware

Component Notes
NVIDIA Jetson Orin NX Inference and control
Stepper motor + driver Mechanically rolls the dice
USB camera Captures each roll
Analog Discovery 2 Motor waveform generation (WaveForms SDK)
Custom enclosure Houses the dice rolling mechanism

See Hardware/ for full BOM, wiring diagrams, and optical calculations. The folder is organized into design/, optics/, and procurement/.


Getting Started

Prerequisites

  • Python 3.10
  • A virtual environment manager
  • (Optional) NVIDIA Jetson for hardware control — the vision pipeline can run standalone on any machine

Installation

git clone https://github.com/G-IV/Dice_Tester.git
cd Dice_Tester
python3.10 -m venv venv
source venv/bin/activate
pip install -e .

Running

python main.py

Project Structure

Dice_Tester/
├── dice_tester/        # Main Python package
│   ├── analysis/       # Reporting and chi-square analysis
│   ├── data/           # Data helpers
│   ├── database/       # SQLite database manager
│   ├── dice/           # Dice models and face definitions
│   ├── feed/           # Camera feed handling
│   ├── motor/          # Motor control (WaveForms SDK)
│   ├── storage/        # Capture storage and migration
│   ├── stream/         # Video streaming
│   └── workflow/       # Roll orchestration
├── docs/               # GitHub Pages site
├── Hardware/           # BOM, wiring, and optical design docs
├── Modeling/           # YOLO training data and configs
├── tests/              # pytest test suite
├── main.py             # Application entry point
└── pyproject.toml

How It Works

  1. Roll — Motor drops a die into the capture zone
  2. Capture — Camera photographs the settled die
  3. Detect — YOLO model reads the face value
  4. Log — Result written to SQLite database
  5. Analyse — Chi-square test applied to the full dataset

Development Notes

See docs/development.md for environment setup details, common commands, and dev notes.


License

MIT

About

Tests how random my dice are.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors