a session falling asleep — accelerometer calming, audio tasks thinning, predicted SOL descending

WEARABLE INTERVENTION SYSTEM FOR INSOMNIA

a computational approach to modeling and controlling sleep onset dynamics


role: end-to-end design and engineering


technology: watchOS/iOS, SwiftUI/Swift,
on-device real-time control loop,
Accelerate/vDSP signal processing (FFT),
Firebase data pipeline, Python, Matplotlib


date: 2023 — 2024

link: Master's Thesis (MIT)

Chronic insomnia is common, and its first-line treatment (CBT-I) faces real adherence and accessibility barriers. Zzzonic is a sleep-aid system for wearables that treats falling asleep as a control problem, providing an easy, non-pharmacological aid to be used in bed.

The system has three components: a multi-modal interface that delivers audio tasks and harvests behavioral signals, a predictor that turns those signals into a real-time estimate of sleep onset latency (SOL), and a controller that uses that prediction to strike a balance between engaging the user without keeping them awake. Together, they form a closed loop that attempts to drive sleep onset.

Zzzonic was evaluated through user trials run throughout its development — 49 sessions across 11 participants, spanning three conditions (interactive, noise-only, and silence), with a Dreem EEG headband used as ground truth against the Apple Watch's actigraphy.

the interface

The multimodal interface is designed to occupy the mind while collecting behavioral data for the predictor, all from the comfort of bed.

With eyes closed and hands free, the user hears two tones and judges whether the second is higher or lower, answering with a gentle wrist flick; a Tibetan-singing-bowl tone confirms correct or incorrect. The intensity of the experience is shaped by cadence (spacing between tasks), difficulty (tone discriminability), and volume.

prototype 1

Built with a website to quickly distribute and test basic elements of the interaction.

User testing revealed the experience was relaxing but required smarter control of the audio to be effective.

It also revealed a browser-based app limited control over system features (like screensavers) and made accidental browser interactions disruptive.

prototype 2

Built using a native iOS app to refine the interaction, offer better control over system features and test other modalities such as haptic feedback.

User testing revealed the audio control improved but was still insufficient.

It also revealed:

  • A) the need for customized audio since sounds are not universally relaxing
  • B) haptic feedback tended to increase arousal rather than relaxation
  • C) the required position restricted comfort in bed

prototype 3

Built as a stand-alone watchOS app to liberate the user from specific positions, utilize advanced health sensing for better audio control and test different interaction modalities.

User testing revealed insufficient but significant improvement of the audio control using wearable sensors.

A natural progression would be:

  • A) test the use of a DNN for improved sleep onset latency prediction and task control
  • B) offload analysis and control to a mobile app to improve battery life and robustness
  • C) experiment with shorter stimuli for tasks and other devices, such as a smart-mask

next steps

A purpose-built smart sleep mask would unlock access to richer biosignals, such as:

  • heart rate and heart rate variability in real time
  • eye movement
  • potentially EEG activity

It would be compatible with Sleep Focus and eliminate the need for background audio, making it more reliable and energy efficient.

Gentle red light stimuli would also be of shorter duration making it potentially less disruptive than audio and making behavioral monitoring more sensitive.

SCREEN INTERFACE

Apple Watch interface walkthrough: post-sleep rating, pre-sleep survey, start button, and user settings

the predictor

The predictor estimates how much time remains before a user falls asleep (SOL), providing the feedback signal for the controller. To do this it uses behavioral signals, such as response latency and gesture magnitude, which are proxies for cognitive acuity and muscle tone, both of which decline as sleep approaches.

For evaluation, a simple linear predictor combined actigraphy and these signals to estimate SOL. It successfully tracked changes in sleepiness but consistently predicted longer sleep onset latencies than observed. Future work should explore per-user calibration, dynamic signal weighting, additional sensing modalities, and machine learning.

fig 3: composite SOL prediction builder — toggle indicators to rebuild the estimate

the controller

The controller uses the predictor's sleepiness estimate (SOL) to adjust task intensity, turning sleep tracking into an active intervention that crowds out intrusive thoughts while minimizing arousal. It must strike a balance: tasks that are too demanding delay sleep onset, while tasks that are too sparse allow rumination to return.

A simple rational function was used as the control policy, but there was no evidence that it reduced SOL. User reports instead indicated that cadence, the timing between prompts, was the dominant factor: prompts that were too frequent delayed sleep onset, while those that were too sparse induced anticipatory arousal. More accurate SOL prediction and principled feedback control (e.g., PID) may improve performance.

fig 5: the "X-pattern" test — toggle the ideal controller to compare

the system

The system treats the human–computer interaction as a closed-loop controller that aims to minimize sleep onset latency (SOL). The interface occupies the mind while collecting behavioral data, the predictor estimates sleepiness from those signals and actigraphy, and the controller adjusts task intensity in response. Together, these components form an adaptive intervention rather than a passive sleep tracker.

UNDER THE HOOD

  • Real-time on-device loop: 1 Hz session and volume timers plus a cadence-driven probe timer, aggregating motion into 60-second epochs.
  • On-device DSP with Accelerate/vDSP: FFT breathing-rate analysis, least-squares fits, and moving-average smoothing.
  • A weighted linear SOL predictor feeding a rational-function cadence controller with an asymmetric rate limiter.
  • Firebase Auth + Realtime Database pipeline persisting structured Epoch / Probe / survey records.

fig 1: one interaction traced through the closed loop — interface → predictor → controller

projects/zzzonic/01