What is the best way, using technology, to discern whether someone has gone from an awake state to a sleep state. Ideally, this would be something passive and non invasive/not limited to the room or location the person is in.

Ideally this thing would be:
1) efficient
2) cheap
3) easy to acquire
4) utilising the sensors of an existing hardware device, like a mobile phone
5) if it's an existing hardware device, it should have an API that can be used for developing/doing something useful with the awake/asleep data
6) if it's not an existing hardware device, and rather a novel method you've been able to think of, then it should be easily programmable. I don't want to have to import moonrock for one of it's inner components or something.

Think out of the box!

Dani AI

Generated

Building on ’s question and the comments from and , a practical, developer‑friendly strategy is to use sensors people already wear or sleep on (watches/rings, under‑mattress pads) and the platform APIs those products expose. That keeps the solution passive, portable and inexpensive compared with lab equipment, while still letting you collect time‑series data you can process programmatically.

Common, production‑ready entry points (examples):

  • Android: Google’s Sleep API offers inferred sleep/wake events derived from phone sensors. (Google Sleep API).
  • Consumer wearables: Fitbit and Oura publish sleep logs and time‑series via developer APIs you can fetch and analyse. (Fitbit Sleep API, Oura API docs).
  • Contactless mattress sensors / home devices: Withings and Emfit publish sleep events and data suitable for automated monitoring. (Withings developer docs). (developers.google.com)

A short, practical workflow you can implement quickly:

  • Pick hardware that matches your constraints (wearable vs mattress vs phone).
  • Obtain API access and a test account; stream or pull nightly time series.
  • Start with simple rules for sleep onset (sustained low activity + contextual clock/time window), log results, then refine with personalization or an ML classifier trained on labeled nights.
  • Validate against ground truth (sleep log or a clinical reference) and iterate. (pmc.ncbi.nlm.nih.gov)

Notes, caveats and troubleshooting tips:

  • Actigraphy and consumer devices are validated for estimating sleep/wake and patterns over nights but are not a replacement for clinical polysomnography; expect misclassification (quiet wakefulness vs sleep). See AASM position on actigraphy.
  • If you need fully contactless, radar and under‑mattress methods show strong results in research; smartphone microphone/sonar approaches can detect breathing/snoring for apnea screening but have environment limits. Test for multi‑person beds, API sync delays, battery/sync windows and service/subscription rules (some APIs limit realtime access). (ubicomplab.cs.washington.edu)

Short, focused testing and careful consent/privacy handling will get you a reliable, developer‑accessible awake→sleep detector without clinical wiring.

Recommended Answers

All 2 Replies

The only way I know to be sure a person is asleep involves sensing brainwaves via electrodes on their head. You could probably get a decent proxy using some combination of motion/muscle tension, heart rate, respiration rate. Some stages of sleep can be detected using video of the person sleeping (eg. eye movements associated with REM sleep) but not the precise time of the transition from sleep to awake.

Member Avatar for Member #120589

I was thinking brainwaves too (more theta / delta waves) - but these do require electrodes. Been a while since I was involved with this stuff, but I remember measuring saccadic eye movements and we had to scrape off some skin to make a good contact with the electrodes (with conducting gel). Not sure if things have moved on in 25 years.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.