DEV Community

Cover image for Cool Vitals: Building a Real-Time Biometric Truth or Lie Experience with Presage SmartSpectra
Kyle Keon
Kyle Keon

Posted on

Cool Vitals: Building a Real-Time Biometric Truth or Lie Experience with Presage SmartSpectra

Presage SmartSpectra SDK Challenge Submission

Cool Vitals: Building a Real-Time Biometric Truth or Lie Experience with Presage SmartSpectra

This is a submission for the Presage SmartSpectra SDK Challenge.

What I Built

Cool Vitals: Real-Time Biometric Deception Detector & Statement Logger is an interactive Android application built with Kotlin, Jetpack Compose, Firebase Firestore, and the Presage SmartSpectra Android SDK (com.presagetech:smartspectra:3.4.0).

Inspired by classic polygraph tests and party interrogation games, Cool Vitals transforms a standard smartphone's front-facing camera and microphone into a live, playful biometric analysis experience.

Instead of attaching physical finger clips or chest straps, users simply sit in front of their phone's camera and speak naturally.

As they talk, the application:

  1. Measures physiological signals in real time. Using the Presage SmartSpectra SDK, Cool Vitals tracks pulse rate (BPM), breathing rate (RPM), Heart Rate Variability (HRV RMSSD), facial expression indicators, and live arterial and respiratory plethysmography waveforms.

  2. Establishes a personalized baseline. A rolling baseline measures the user's resting physiological readings, allowing the application to compare subsequent measurements against their individual starting point rather than relying entirely on static thresholds.

  3. Transcribes spoken statements. Android's SpeechRecognizer continuously transcribes spoken statements, with an alternative for manual text entry. Each finalized sentence is paired with a snapshot of the speaker's physiological readings at the time it was spoken.

  4. Evaluates physiological anomalies. A weighted scoring engine generates a Deception Index (0–100%) and identifies changes such as elevated pulse, rapid breathing, and reduced HRV. Statements receive either a TRUTH / CALM or LIE FLAGGED classification based on the configured scoring thresholds.

  5. Maintains a searchable cloud history. Google Sign-In and Firebase Cloud Firestore allow users to review previous sessions, inspect statement-level physiological readings, filter results by All, Flagged Lies, or Truths, and delete individual records whenever they choose.

Important: Cool Vitals is designed exclusively for entertainment, self-awareness, and playful social experiments. Physiological arousal cannot establish whether someone is telling the truth. The application is not intended for clinical diagnosis, medical decision-making, or real-world legal or security polygraphy.

Demo

GitHub logo ProphetDiceBot / Cool-Vitals-Building-a-Real-Time-Biometric-Truth-or-Lie-Experience-with-Presage-SmartSpectra

This is a submission for the Presage SmartSpectra SDK Challenge What I Built Cool Vitals: Real-Time Biometric Deception Detector & Statement Logger is an interactive Android application built with Kotlin, Jetpack Compose, Firebase Firestore, and the Presage SmartSpectra Android SDK (com.presagetech:smartspectra:3.4.0). Inspired by classic polygraph

The demonstration should showcase:

  • Live Presage SmartSpectra camera integration.
  • Real-time arterial pulse and respiratory waveforms.
  • Live BPM, RPM, and HRV readings.
  • Speech-to-text transcription.
  • Physiological baseline tracking.
  • Real-time Deception Index updates.
  • Statement logging and historical session review.

Code

Public Repository: [https://github.com/ProphetDiceBot/Cool-Vitals-Building-a-Real-Time-Biometric-Truth-or-Lie-Experience-with-Presage-SmartSpectra]

Technology Stack

Component Technology
Language Kotlin
UI Framework Jetpack Compose
Biometric Processing Presage SmartSpectra SDK 3.4.0
Camera Android CameraX / SmartSpectraView
Speech Recognition Android SpeechRecognizer
Authentication Firebase Authentication / Google Sign-In
Cloud Storage Firebase Cloud Firestore
Architecture MVVM

Setup Instructions

Prerequisites

  • Android Studio (Meerkat, Ladybug, or newer).
  • JDK 11 or newer.
  • Android SDK 36.
  • Physical Android device running API 28 or newer.
  • Presage SmartSpectra API key.
  • Firebase project with Authentication and Cloud Firestore enabled.

1. Clone the repository

Clone the public repository and open the project in Android Studio.

2. Configure your Presage SmartSpectra API key

Obtain your API key from Presage Physiology.

Copy .env.example to .env in the project root and configure:

SMARTSPECTRA_API_KEY=your_presage_api_key_here
Enter fullscreen mode Exit fullscreen mode

The Secrets Gradle Plugin injects the key into BuildConfig.SMARTSPECTRA_API_KEY during the build process, preventing the key from being hardcoded in source control.

3. Configure Firebase

Place your google-services.json file inside:

app/google-services.json
Enter fullscreen mode Exit fullscreen mode

Ensure Firebase Authentication (Google Sign-In) and Cloud Firestore are enabled.

4. Build the application

Run the following command from the project root:

./gradlew :app:assembleDebug
Enter fullscreen mode Exit fullscreen mode

5. Install and launch

Install the resulting APK on a physical Android device (API 28+) with a working front-facing camera and microphone.

How It Responds to Human Signals

Live Presage Signals Used

Cool Vitals subscribes to SmartSpectraSdk.shared using SmartSpectraMode.CONTINUOUS, extracting five categories of physiological and facial data from MetricsProto.MetricsBuffer, MetricsProto.Metrics, and the edge metrics pipeline.

1. Pulse Rate

metricsBuffer.pulse.rateList

Provides the latest heart rate in beats per minute (BPM), together with measurement confidence.

2. Breathing Rate

metricsBuffer.breathing.rateList

Provides the latest respiratory rate in breaths per minute (RPM), together with measurement confidence.

3. Heart Rate Variability (HRV RMSSD)

metricsBuffer.pulse.hrv / rmssd

Extracts HRV RMSSD measurements in milliseconds from the SDK's pulse telemetry.

4. Facial Expression and Emotion Indicators

edgeMetrics.face

Provides facial expression and activation indicators through the edge metrics pipeline.

5. Real-Time Plethysmography and Respiratory Waveforms

  • edgeMetrics.pulse.traceList
  • edgeMetrics.breathing.upperTraceList

Provides high-frequency arterial pulse and upper-chest respiratory traces, which are rendered using custom Jetpack Compose Canvas oscilloscopes.

How the Experience Responds in Real Time

When a user starts a scan through the embedded SmartSpectraView, the DeceptionViewModel maintains a rolling 30-sample baseline window for resting pulse and breathing measurements.

This baseline allows the application to evaluate changes relative to the individual user rather than treating every person as physiologically identical.

Baseline Delta Tracking

When the speaker is relatively calm, live readings remain close to their rolling baseline:

  • baselinePulseBpm
  • baselineBreathingRpm

The application uses these measurements to inform its Deception Index, displaying the cool cyan and emerald TRUTH / CALM interface when the score remains below 50%.

Physiological Anomaly Scoring

The DeceptionEvaluator.evaluate() engine calculates a composite score between 0 and 100 using four weighted physiological indicators.

1. Pulse Elevation (Δ BPM)

  • Increase of +12 BPM: +35 points.
  • Increase of +6 BPM: +20 points.
  • Absolute pulse reading above 98 BPM: additional anomaly trigger.

The application records an anomaly such as:

Elevated pulse (+X BPM above baseline)

2. Respiratory Shift (Δ RPM)

  • Increase of +4.5 RPM: +25 points.
  • Increase of +2.5 RPM: +15 points.
  • Respiratory rate of 21 RPM or higher: anomaly trigger.
  • Respiratory rate below 9 RPM: anomaly trigger.

3. HRV Suppression (RMSSD)

  • RMSSD below 24 ms: +25 points.
  • RMSSD below 35 ms: +12 points.

The evaluator records an anomaly such as:

Suppressed HRV (RMSSD X ms)

4. Facial Tension and Micro-Expressions

Tense, surprised, or fearful facial indicators contribute an additional +15 points.

Immediate Visual and Transcript Feedback

Whenever the composite score reaches or exceeds 50%, the application switches its telemetry banner from emerald green to high-contrast crimson.

The interface then:

  • Updates the live Deception Index meter.
  • Displays the LIE FLAGGED classification.
  • Identifies the physiological anomalies contributing to the score.
  • Associates the relevant measurements with the spoken statement.
  • Stores the statement and its physiological snapshot in the History Log.

For example:

Elevated pulse (+8.4 BPM above baseline) • Rapid breathing (+3.2 RPM above baseline)

This makes the experience more transparent by showing which measurements contributed to a particular classification.

These classifications represent physiological anomaly scores, not verified deception. Stress, excitement, movement, laughter, and other factors can produce similar physiological changes.

SDK Integration Walkthrough

Integrating com.presagetech:smartspectra:3.4.0 into Jetpack Compose centered on three primary implementation patterns.

1. Initialization and XML Service Configuration

The application configures res/xml/presage_services.xml with oauth_enabled = false for API-key authentication.

The SDK is initialized inside MainActivity using front-camera continuous mode:

private val smartSpectraSdk: SmartSpectraSdk by lazy {
    SmartSpectraSdk.getInstance().apply {
        if (BuildConfig.SMARTSPECTRA_API_KEY.isNotBlank()) {
            setApiKey(BuildConfig.SMARTSPECTRA_API_KEY)
        }

        setSmartSpectraMode(SmartSpectraMode.CONTINUOUS)
        setCameraPosition(CameraSelector.LENS_FACING_FRONT)
        setShowFps(false)
    }
}
Enter fullscreen mode Exit fullscreen mode

This establishes the SDK configuration before the biometric scanning experience begins.

2. Embedding SmartSpectraView in Jetpack Compose

Using Compose's AndroidView, we embedded the SDK's camera preview and onboarding overlay directly into the application's Material 3 scanner card.

The implementation also observes the SDK's MetricsBuffer and EdgeMetrics observers on the main thread.

This allows the application to combine the native SmartSpectra camera experience with a fully customized Jetpack Compose interface.

3. Pairing Speech Recognition with Biometric Telemetry

Android's SpeechRecognizer operates alongside the SmartSpectra SDK in a continuous listening loop.

When onResults finalizes a spoken sentence, DeceptionViewModel.logSpokenStatement():

  1. Captures the current VitalsSnapshot.
  2. Passes the snapshot into DeceptionEvaluator.evaluate().
  3. Calculates the physiological anomaly score.
  4. Associates the result with the transcribed statement.
  5. Updates the rolling baseline.
  6. Writes the resulting record to Firebase Cloud Firestore.

The result is a synchronized statement history where every recorded sentence can be reviewed alongside the physiological measurements captured at that moment.

Prize Categories

Most Creative or Delightful Use

We are entering Most Creative or Delightful Use.

Most health-tech demonstrations treat physiological SDKs as passive medical dashboards: displaying a heart rate number on a screen without giving the user much reason to interact with it.

We wanted to approach the technology differently.

The idea behind Cool Vitals was to create something immediately social, dramatic, and entertaining: a contactless, voice-reactive Truth or Lie interrogation studio that fits in your pocket.

Instead of simply displaying biometric readings, we turned those signals into an interactive experience that people can explore with friends.

What makes Cool Vitals original and playful?

Zero Wearables Required

Imagine passing a smartphone around a table during a game of Two Truths and a Lie.

A friend makes a statement, and everyone can watch their pulse waveform, respiratory readings, and physiological indicators change in real time.

There are no finger clips, chest straps, or additional hardware required. The experience uses the smartphone's camera.

Explainable Biometric Verdicts

Rather than presenting a random spinner or an arbitrary result, every LIE FLAGGED classification displays the physiological measurements that contributed to the score.

For example:

Elevated pulse (+8.4 BPM above baseline) • Rapid breathing (+3.2 RPM above baseline)

This makes the experience more interactive and gives users something tangible to discuss.

Live Biometric Cockpit

The interface is designed around a high-contrast dark oscilloscope aesthetic.

Live arterial pulse and upper-chest respiratory waveforms sit alongside:

  • Real-time physiological readings.
  • A live speech-to-text ticker.
  • A personalized baseline.
  • An animated Deception Index.
  • Immediate statement classifications.

The goal was to make invisible physiological signals visible, understandable, and entertaining.

Consent and Data Handling

Privacy, explicit consent, and transparent data controls are fundamental to Cool Vitals.

1. Explicit Camera and Microphone Consent

The application never accesses the camera or microphone silently or in the background.

Before starting a scan or voice transcription:

  • The application presents an in-app permission explanation.
  • Camera permission is requested for contactless physiological sensing through SmartSpectra.
  • Microphone permission is requested for live speech-to-text transcription.
  • Standard Android runtime permissions are handled using ActivityResultContracts.RequestPermission.

Whenever sensing is active, the SmartSpectra camera preview and a visible LISTENING or MIC PAUSED status indicator remain displayed.

2. SDK Telemetry and Processing

Physiological signals, including pulse, breathing, HRV, facial indicators, and waveforms, are processed through the Presage SmartSpectra SDK (com.presagetech:smartspectra:3.4.0) using the configured API key.

Raw camera frames are never saved to disk or uploaded to the application's database.

Voice transcription uses Android's built-in android.speech.SpeechRecognizer only when the user enables the microphone using the VOICE ON control.

Users can also keep the microphone muted and manually enter statements.

3. Storage, Retention, and User-Controlled Deletion

Statement records are stored in Google Cloud Firestore.

Each record contains:

  • Transcribed statement text.
  • Timestamp.
  • Computed physiological anomaly score.
  • Classification boolean.
  • Numerical physiological snapshot.

Records are isolated under individual authenticated user paths:

/users/{userId}/statement_logs/{logId}
Enter fullscreen mode Exit fullscreen mode

Firestore Security Rules enforce authenticated ownership, ensuring users can only read, create, or delete their own records through the application's authorized access.

Users can delete individual statement records at any time using the delete control in the History Log tab. This immediately removes the corresponding document from Firestore.

4. Non-Medical and Entertainment Disclosure

Cool Vitals does not make medical, diagnostic, clinical, or legal truth-verification claims.

Changes in heart rate, breathing, and HRV can reflect general autonomic arousal, including stress, excitement, nervousness, or laughter.

A physiological response is not proof of deception.

The application is intended for entertainment and self-awareness, not for making decisions about someone's honesty, health, employment, safety, or legal circumstances.

Agent Session

Cool Vitals was built iteratively using Google AI Studio Build, powered by Gemini.

The development process covered several major implementation areas:

  • Integrating the Presage SmartSpectra Android SDK (3.4.0) with Jetpack Compose.
  • Configuring res/xml/presage_services.xml.
  • Building the real-time DeceptionEvaluator baseline-delta scoring engine.
  • Implementing the continuous Android SpeechRecognizer pipeline.
  • Pairing spoken statements with physiological snapshots.
  • Provisioning Firebase Authentication using Credential Manager and Google Sign-In.
  • Implementing Cloud Firestore persistence and user-specific statement histories.
  • Verifying Firestore security rules through local emulator tests, including firestore.test.js and StatementRepositoryRuleTest.

Built with Kotlin, Jetpack Compose, Firebase, Gemini, and the Presage SmartSpectra SDK.

Cool Vitals — Your physiology, your statements, your interrogation room.

Top comments (0)