Automatic Dart Score Calculator

by TristanDebrabandere in Circuits > Raspberry Pi

9 Views, 0 Favorites, 0 Comments

Automatic Dart Score Calculator

IMG_20250618_195401881.jpg
IMG_20250618_195406330.jpg
IMG_20250618_195418892.jpg
IMG_20250618_195356628.jpg

For my end-of-year school project I created an automatic dart score calculator that uses visual AI to detect dart positions and calculate scores without manual input. The system includes a camera-based sensor setup, a Raspberry Pi 5 microcontroller, a laptop for advanced processing, and a display for real-time feedback.

Supplies

IMG_20250615_200632015.jpg
IMG_20250618_195829933.jpg
IMG_20250618_195843817.jpg
IMG_20250618_195909609.jpg
IMG_20250618_195919801.jpg

1. Core Components

  1. Raspberry Pi (with case and cooling fan)
  2. Raspberry Pi board (e.g., Raspberry Pi 4B/3B+/3B)
  3. Official Raspberry Pi case
  4. Low-profile CPU cooling fan with aluminum alloy bracket and screws
  5. Heatsink for Raspberry Pi CPU
  6. Power supply for Raspberry Pi (USB-C or micro-USB, depending on model)
  7. Laptop
  8. Used for advanced processing, coding, and interfacing with the Raspberry Pi
  9. Dartboard
  10. Standard dartboard for gameplay and testing

2. Input/Output Devices

  1. Webcam
  2. 2K Full HD USB webcam (e.g., LECTRk 2K webcam) for capturing dart positions4
  3. 16x2 LCD Display Module
  4. 16x2 character LCD display (blue backlight, 16 pins)
  5. Optional: I2C interface module for easier wiring
  6. Jumper wires for connections

3. Wiring and Accessories

  1. Jumper Wires
  2. Male-to-female and female-to-female jumper wires for connecting components
  3. GPIO Header Pins
  4. For connecting the LCD and fan to the Raspberry Pi GPIO
  5. Screws and Mounting Hardware
  6. For securing the fan, heatsink, and display module

4. Dart Accessories

  1. Darts
  2. Standard steel-tip darts for use with the dartboard

5. Optional/Recommended

  1. MicroSD Card
  2. For Raspberry Pi OS and project files (at least 16GB recommended)
  3. USB Keyboard and Mouse
  4. For initial setup and troubleshooting
  5. HDMI Cable and Monitor
  6. For direct access to the Raspberry Pi during setup

6. Software

  1. Raspberry Pi OS
  2. Installed on the microSD card
  3. Python Libraries
  4. For camera interfacing, image processing (e.g., OpenCV), and LCD control

Training the AI Model for Dart Scoring

Step 1: Prepare Two High-Quality Datasets

  1. Begin by collecting two comprehensive datasets tailored to your project’s needs. For best results, ensure your images cover a wide variety of dart positions, lighting conditions, and angles. The more diverse and representative your datasets, the better your model will perform in real-world scenarios.

Step 2: Carefully Annotate Data Using Roboflow

  1. Upload your images to Roboflow and use its built-in annotation tools to meticulously label every dart and relevant feature in each image. Take your time with this step—accurate and consistent annotations are crucial for training a high-performing AI model. Double-check your labels for any mistakes or inconsistencies.

Step 3: Export and Download YOLOv8 Model Templates

  1. Once you’re confident in your annotations, export both datasets from Roboflow in the YOLOv8-compatible format. Download the YOLOv8 model templates for each dataset. This ensures your data is ready for efficient and effective training.

Step 4: Train Models Locally Using Your GPU

  1. Use your computer’s GPU to train both YOLOv8 models. Training locally with a GPU speeds up the process and allows you to experiment with different parameters and settings. Monitor the training progress and adjust hyperparameters (like learning rate, batch size, or number of epochs) to maximize your model’s accuracy and minimize errors.

Step 5: Evaluate and Optimize for Best Performance

  1. After training, rigorously evaluate your models using validation data. Check metrics such as precision, recall, and mean average precision (mAP). If results aren’t as high as you’d like, consider augmenting your dataset, refining annotations, or tweaking training settings. Repeat the training process as needed to achieve the highest possible accuracy.


Coding for the Raspberry Pi and Laptop Integration

IMG_20250618_195406330.jpg
IMG_20250618_195418892.jpg

After completing the training and evaluation of my YOLOv8 models, I began programming the system to run the dart scoring process in real time, with the webcam connected to the laptop rather than the Raspberry Pi. This setup allows the laptop to handle all image capture and computer vision processing tasks, leveraging its greater processing power for running the trained YOLO models efficiently.

System Workflow

  1. Webcam Connection:
  2. The webcam is connected directly to the laptop, which captures live images of the dartboard during gameplay.
  3. Model Inference:
  4. The laptop loads the trained YOLOv8 models and performs real-time inference on the captured images to detect dart positions and calculate scores automatically.
  5. Data Communication:
  6. The laptop processes the results and sends the calculated scores and relevant data to the Raspberry Pi for display and further integration with hardware components, such as the LCD module.
  7. Display and Feedback:
  8. The Raspberry Pi receives the processed data and displays the scores on the attached LCD module, ensuring players receive immediate feedback during the game.

Benefits of This Approach

  1. Efficient Processing:
  2. By using the laptop for image capture and AI inference, the system benefits from faster processing speeds and improved accuracy, especially when handling high-resolution images or complex models.
  3. Simplified Hardware Integration:
  4. The Raspberry Pi focuses on hardware control and display tasks, making the overall system more modular and easier to troubleshoot or upgrade.

This configuration ensures that the dart scoring system operates smoothly, with the laptop handling the demanding computer vision tasks and the Raspberry Pi managing real-time display and user interaction.

Downloads

Testing and Model Interference

After integrating the system, I began thorough testing and quickly noticed issues when running both models simultaneously—the segmentation and key point detection models interfered with each other, leading to inconsistent and inaccurate predictions.

Identifying the Problem

  1. Simultaneous Model Execution:
  2. Running both models at the same time caused conflicts, as their outputs sometimes overlapped or contradicted each other, especially when detecting dart positions near the bullseye.
  3. Accuracy Issues:
  4. The interference resulted in less reliable scoring, with the key point detection model struggling to accurately predict dart positions when the segmentation model was not properly aligned.

Implementing a Solution

To address these flaws, I developed a new workflow:

  1. Bullseye Segmentation and Locking:
  2. I modified the segmentation model to first search for the bullseye and "lock" its position in each frame. This ensured a stable reference point for subsequent processing.
  3. Sequential Model Execution:
  4. Once the bullseye was locked, the two key point detection models were triggered. With the bullseye as a fixed anchor, these models could more accurately predict the positions of the darts relative to the center of the board.
  5. Improved Accuracy:
  6. This approach significantly reduced interference between the models and improved the overall accuracy and reliability of the dart scoring system.

Summary:

By restructuring the workflow so that the segmentation model establishes a fixed bullseye position before running the key point detection models, I was able to resolve the interference issue and achieve more precise dart position predictions.

Customization and Future Improvements

Once the core system is up and running, you have the flexibility to modify or expand the project as long as you don’t interfere with its main mechanics1. The codebase is designed to be adaptable, so there’s always room for improvement and personalization.

Ways to Enhance the Project

  1. Add New Game Modes:
  2. Players can program additional dart games or scoring variations, making the system more versatile and fun.
  3. Implement Perspective Correction:
  4. You can improve accuracy by adding perspective transformation features, allowing the system to adapt to different camera angles or dartboard placements.
  5. Expand User Interface:
  6. It’s easy to add more buttons or controls—such as for resetting scores, switching modes, or adjusting settings—depending on your needs and preferences.
  7. Integrate More Hardware:
  8. Consider adding features like sound effects, LED indicators, or wireless connectivity for an even richer experience.

Open for Personalization

The project’s modular design means you can experiment and upgrade without breaking its core functionality. Whether you want to tweak the visuals, add new features, or refine the detection algorithms, it’s all up to you. This flexibility encourages ongoing learning and innovation, making the system a great platform for both beginners and advanced makers.

In summary:

Feel free to build on the foundation, customize the experience, and innovate as much as you like—there’s always room to make it your own!