Skip to content

daolytica/CosmicFinder

Repository files navigation

Cosmic Detector

A professional scientific Android application for cosmic ray detection using your phone's camera sensor. Based on the DECO (Distributed Electronic Cosmic-ray Observatory) methodology from WIPAC.

Open the project in Android Studio (File → Open → select this folder), then Sync Project with Gradle Files and run on a device (API 26+). Requires a physical device with a camera; emulators are not supported.

Features

  • Real Camera-Based Detection: Uses phone camera sensor to detect actual cosmic ray events (no simulation)
  • Automatic Calibration: Measures background noise over 30 samples before detection begins
  • Two-Stage Analysis:
    • Stage 1: Candidate detection (bright pixel identification)
    • Stage 2: Event classification (particle type identification)
  • Real-time Statistics: Track total events, events per minute, and detection time
  • Event Logging: Comprehensive database with geolocation data
  • Particle Classification: Identifies muons, electrons, gamma rays, and alpha particles
  • Configurable Sensitivity: Adjust detection thresholds
  • Professional UI: Scientific interface designed for research use
  • Optional Backend: Connect to a WordPress site for event submission and (optionally) blockchain anchoring and token rewards

How It Works

The app implements the DECO methodology:

  1. Image Capture: Records camera images every 1–2 seconds
  2. Calibration: Measures background noise level over 30 samples (~30 seconds)
  3. Bright Pixel Detection: Analyzes each image for pixels exceeding noise threshold
  4. Candidate Detection: If enough bright pixels found, marks as candidate
  5. Event Classification: Performs detailed analysis to classify particle type based on spatial patterns
  6. Data Logging: Saves confirmed events with metadata and geolocation

The camera sensor detects:

  • Cosmic-ray muons: Linear tracks through the sensor
  • Electrons: Compact clusters
  • Gamma rays: Larger clusters
  • Alpha particles: From natural radioactive decay

Technology Stack

  • Kotlin 1.9+
  • Jetpack Compose – declarative UI
  • Material Design 3 – theme and components
  • CameraX / Camera2 – image capture
  • Room – local persistence
  • MVVM – architecture; Coroutines & Flow – async

Project Structure

app/src/main/java/com/cosmic/detector/
├── data/
│   ├── CosmicEvent.kt, CosmicEventDao.kt, AppDatabase.kt
│   ├── CosmicEventRepository.kt
│   └── blockchain/           # WordPress API client, offline queue
├── detection/
│   ├── advanced/              # Image analysis, clustering
│   ├── camera2/               # Camera capture
│   ├── ImageAnalyzer.kt, CameraDetectionService.kt
├── ui/
│   ├── theme/, screens/, navigation/, viewmodel/
└── utils/

Optional server-side pieces (not required to run the app):

  • WordPress plugin (cosmic-randomizer-tvec-connector.php) – REST API for registration and event submission
  • Node signing service (node-signing-service/) – optional token transfers and blockchain anchoring

Building the App

  1. Clone the repo and open the project in Android Studio.
  2. Sync Gradle (Android Studio will download Gradle if needed).
  3. Connect a device or start a physical device emulator with camera support.
  4. Run the app (e.g. Run → Run 'app').

Requirements: Android SDK 26+ (min), 34 (target). Physical device with camera; no emulator support for detection.

Usage

  1. Cover the camera lens (e.g. with electrical tape) to reduce background light.
  2. Place the phone face up, camera down, on a flat surface.
  3. Grant camera and location permissions when prompted.
  4. Tap Start; wait for calibration (~30 seconds).
  5. Detection runs automatically; monitor stats and events in the app.
  6. Adjust sensitivity and optional WordPress URL in Settings if you use a backend.

Tips: Cosmic ray events are rare (hours of runtime may be needed). Keep the device plugged in; detection is battery-intensive.

Requirements

  • Android SDK 26+ (Android 8.0+)
  • Physical device with camera
  • Camera and location permissions
  • Kotlin 1.9+, Android Studio Hedgehog or later (recommended)

License

This application is for scientific research and educational use.

Developed By Reza Mirfayzi

About

A professional scientific Android application for cosmic ray detection using your phone's camera sensor

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors