Skip to content

yelabb/Pinocchio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pinocchio - Cognitive Load Monitor for Garmin

Connect IQ License Platform

A Garmin Connect IQ widget that provides real-time biofeedback on your cognitive load (mental effort) using heart rate and heart rate variability (HRV) analysis. Track when your brain is working hardest.

image

⚠️ Important: This app measures mental effort, NOT deception. It cannot detect lies. Do not use for interrogation, employment decisions, or legal proceedings.

✨ Key Features

  • Real-Time Cognitive Load Tracking: Continuous analysis of HR and HRV (RMSSD) to measure mental effort
  • 4 Load Levels: Relaxed (0-30%), Focused (30-60%), Intense (60-85%), Overload (85-100%)
  • Response Detection: Identifies acute cognitive load spikes (HR↑ 7% + HRV↓ 15%)
  • Event Markers: Mark questions/tasks with button press to track physiological responses
  • Load History Graph: Visual timeline of cognitive load over the last 60 seconds
  • Trend Analysis: See if your cognitive load is rising, falling, or stable
  • Sustained Load Alerts: Vibration nudges when mental effort is high for extended periods
  • Memory-Efficient: ~1.2KB total buffer usage, designed for Garmin's strict constraints
  • 75+ Compatible Devices: Fenix, Forerunner, Venu, Vivoactive, Epix, and more

🧠 Scientific Basis

Pinocchio is grounded in peer-reviewed research on cognitive load detection:

Key Studies

  • Mehler et al. (2012): HR↑ 5-10 bpm and HRV↓ 20-30% during high cognitive load
  • Hjortskov et al. (2004): RMSSD decreased 25% during cognitive tasks vs rest
  • Cinaz et al. (2013): 73% accuracy classifying low/medium/high load from HR + HRV

The Algorithm

$$\text{Cognitive Load} = \frac{(\text{Arousal} + 1)}{2} \times 100%$$

Where: $$\text{Arousal} = \frac{0.6 \cdot Z_{HR} + 0.4 \cdot (-Z_{RMSSD})}{3}$$

  • Higher HR (relative to baseline) → Higher Load
  • Lower RMSSD (relative to baseline) → Higher Load

📊 The 4 Cognitive Load Levels

Level Range Color Description Physiology
Relaxed 0-30% 🟢 Green Low mental effort HR low, HRV high
Focused 30-60% 🟡 Yellow Moderate concentration HR/HRV normal
Intense 60-85% 🟠 Orange High cognitive strain HR elevated, HRV reduced
Overload 85-100% 🔴 Red Mental resources depleted HR high, HRV suppressed

🎯 Use Cases

✅ Recommended Uses

  • Self-awareness: Understand when your brain is working hardest
  • Study optimization: Find your peak focus periods
  • Interview practice: Monitor and reduce interview anxiety
  • Work stress tracking: Identify high-stress periods in your workday
  • Gaming performance: Track cognitive load during competitive gaming
  • Meditation validation: Confirm relaxation techniques are working

❌ NOT Recommended

  • Lie detection or deception detection
  • Employment screening
  • Legal or interrogation purposes
  • Medical diagnosis
  • Any consequential decision-making about others

📱 Views

View 1: Load Meter (Main)

  • Large cognitive load percentage
  • Color-coded load bar
  • Current HR and HRV metrics
  • Trend indicator (↑ rising, → stable, ↓ falling)

View 2: Load Graph

  • 60-second load history timeline
  • Event markers shown as vertical lines
  • Peak and average load stats

View 3: Event Log

  • List of marked events with timestamps
  • Response magnitude for each event
  • Summary statistics

🎮 Controls

Action Function
Tap Cycle through views
Long Press / Menu Mark event (question/task)
Swipe Up Mark event (alternative)
Swipe Down Reset/recalibrate

🏗️ Project Structure

File Purpose
source/PinocchioView.mc Main UI with 3 view modes
source/CognitiveLoadMapper.mc Maps (HR, RMSSD) → Load %
source/ResponseDetector.mc Detects acute load spikes
source/LoadAnalyzer.mc Tracks load history and trends
source/EventLog.mc Manages event markers
source/BiometricCollector.mc Sensor polling at 1Hz
source/RMSSDCalculator.mc RMSSD from RR intervals
source/HRVStabilityAnalyzer.mc HRV stability metrics
source/CalibrationManager.mc Baseline calibration
source/AlertManager.mc Sustained load alerts

🛠️ Build Commands

# Set SDK path
$SDK = "C:\Users\guzzi\AppData\Roaming\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-8.4.0-2025-12-03-5122605dc"

# Build PRG for specific device (for sideloading/testing)
& "$SDK\bin\monkeyc.bat" -f monkey.jungle -o bin/Pinocchio.prg -d fenix7 -y developer_key -w

# Build universal IQ file (for store upload)
& "$SDK\bin\monkeyc.bat" -f monkey.jungle -o bin/Pinocchio.iq -y developer_key -r -w

# Run in simulator
& "$SDK\bin\connectiq.bat"  # Start simulator first
& "$SDK\bin\monkeydo.bat" bin/Pinocchio.prg fenix7

📖 Memory Budget

Component Memory (bytes)
RMSSDCalculator 360
HRVStabilityAnalyzer 240
ResponseDetector 80
LoadAnalyzer 240
EventLog 160
CalibrationManager 80
AlertManager 40
Total ~1200

Well within Garmin's 28-64KB limits.

⚖️ Ethical Guidelines

User Guidelines

  • ❌ Do NOT use for interrogation or accusations
  • ❌ Do NOT use for employment decisions
  • ❌ Do NOT use on others without informed consent
  • ❌ Do NOT rely on for legal/medical decisions
  • ✅ DO use for self-awareness and cognitive training
  • ✅ DO recognize individual variation and context
  • ✅ DO treat results as probabilistic, not definitive

Why This Isn't a Lie Detector

Traditional polygraphs require:

  • Electrodermal activity (skin conductance) - not available on watches
  • Respiratory patterns - not available on most watches
  • Blood pressure - not available on consumer wearables
  • Controlled questioning environment - not possible with a widget

What we CAN reliably detect:

  • ✅ Cognitive load / mental effort
  • ✅ Acute stress response
  • ✅ Sustained arousal

What we CANNOT detect:

  • ❌ Intent to deceive
  • ❌ Deception vs fear of disbelief
  • ❌ Specific thoughts or knowledge

📚 Scientific References

  1. Mehler, B., et al. (2012). "Sensitivity of Physiological Measures for Detecting Systematic Variations in Cognitive Demand." Human Factors, 54(3), 396-412.

  2. Hjortskov, N., et al. (2004). "The effect of mental stress on heart rate variability and blood pressure during computer work." European Journal of Applied Physiology, 92(1-2), 84-89.

  3. Cinaz, B., et al. (2013). "Monitoring of Mental Workload Levels During an Everyday Life Office-work Scenario." Personal and Ubiquitous Computing, 17(2), 229-239.

  4. National Research Council (2003). The Polygraph and Lie Detection. National Academies Press.

🔧 Supported Devices

75+ devices including:

  • Fenix 7/8 series, Epix 2
  • Venu 2/3/4 series
  • Forerunner 165, 255, 265, 570, 955, 965, 970
  • Vivoactive 5/6
  • Instinct 3 series
  • MARQ Gen 2
  • D2 Air/Mach series

📜 License

MIT License - See LICENSE file for details.

🙏 Credits

Forked from the Affect project - Real-Time Affective State Tracker.


Tagline: "Pinocchio - Know when your brain is working hardest"

About

Cognitive Load Monitor for Garmin

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published