Introduction: GoodSleep
When was the last time that you had a good sleep? How often have you had a good sleep? Bad sleep can possibly be a thing of the past.
Moodiness, Fatigue, Forgetfulness and Sleep Apnea. The one thing that all of these conditions have in common is that they can all be influenced by a good nights sleep.
In the United States, sleep related productivity loss on average cost employers, annually, about $2000 per employee. Productivity loss can be caused by many situations that range from involuntary microsleep to performance deterioration. To understand the cost of poor sleep sessions, one typically enrolls in a sleep study. These studies involve dedicated facilities with costly instrumentation setup. Being away from one’s normal sleep environment, these studies are costly and may generate skewed results.
With the project GoodSleep, we asked, can a restful night of sleep be quantified and optimized in the comfort of one’s own home? Can we effectively measure one’s sleep cycle without intrusive wiring? Can we not only measure bad sleep, but also cause an environment to react to that sleep in order to promote good sleep?
The project divides into 6 major sections.
- Sensing.
- Analytic data collection.
- Post-sleep user feedback.
- Machine learning.
- Pre-sleep environmental recommendation.
- In-sleep environmental adjustment via smart home devices.
Step 1: Project History
GoodSleep started life as a hackathon project for the 2nd Intel IoT Roadshow at NYC. The center piece of the project revolved around the ElAsIS technology previously developed for the TI Sensor Challenge. During the IoT Roadshow, a suite of sensors were combined with the ElAsIS based Body Contour Map (BCM) sensor in an attempt to quantify one's sleep environment and session. The environmental and body position data were gathered and pushed up the Intel Analytic Dashboard via the Intel Edison board.
This instructable will augment our initial Instructable posting.
Step 2: Sensors Overview
Sensing divides into two subgroups, Room and Bed.
Room sensing involves a typical suite of temperature, humidity, air pollution, brightness and noise sensors. Bed sensing involves pillow orientation, mattress temperature and humidity, Body Contour Map and VOC sensors. BCM sensor based on ElAsIS technology is used to measure body position and pressure points, it is sensitive enough to pick up one’s breathing. The VOC sensor is used to measure methane level under the blanket, combined with the BCM sensor, one can derive data regarding the condition of gastrointestinal tracts.
To accomplish the above tasks, we propose to use the Intel Edison as the gateway device for the wired sensors (room temperature, room humidity, air pollution, brightness, noise, mattress temperature, mattress humidity, body contour map and VOC) and wireless bluetooth LE sensor (pillow position via accelerometer and magnetometer)
Step 3: Analytic Data Collection
Eleven sensors worth of data was collected and pushed up to the Intel analytic dashboard for further processing. To expedite the project during the limited time allotted of the hackathon, the Arduino programming environment with it's vast library and ease of use was chosen. Attached is an example code that demonstrate IoT device registration with the Intel Analytic Dashboard.
Attachments
Step 4: Data Sender
This code demonstrates how data from individual sensors were gathered and pushed up to the Dashboard. Note that the BCM sensor communicates with Edison via the serial port. The Edison was configured to operate with dual serial ports.
Attachments
Step 5: User Feedback
Combined with daily sleep quality feedback from the user via our APP, the user can use the collected data to identify potential issues with prior night’s sleep session. Issues such as snoring, apnea, bad body posture and upset stomach can be visualized along with environmental data.
Step 6: Post Hackathon Wishlist
To further expand the system’s capability, a machine learning system such as Numenta’s Nupic can be trained to recognized the potential onset of troublesome night of sleep for pre-sleep environment alteration recommendation. If desired, an user can connect the GoodSleep engine to his or hers connected IoT home for in-sleep environment adjustment. These adjustments can be
- Too hot, too cold = HVAC.
- Too dusty = air filter and/or HVAC.
- Snoring = alter mattress angle, firmness, turns on a fan to disrupt the sleep cycle.
- Outside noise = white noise generator.
- Alarm clock = slowly brightening room light to sync with sleep cycle.
Step 7: Technical Feasibility
Sensors:
Type Availability Energy requirement
- Temperature + Humidity (room and mattress)
- Off the shelf
- Edison + BTLE ready
- Brightness
- Off the shelf
- Edison
- Microphone/I2S
- Off the shelf
- Edison
- Air particle sensor
- Off the shelf
- Edison
- Magnetometer (pillow)
- Off the shelf
- BTLE
- Accelerometer (pillow)
- Off the shelf
- BTLE
- VOC
- Off the shelf
- Edison
- BCM
- Under development
- Edison
Due to Edison’s high power consumption, an additional low powered BTLE MCU will need to be sourced for pillow position sensor integration.
Gateway device:
Intel Edison.
- Outbound: sensor data to cloud.
- Inbound: connected home smart device actuation.
Cloud Server:
Intel analytic dashboard and various others.
Machine learning:
Numenta Nupic and others.
User App:
Android, IOS and Webapp for post-sleep session feedback and log display.
Connected home app:
- UI design to facilitate low friction Edison to cloud connection experience.
- API integration for smart home devices.