DEV Community

Cover image for Neuro Focus: AI-Powered Android Camera Sensing for Healthier Work Habits with Presage SmartSpectra SDK
Alfino Hatta
Alfino Hatta

Posted on Edited on

Neuro Focus: AI-Powered Android Camera Sensing for Healthier Work Habits with Presage SmartSpectra SDK

Presage SmartSpectra SDK Challenge Submission

This is a submission for the Presage SmartSpectra SDK Challenge

What I Built

A Pomodoro timer doesn't care how you're doing. Twenty-five minutes on, five off, whether you're in the zone or running on fumes. I wanted to see what happens when the timer pays attention to you instead.

Neuro Focus is an Android app that uses the front camera, with no wearable, to read your pulse and breathing rate during a work session. It then uses those readings to adapt the session:

  • A soft ring around the timer shifts from teal to amber as your signal climbs, so you notice it out of the corner of your eye instead of through a popup.
  • When pulse and HRV suggest you've been running hot for a while, it suggests a short break, a breathing exercise or a quick stretch.
  • Guided breathing (4-7-8, Box, and a 4/6 resonance pattern) is one tap away, with an animated pacing ring and spoken cues.
  • A 10-second scan shows pulse, breathing rate, HRV and a signal-quality label, so you know how much to trust a reading.
  • Thresholds are set against your own rolling 7-day baseline, not a textbook average.

It's a personal productivity tool. It doesn't diagnose or treat anything, and it isn't built to be watched by anyone but you.

Code

Public repository (MIT licensed, with setup instructions in the README):

github.com/alfinohatta/neuro

git clone https://github.com/alfinohatta/neuro.git
cd neuro
# in ~/.gradle/gradle.properties (never commit this):
# PRESAGE_SMARTSPECTRA_API_KEY=your_key_here
./gradlew app:installDebug
Enter fullscreen mode Exit fullscreen mode

You need JDK 17+, Android Studio, and Android 9+ (API 28). On an emulator, point the front camera at your webcam and cold boot. The Spring Boot backend in the repo is optional; the app runs without it.

How It Responds to Human Signals

The app uses pulse, breathing rate and HRV (SDNN / RMSSD).

Everything starts in SmartSpectraManager, the one class that talks to the Presage SDK. It passes in the API key (injected through BuildConfig at build time so it stays out of Git) and exposes the readings as Kotlin flows. The rest of the app never touches the SDK, it just collects a stream of measurements.

From there, a FocusSessionViewModel ticks once a second and hands the latest pulse, HRV, breathing rate and elapsed time to a small rule-based AdaptiveRecommendationEngine. I kept it as plain, readable rules, for example "pulse above ~92 BPM or HRV below ~30 ms plus a long stretch of work", because I'd rather you be able to see why the app told you to rest than trust a black box. A BaselineCalibrationEngine keeps a 7-day weighted average so "high" means high for you.

The aura is a Compose canvas element that maps the live signal to color. HRV and the other derived metrics come from inter-beat intervals: heart rate as 60000 / mean(IBI), SDNN as the standard deviation of intervals, RMSSD from successive differences.

Two practical things I learned the hard way with CameraX: every ImageProxy has to be closed in a finally block or the preview freezes, and analyzer callbacks come in on a worker thread, so results go through the main executor before touching state.

One honest note: the app has a fallback. If the SDK or a key is missing, the status line changes from SmartSpectra Ready to CameraX PPG Sensing Ready and my own luminance-based estimator takes over. I built it so the app and its tests run without a key, and the UI always says which source is active.

Prize Categories

I'm entering both categories.

Best Thoughtful Real-World Use. Plenty of people, such as students, developers and remote workers, are told when to rest by a schedule that has nothing to do with their body. Biofeedback usually means buying a wearable, which leaves a lot of people out. Neuro Focus works with the phone you already have. It's built for individuals, with no employer dashboard and no ranking. Sensing is opt-in, consent can be revoked in one place, results come with a quality label, and there's a high-contrast mode for bright light.

Most Creative or Delightful Use. I wanted biofeedback that feels ambient instead of clinical: a color you sense rather than a number you stare at, a breathing ring you can follow, and a timer that quietly changes its advice based on how you're doing.

Consent and Data Handling

Consent

The camera stays off until you opt in on the first-run screen, which explains what is measured and why. Camera sensing, signal telemetry, local analytics and terms are separate toggles, and the camera pipeline won't start without camera consent (on top of the Android permission). You can revoke at any time in Profile, which stops the camera and discards the in-memory buffers. Grants and revocations are timestamped. Scanning only happens on a visible screen you started.

Video

No video or photos are recorded, saved or uploaded. Frames are processed in memory and released right away.

Storage and sharing.

  • On the device, readings live in memory while the app runs. Nothing is written to disk unless you tap Export CSV, which saves a file to Downloads that you can delete.
  • The repo includes an optional self-hosted Spring Boot + MySQL backend. Only if you point the app at a server are derived values (pulse, breathing and HRV numbers with timestamps), sessions and consent records synced to it. I don't run any hosted service.
  • Google Health Connect sync is an opt-in toggle in Profile.
  • I don't sell readings or use them for advertising, and there is no employer or third-party dashboard.
  • Deletion: revoking consent clears the in-memory buffers, CSV exports are ordinary files you control, and a self-hosted backend is controlled by whoever runs it.

SDK telemetry and AI. The Presage SmartSpectra SDK is third-party, and what it processes or transmits is governed by Presage's own documentation and terms, which I haven't modified. The app also includes an optional AI assistant feature behind a feature flag (FEATURE_FLAG_AI_ASSISTANT in .env.example); camera frames and images are never passed to it, since every frame is discarded in memory right after analysis. The full list of dependencies, including any analytics or telemetry components, is in app/build.gradle.kts in the public repo. In-session break and breathing suggestions come from the local rule-based engine, not a remote service.

Not medical. Neuro Focus is a wellness and productivity tool. It makes no diagnosis or treatment claims and offers no medical decision support. The UI uses plain wellness language such as "a good moment for a short break", and it isn't a substitute for professional advice.


Thank You

Built by Alfino Hatta for the Presage SmartSpectra SDK Challenge.

Thanks to Presage for the SmartSpectra SDK and to DEV and Major League Hacking for running the challenge. Making human-sensing software something a solo developer can experiment with, using nothing but a phone camera, is what made this project possible.

If you try Neuro Focus, I'd love to hear your feedback. Open an issue or leave a comment on the repository:

https://github.com/alfinohatta/neuro

Top comments (6)

Collapse
 
userxnom profile image
Abdullah Naseer •

I really liked that you set thresholds against a 7-day rolling baseline instead of a textbook average — "high for you" makes a lot more sense for pulse and HRV, which vary so much from person to person. The teal-to-amber ring is a nice ambient cue too, rather than another number to stare at while you are supposed to be focusing. The CameraX note about closing every ImageProxy in a finally block is the kind of detail that saves someone a frozen preview. How did the 7-day baseline behave in your own testing — did it settle quickly enough in the first few days to give useful break suggestions, or did it need a full week before the recommendations felt right?

Collapse
 
alfinohatta profile image
Alfino Hatta •

progressively!

Collapse
 
artyompaskov profile image
Artyom •

ngl this is pretty cool 🔥

Collapse
 
alfinohatta profile image
Alfino Hatta •

haha thanks man, appreciate it! 🔥

Collapse
 
reni profile image
reni fitriani •

semangatt fino 🔥

Collapse
 
alfinohatta profile image
Alfino Hatta •

terima kasih banyak, bu reni 😄