Skip to content

A low-cost IoT device that detects basketball makes/misses in real time using IR + vibration sensor fusion, paired with an Android app for live statistics tracking.

License

Notifications You must be signed in to change notification settings

omorros/bk-shoot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BK-Shoot

Real-time Basketball Shot Tracker with Sensor Fusion

A low-cost IoT device that detects basketball makes/misses in real time using IR + vibration sensor fusion, paired with an Android app for live statistics tracking.

Demo Video License: MIT Award


Demo

02_testing_video.mp4

Setup


Recognition

Award Competition Year
Honourable Mention 12th Planter de Sondeigs i Experiments (UPC, UAB, UB, Idescat) 2021
Presented ICFO Young Photonics Congress 2021

"Per unir l'estadistica, el Big Data, la intel·ligencia artificial i la programacio a l'esport..." — Jury Citation (For combining statistics, Big Data, AI, and programming with sports)

View certificates and full details


Tech Stack

Layer Technology
Hardware Arduino Uno, IR Sensor (E18-D80NK), Vibration Sensor (SW-420), HC-05 Bluetooth
Firmware C++ (Arduino), JSON serial protocol, sensor fusion algorithm
Mobile App MIT App Inventor (Android), Bluetooth serial, SQLite storage
Data Analysis SQL queries, statistical analysis by demographics

Architecture

graph TD
    subgraph HOOP ["BASKETBALL HOOP"]
        direction TB
        IR["IR Sensor<br>(E18-D80NK)"]
        VIB["Vibration Sensor<br>(SW-420)"]
        UNO["Arduino Uno"]
        HC05["HC-05 BT Module"]
        
        IR --> UNO
        VIB --> UNO
        UNO --> HC05
    end

    subgraph APP ["ANDROID APP"]
        direction TB
        BT_RX["Bluetooth Receiver"]
        STATS["Statistics Engine"]
        DB["SQLite Storage"]
        DASH["Live Dashboard:<br/>Attempts | Makes | Misses | FG% | Timer"]
        
        BT_RX --> STATS
        STATS --> DB
        STATS --> DASH
    end

    HC05 -.->|Bluetooth| BT_RX
Loading

How It Works

Sensor Fusion Algorithm:

The core innovation is combining two sensors to achieve accurate shot classification:

graph LR
    IR["IR Trigger<br>(ball passes rim)"] --> FUSION
    VIB["Vibration<br>(rim impact)"] --> FUSION
    FUSION["Fusion Window<br>(1000ms)"] --> CLASS["Classification"]
Loading
Scenario IR Vibration Result
Clean swish MAKE
Off-rim make MAKE
Rim-out miss MISS

Output Format (JSON over Bluetooth):

{"type":"make","ts":1234567}
{"type":"miss","ts":1237890}

Validation Results

Field-tested with 20+ participants and ~2,000 shots.

Metric Result
Detection Accuracy ~95%
Mean FG% (players) 78.2%
Throughput 24.5 shots/min
Detection Latency ~250ms
Battery Life >3 hours

Data Analysis

Shot data was exported to SQLite and analyzed by demographic factors:

Analysis by Dominant Hand Analysis by Age Group Baskets Distribution

See /testing/ for complete dataset and methodology.


Quick Start

# 1. Clone the repository
git clone https://github.com/omorros/bk-shoot.git

# 2. Upload firmware to Arduino
#    Open /firmware/bk-shoot.ino in Arduino IDE and upload

# 3. Build the Android app
#    Import /mobile/bk-shoot.aia into MIT App Inventor

# 4. Pair Bluetooth (HC-05, PIN: 1234)

# 5. Start shooting!

Pre-built APK: /mobile/bk-shoot.apk


Hardware

Circuit Diagram

Bill of Materials (~€25 total):

Component Model Purpose
Microcontroller Arduino Uno Main controller
IR Sensor E18-D80NK Ball detection
Vibration Sensor SW-420 Rim impact detection
Bluetooth HC-05/HC-06 Wireless communication
Feedback RGB LED + Buzzer Audio/visual feedback
Power 5V USB Power Bank Portable power

See /hardware/bom.md for complete BOM and /hardware/wiring-table.md for wiring details.


Challenges & Learnings

Building this project taught me:

Challenge Solution Learning
False positives from rim vibration without ball Implemented sensor fusion with time windowing Signal processing, debouncing
Bluetooth reliability issues Added JSON framing and error handling Serial protocols, data integrity
IR interference in sunlight Tuned threshold and added shading Sensor calibration, environmental factors
Data persistence in app Implemented SQLite storage Database design, SQL queries
Statistical validation Collected data from 20+ users, analyzed demographics Experimental design, data analysis

Technical skills developed:

  • Embedded C++ programming
  • Sensor fusion algorithms
  • Bluetooth serial communication
  • Mobile app development
  • SQL and data analysis
  • Scientific methodology (hypothesis, experiment, analysis)

Roadmap

v2.0 (Planned)

  • React Native app (cross-platform iOS + Android)
  • ESP32 with BLE (replace HC-05)
  • Cloud sync with Firebase
  • Web dashboard for coaches

v3.0 (Future)

  • TinyML on-device shot classification
  • Camera-based trajectory analysis
  • Multi-hoop support for team training

Project Structure

bk-shoot/
├── firmware/           # Arduino C++ code
│   └── bk-shoot.ino
├── mobile/             # MIT App Inventor project
│   ├── bk-shoot.aia    # Source
│   └── bk-shoot.apk    # Pre-built APK
├── hardware/           # Schematics and BOM
│   ├── circuit_image.png
│   ├── bom.md
│   └── wiring-table.md
├── testing/            # Validation data and analysis
│   ├── 02_testing_video.mp4
│   └── *.png           # Analysis graphs
├── docs/               # Technical documentation
│   ├── tech-note.md
│   └── *.pdf           # Scientific poster & abstract
├── recognition/        # Awards and certificates
│   ├── AWARDS.md
│   └── *.pdf
└── README.md

Documentation

Document Description
Technical Note Methodology, results, and discussion
Scientific Poster ICFO presentation poster
Abstract Scientific abstract (English)
Awards Competition recognition details

About

Author: Oriol Moros Vilaseca

This project was developed as a secondary school research project (Treball de Recerca) at age 15, combining my interests in basketball, electronics, and programming. It demonstrates end-to-end product development: from problem identification through hardware design, firmware development, mobile app creation, and statistical validation.


License

MIT License — see LICENSE


Citation

If you use this project in research or teaching:

@software{bkshoot2021,
  author = {Moros Vilaseca, Oriol},
  title = {BK-Shoot: Arduino + MIT App Inventor Basketball Shot Tracker},
  year = {2021},
  url = {https://github.com/omorros/bk-shoot}
}

See CITATION.cff for full citation information.

About

A low-cost IoT device that detects basketball makes/misses in real time using IR + vibration sensor fusion, paired with an Android app for live statistics tracking.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages