Sleep Smarter A device that can track and improve the quality of Members: Ashley Resuta, Daniyal Iqbal, Ethan Dell, Kyle Ki December 8, 2019 Sleep Smarter 1

I. Overview 3 Needs Statement 3 Objective Statement 3 Description 3 Marketing Diagram 4

II. Requirements Specification 4 Marketing Requirements 4 Engineering Specifications 4

III. Concept Selection 7 Existing Systems 7 Concepts Considered 9

IV. Design 12 Overall System 12 Subsystems 13 Heartbeat Detection 13 Circuits and Assemblies 14 Sleep Stage Prediction 16 Snore Mitigation 18 Application 20 Engineering Standards 22 Multidisciplinary Aspects 22 Background 22 Outsider Contributors 23

V. Constraints and Considerations 23 Extensibility 23 Manufacturability 23 Reliability 23 Environmental 23 Health and Safety 24 Intellectual Property 24 Privacy 24 Others 24

VI. Bill of Materials 25

VII. Testing Strategy 26 Acceptance Tests 26 Integration Tests 32 Unit Tests 35 Sleep Smarter 2

VIII. Risks 36 Overall Risks 37 Heartbeat Detection 37 Sleep Stage Detection 38 Quiet Air Inflation 39 Snoring Mitigation 41

IX. Management Plan 42

X. Perspective 45

Sleep Smarter 3

I. Overview

Needs Statement According to enthealth.org, “nearly half of adults snore, and over 25% are habitual snorers.” Although snoring is considered just a small annoyance, it can drastically impact a person's sleep quality. The National Sleep Foundation also reports that 45% of Americans admit to poor sleep affecting their daily life in the past week. In addition to a lack of quality sleep, another problem that persists is loud alarms that jolt a person out of sleep and are not optimized to the person’s REM cycles. Environmental factors such as noise and lighting can also reduce the quality of a person's sleep. A system is needed to track the quality of sleep as well as make necessary adjustments to the sleeping environment to reduce snoring and improve sleep quality. The system must also gently wake the user according to his/her individual REM cycle.

Objective Statement The objective of this design is to create a device that will go inside of a and will keep track of key sleeping metrics as well as noise to make adjustments to the person's environment. This design will interact with the user through an app which will contain all of his/her sleeping data and allow him/her to analyze the data in order to make necessary sleeping changes. The app will allow the user to set alarms and have the device optimize wake times according to the user’s REM cycle. The device will also be able to detect snoring and will adjust the pillow to reduce the user’s snoring to improve sleep quality.

Description

The device will consist of an inflatable air chamber, a large programmable chip, and a few sensors. The device will connect directly to a wall outlet, so there will be no batteries within the device. The case for the device will most likely be 3-D printed and will protect the programmable chip while exposing the sensors. The sensors will be used to track the user’s heartbeat, noise, and movement. The programmable chip will use the data from those sensors to perform sleep analysis. It will contain a microphone and control the alarms to wake the user at an optimal time. It will also send the sensor data and the user’s sleep stage data to the user’s phone. The programmable chip will also use the microphone data to detect snoring and will control the snore mitigation component. The snore mitigation component will gently adjust the user’s head by deflating or inflating the air chamber. Sleep Smarter 4

In addition to the device, an application will allow the user to set alarms and view his/her sleep data. The application will also contain a graph of the sleep stages of the user throughout the night.

Marketing Diagram

Figure 1: Overall System Component Diagram

II. Requirements Specification

Marketing Requirements 1. The device is easy to use and install. 2. The device is non-intrusive and allows the user to sleep comfortably. 3. The device adjusts the user’s pillow to reduce snoring when snoring is detected. 4. The device is compatible with smart home technology for light adjustment. 5. The application allows visualization and analysis of sleep data. 6. The application allows for setting alarms that can wake up the user based on the optimal REM cycle.

Engineering Specifications

Table 1. Engineering Specifications Marketing Engineering Requirements Justification Sleep Smarter 5

Requirements

1 A. The device average setup time is no The average setup time more than 30 minutes. should be short, but should account for users encountering issues.

1 B. The device should be easy to set up, The product should be and after 2 consecutive uses, the user intuitive to use. should no longer feel the need to consult instructions.

5, 6 C. The device should be able to detect user The deep sleep or REM sleep sleep stages. The device should be able to stage indicates good quality detect light sleep, deep sleep, REM sleep, sleep so they are necessary wakefulness, and restlessness. to track for sleep quality.

5 D. The application should display sleep The user can analyze data data and analysis in graphical format. visually through graphs and find patterns in his/her quality of sleep.

2 E. The device should not have sharp edges The device should be that can cause the user pain. comfortable to sleep on.

5 F. The application should have an interface The user needs an interface for setting alarms. The device will trigger an for communicating time to the alarm at or before the specified time device. depending on the user’s optimal sleep cycle.

3 G. The device should detect snoring within The device’s snore detection 5 minutes from when snoring started. should attempt to verify “snoring” is not movement before beginning to adjust the pillow.

3 H. When snoring is detected, the device The device should attempt to should adjust the pillow to reduce snoring stop or reduce snoring so that every minute until snoring stops or after 15 the user can sleep better. attempts.

3 I. The device should alleviate snoring and The device should be quiet so not make more than 45 dB of noise. it does not wake up the user Sleep Smarter 6

when alleviating snoring.

6 J. The device should be able to measure The application needs to the user’s heartbeat accurately (on average provide heartbeat data and +/- 5 bpm tolerance). needs heartbeat data to do REM analysis.

3 K. The device’s air chamber should allow If the airflow is too weak, for strong enough airflow to adjust the adjustments may not happen user’s head in his/her sleep. at all, but if it is too strong then adjustments may occur very suddenly and wake the user.

4 M. The device must be compatible with a Z- The device turning on lights in Wave smart light, and be able to turn on a sync with the alarm changes light when waking the user up. the sleep environment to wake the user.

Sleep Smarter 7

III. Concept Selection

Existing Systems There are a variety of systems that already exist to track the quality of sleep, and there are some that can even make adjustments to the environment to improve the quality of sleep. The most basic system that exists is a mobile application that needs to be turned on before going to sleep. The phone is placed on the side of the bed, and the app keeps track of noise and movement throughout the night to measure the quality of sleep. The app can wake the user at an optimal time based on the user’s REM cycle. Although the app is cheap or even free, the information that it can collect and the accuracy of the data are very limited. Some other systems that exist are wristbands or smartwatches. These are often multipurpose and can be used for fitness tracking as well as viewing notifications from a phone. They are able to track sleep pretty well but can be too expensive because of the variety of non- sleep related features they offer. There are other wearables such as Oura which is a ring that can also track sleep. Although it is very accurate and works well, it is also very expensive due to its small size. Other systems that are designed solely for sleep also exist such as mattress pads and smart mattresses. Both of these systems are able to track the user’s sleep fairly accurately with the exception of the heartbeat. They are able to track body movements, adjust the firmness of the mattress, or adjust the temperature. Newer smart mattresses are even able to lift the upper half of the bed during the night to alleviate snoring. Although these systems work well, they also are very expensive. Almost all of the systems discussed so far, except for the smart mattress, are solely for tracking sleep quality. One strength of the smart mattress is that it is able to detect and improve the user’s sleep. Another system called Nora exists solely to detect and alleviate snoring. It is placed under the user’s pillow and can raise the pillow up a little in order to alleviate mild snoring. Another system that has this feature and can track the user’s sleep is the smart pillow, Zeeq. Zeeq has features to track sleep, alleviate snoring, and even wake the user at an optimal time. Zeeq is the least intrusive system discussed here because the entire system is part of the pillow. Although the concept is great, the system’s implementation is poor, and the current implementation does not work well.

Sleep Smarter 8

Table 2: Existing Systems Existing Relation to Project Strengths Weaknesses System

Fitbit Wristband that tracks -Multipurpose -If not synced to the user’s sleep -Detects sleep stages phone, data can be lost

Apps Apps track sleep -Sleep tracking is - Sleep metrics such through phone decent as heart rate can’t be sensors -User can use a tracked phone instead of - Inaccurate buying an external device to track sleep

Mattress Sleep tracked through -Tracking body - Tracking pads for Pad tactile mattress movements during beds are expensive feedback sleep gives accurate sleep quality measurement - Mattress pads can adjust bed temperatures

Mattress Smart bed that senses -Controls and - Mattresses are movement, maintains the user’s expensive automatically adjusts environment. firmness, raises the head to alleviate snoring, and adjusts the temperature.

Oura Ring Smart ring that tracks - Nonintrusive, -Expensive fitness and tracks the comfortable quality of your sleep - Tracks heart rate

Nora Detects and stops a - Nonintrusive - Assumes the user is user from snoring - Gently adjusts the sleeping on back to pillow to stop snoring adjust pillow without waking the user

Zeeq Sleep tracking and -“Swiss army knife of -Inaccurate alarm integrated ” -Snore alarm often through pillow -Analyzes REM cycles has false positives to determine the -Pillow is not standard optimal wake-up time. size for pillowcases

Sleep Smarter 9

Concepts Considered The possible concepts that could implement a sleep tracking device are evaluated in Table 3. The possible concepts analyzed were a wristband, mobile application, mattress pad tracker, smart pillow, and sleep ring. The wristband was used as a reference because a wristband was the initial concept idea. The areas of comparison are product cost, intrusiveness, accuracy, data collection possibilities, ease of use, and design cost/time.

Table 3: Concept Evaluation Table Criteria Option 1 Option 2: Sleep Option 3: Option 4: Option 5: (Reference) App Mattress Smart Pillow Sleep Ring : Wristband Tracker

Product Reference App is cheap to Larger in size Larger in size Small and Cost create. No and contains and contains compact. Need hardware more sensors. more hardware very small components. Requires more components. sensors & power. power.

Intrusiven Reference No need to wear Less intrusive Non-intrusive Device still ess a device. Phone than sleep app since a pillow is needs to be is next to pillow, which requires already used for worn. so a little phone on bed. sleeping. Covers a intrusive. smaller area compared to the wristband.

Accuracy Reference Movement is not Will have trouble Overall sleep Quality of accurate at differentiating quality metrics metrics is the determining REM multiple people in comparable to a same as the sleep or quality of the same bed. wristband. wristband. sleep.

Data Reference Does not collect Less data than Pillow cannot Can track Collection any heartbeat wristband since it measure heart same metrics data. Cannot won’t be able to rate easily. as the collect REM cycle measure heart wristband. sleep data. rate.

Ease of Reference Apps are easy to After initial setup, No need to Easy to put on. Use learn and use. no daily setup setup other needed equipment for sleep tracking.

Design Reference App templates Since it is not Since it is not Requires a lot Cost/Time exist and apps worn, fewer size worn, fewer size of time due to are easy to and comfort and comfort extremely design. constraints constraints small scale technology.

Table 3 shows the analysis of each concept option in reference to a wristband implementation. In production cost, a sleep ring would be the most expensive because it Sleep Smarter 10 must be small and compact. A mobile application would be the least expensive because there are no hardware components (with the exception of the phone’s) and would only require app development.

For the intrusiveness category, a wristband seems the most intrusive out of the options, since it will be bulky with sensors, battery, a board, and must be tight to the skin during sleep. The sleep ring and sleep app were considered slightly intrusive since the ring must be worn and the phone must be on the mattress to measure sleep data, which could become uncomfortable for users who roll or move in their sleep. A mattress pad tracker or smart pillow would be the least intrusive because they are items already commonly used for sleeping.

For accuracy, a wristband or ring would be most effective because they are always directly in contact with skin and data will be unique to the user (not affected by a partner). The sleep app would be the least accurate because it must rely on sound and movement alone. There will be no way to measure heart rate or movement unique to a person through the phone’s sensors, which could lead to inaccurate results and analysis.

For ease of use, the wristband, mattress pad, and smart pillow were estimated to be similar. However, the mattress pad and smart pillow would be even easier to use because they do not require the user to put on a device or set anything up before going to sleep at night.

For design costs, a mobile application would have the lowest design cost because it requires only app development, which must be developed for all of the options so that they have a way to view sleep statistics and set alarms. A sleep ring would have the highest design costs because extremely small scale technology will need to be designed in order to have sensors, battery, storage, and communication ability all within a ring.

Sleep Smarter 11

Table 4: Concept Selection Table with numerical values Criteria Option 1 Option 2: Option 3: Option 4: Option 5: (Reference): Sleep App Mattress Smart Pillow Sleep Ring Wristband Tracker

Product Cost (1) 0 +2 -1 -1 -2

Intrusiveness (4) 0 +1 +2 +2 +1

Accuracy (3) 0 -2 -1 -1 0

Data Collection (5) 0 -2 -1 -1 0

Ease of Use (3) 0 0 +1 +2 0

Design Cost/Time (4) 0 +2 +1 +1 -2

Score 0 -2 6 9 -6

Table 4 shows the analysis of all criteria. Overall, data collection, intrusiveness and design cost were weighted the heaviest because they were the most valuable aspects. The total score was the highest for a smart pillow design because it would not require additional daily setup, it is not intrusive, and can measure heartbeat data.

Sleep Smarter 12

IV. Design

Overall System Figure 1 shows the location of all of the components in the system. The inflatable chamber for snore mitigation and the accelerometer for movement detection will be placed in the user's pillow. The inflatable chamber needs to be in the pillow to adjust the user's head and neck position to mitigate snoring. The accelerometer will also be included in the pillow for the accurate detection of the user’s movement. The inflatable chamber's hose and the wiring for the accelerometer will be routed underneath the mattress. The inflation device, valve, and Raspberry Pi will be underneath the mattress and will be used to interface with the inflatable chamber and accelerometer components.

Figure 1: Overall System Component Diagram

The bulky components were placed under the mattress to keep them out of the way of the user while they are asleep. The ballistocardiogram (BCG) sensor and microphone sensor are placed on the side of the user's mattress to get accurate measurements and to limit the number of components inside the pillow. The BCG sensor is known to take accurate measurements from the side of a mattress, and placing the microphone on the side of the mattress ensures that snoring sound is not muffled through a pillow. If the BCG sensor during calibration does not take accurate measurements, the sensor can be placed on top of or under the mattress easily to obtain better readings.

Sleep Smarter 13

Subsystems

Heartbeat Detection The SCA11H module uses ballistocardiography to collect the heartbeat of the user. Figure 2 shows that the SCA11H sensor will be placed somewhere on the user’s mattress to detect his/her heart rate. This position will be determined by where the best heart rate measurements can be taken sensor during calibration. The optimal sensor placements are on the top of the mattress, on the side of the mattress, or under the mattress. Figure 2 shows a possible sensor placement on the side of the mattress.

Power

SCA11H Module

Figure 2: Heartbeat Detection Layout Diagram

Sleep Smarter 14

Server

HTTP POST messages

Raspberry Pi SCA11H

Figure 3: General Server Communication Flow

The SCA11H will be used in cloud communication mode, which enables it to connect to a predefined Wi-Fi network and send data to a predefined server. This communication flow is shown in Figure 3. The server will be hosted on a Raspberry Pi which will allow us to collect and process heartbeat data. The SCA11H will send HTTP POST messages to a server. The Raspberry Pi will then retrieve and interpret these messages.

Circuits and Assemblies Figure 4 shows the deconstruction of the SCA11H module taken from the Murata datasheet, and the block diagram for the device is displayed in Figure 5.

Figure 4: Construction of SCA11H Sensor Source: https://www.murata.com/en-us/products/sensor/accel/sca10h_11h/sca11h

Sleep Smarter 15

Figure 5: Block Diagram for SCA11H Device Source: https://www.murata.com/en-us/products/sensor/accel/sca10h_11h/sca11h

The block diagram displays the internal components of the SCA11H device. The SCA10H module will be used to detect heart rate using the ballistocardiogram method, and the Wi-Fi module will be used to communicate with the Raspberry to record heartbeat data. The Raspberry Pi 2B/3B+ was chosen due to its low cost, availability of Bluetooth and Wi-Fi, quad- core processor, and 1 GB of RAM. These factors made the Raspberry Pi more desirable for this product over the Pi Zero, which has no Bluetooth and is single-core, and the BeagleBone Blue, which is more expensive, had only 512 MB of RAM and limited GPIO pins. Peripherals attached to the Raspberry Pi include a microphone and an accelerometer. Figure 6 shows how the peripherals will be wired to the GPIO pins of the Raspberry Pi. Sleep Smarter 16

Figure 6: Raspberry Pi Wiring Configuration for Sensors

Sleep Stage Prediction A combination of two different sensors will be used to predict the sleep stage in real- time. The accelerometer and microphone allow for detecting basic sleep stages (e.g., awake and sleep) based on user movement. These two sensors provide information on whether the user is in deep sleep (not moving too much) or in light sleep (some movement and some noise). Additionally, a heartbeat sensor will be used to differentiate deep sleep from REM sleep as well as validate that the user is in the sleep stage that the accelerometer predicted. First, the accelerometer and microphone will be used to identify whether the user is awake or asleep. The accelerometer will be under the pillow and will be used to sense any movement that the user makes. A microphone will be used similar to mobile apps to determine Sleep Smarter 17 user movement by the amount of noise the user makes. Initially in stage 1, when the user is awake, data collected from both of these sensors will show a lot of movement and noise from tossing and turning. Once the user falls asleep, they are in stage 2, or light sleep. To detect this, the average movement and noise the user makes will be reduced significantly. Snoring will be filtered out since it will be detected for snore mitigation. Additionally, a heartbeat sensor will be used to validate that the user is in light sleep by looking at the average heartbeat per minute. In stage 2, the nervous system slows, and this can be seen in the slowing of the heart rate. In this stage, the heart rate slows by about 14 beats per minute compared to stage 1 when the user is awake. Once the user is in stage 2, he/she can go into deep sleep (stage 3), and the heartbeat sensor will also be used to detect this. In deep sleep, the variability between heartbeats is much lower. Figure 7 shows experimental data collected on a healthy human. When the user is in deep sleep, there are no spikes in the time between heartbeats.

Figure 7: Time Between Heart Beats in Healthy Human (Source 1c)

Additionally, heartbeat data are also used to detect REM sleep. During REM sleep, the heart rate is higher, and there is more variability compared to non-REM sleep stages. If a person is already in light or deep sleep, a higher heartbeat and a higher heartbeat variance will indicate the user is in REM sleep. This can be seen in Figure 7 around hour 7. The user transitions from light sleep to REM sleep, and before that transition, the time between heartbeats has a downward slope. When the user is actually in REM sleep, the variation of the heartbeat is high, and that can be seen in the high number of spikes. A summary of this design is shown in the state diagram in Figure 8.

Sleep Smarter 18

Figure 8: State Diagram of Sleep Stage/Restl Prediction Design

Snore Mitigation The concept selected was a single inflatable chamber that can be placed in between the pillowcase and pillow. The chamber will inflate and deflate slowly to stimulate the user’s throat muscles when the main device detects snoring. The stimulated muscles will tense from the movement which will keep the throat muscles and fat in the back of the throat from vibrating as the user breathes. A state diagram for the snore mitigation process can be found in Figure 9. Sleep Smarter 19

Figure 9: Snore Mitigation State Diagram

When the device is booted up, it will begin in the reset state where the variables are initialized. Then, the microphone goes into the listening state and continually listens while snoring is not detected. Once snoring is detected, it enters the detected state, where the strategy for moving the user’s head is set. If the pillow’s inflation is at 100, the strategy is set to deflate and if the pillow’s inflation is set to 0, the strategy will be set to inflate. The air chamber will then inflate or deflate for a few seconds and check if snoring has stopped, before trying again. A count will be kept of the number of snore mitigation tries that have been attempted. When the count hits a maximum of 15 attempts, the system will go into the idle state and delay checking for snoring because the snore mitigation was not successful. Continued inflation and deflation would only be a nuisance to the user and a waste of electricity. When snoring is not detected, the microphone will continually listen for snoring until it is detected or the user wakes. The system requires a quiet inflation device to move the user’s head. This will be achieved by using an electric sports ball pump with an automatic shut off feature. This allows maximum pressure to be set which mitigates the risk of overfilling and popping the inflatable chamber. The device can be turned on for a long amount of time to ensure that the pillow is full without needing to measure the pressure in the pillow since there is an auto shut off feature. The pump will be housed in a sound mitigating baffle box made of medium density fiberboard with convoluted foam padding. The pump will be attached to the inflatable chamber which will be housed within the pillow. A block diagram of this design is shown in Figure 10. Sleep Smarter 20

Figure 10: Inflation Device Block Diagram

The design depicted in Figure 10 uses a solid-state relay for the Raspberry Pi to turn the pump on and off. The inflation pump is configured to turn on with a long press and start with a short press. The Raspberry Pi will send signals to open and close the relay to simulate a long and short press. Additionally, the electric ball pump chosen will be modified to be powered by a wall outlet with a DC transformer so that the user won’t have to charge the device. An air tube will connect the inflatable chamber to the pump underneath the bed. The deflation of the inflatable chamber will be done with an electric valve, which can be opened to let air escape for varying lengths of time in order to move the user’s head.

Application The application will consist of two different features: setting alarms and visualizing sleep data. The app will allow the user to specify a time for when he/she wants to wake up. The alarm information will be sent to the Raspberry Pi which will trigger the alarm when the user is in a light sleep stage up to 40 minutes before the alarm. The user interface for setting the alarms is shown in Figure 11. In Figure 11, the user can set the time and check the “Date” box if it is for a single day or check the “Repeat” box if it should repeat weekly. Additionally, the user can specify what days that the alarm should repeat by checking the boxes under each day of the week.

Sleep Smarter 21

Figure 11: UI of Setting Alarms

The second feature is visualization of sleep data. The app will show the user processed sensor data such as movement, noise, and heartbeat. These data will be plotted on a graph for the entire duration the user was asleep. A graph will show the times when the user was snoring and when the snoring mitigation device was active. Lastly, a graph of the analysis of the sleep data to predict sleep stage will also be shown graphically. The different sleep stages that the user can be in are awake, light sleep, deep sleep, or REM sleep. Figure 12 shows a sample of what the graph will look like.

Sleep Smarter 22

Figure 12: Hypnogram to Visualize Sleep Stage

Engineering Standards The two main platforms we are using in our system are the Murata SCA11H sensor and a Raspberry Pi. Using the SCA11H sensor board requires using ballistocardiography algorithms to extract heartbeat data from accelerometer measurements. HTTP and a Flask Server will be used to interface to transfer and store this data in the correct formatting. On the Raspberry Pi side, we need to follow communication standards to interface with the GPIO pins. For example, using our accelerometer we will need to follow an I2C communication standard. The software development for interacting with the SCA11H sensor and interfacing with the Raspberry Pi sensors can be done using Python. Integrating the Raspberry Pi with our application will be done using Bluetooth and Wi-Fi communication protocols.

Multidisciplinary Aspects The snoring mitigation device requires mechanical engineering knowledge to design and build a sound mitigating box. Electrical engineering knowledge will be needed to wire the relay and convert AC wall power to DC power. Calibration and wiring of the accelerometer and microphone will also require electrical knowledge. Signal analysis knowledge will be needed for detection of snoring and REM cycles for individualized results. Computer engineering and computer science knowledge will be used to create the application as well as to create the algorithm for sleep stage prediction. Computer engineering knowledge will also be used to program the Raspberry Pi and to collect data from the sensors.

Background This project encompasses both software and hardware, and there have been various courses that have provided us with experience in both areas. Interface & Digital Electronics has introduced us to programming on a microcontroller, working with sensors, and dealing with Sleep Smarter 23 analog/digital signals. Additionally, Digital Signal Processing has provided us with the theory of processing signals and filtering them which will be useful for processing data from the sensors. For the software part of the project, Introduction to Software Engineering and Computer Science have provided us with knowledge on how to design and implement an application.

Outsider Contributors This project does not have any external contributors and is not being sponsored by anyone.

V. Constraints and Considerations

Extensibility There were many constraints we considered when designing our Sleep Smarter system design. The first was extensibility. For our system, we want it to be compatible with Amazon Echo, Google Home, and other smart home systems. If the user of our system wishes to integrate smart light technology, we want to give them that capability.

Manufacturability One constraint of our design is the manufacturability of it. The design consists of a lot of pre-made and custom components, so establishing a new manufacturable design would take more development time. For example, our system consists of a Raspberry Pi, Murata SCA11-H sensor, inflatable pillow, and many other components. All these components are stand-alone, so manufacturing them into a single unit would be a challenge and is unnecessary.

Reliability The fact that the components of our system are independent hinders its manufacturability but allows it to be more reliable. Since the components function well by themselves, the only real risk comes from integrating them together. Initially, some needs were planned to be met with a low-cost sleep-tracking wristband. An analysis of that design revealed that a wristband implementation would be more expensive and riskier, and a smart pillow would be a better option.

Environmental From an environmental context, the only impact our system would have is possible pollution from using electricity and the general use of natural resources required to manufacture the components. Sleep Smarter 24

Health and Safety Our system does not pose many health or safety risks. The contactless design for heartbeat measurement and sleep tracking means the only real risk lies in electrical dangers. With the accelerometer in the pillow, a wire will be fed into the pillow which is a safety risk if the wire becomes exposed. Since our design has low power consumption, safety issues are trivial.

Intellectual Property Some of the components that are being utilized in our design have intellectual property protection. For example, the ballistocardiogram technology for heart-beat measurements has patents associated with it. The Murata SCA11H API and firmware technologies also have firmware restrictions to them. All these restrictions must be considered when working with the sensors and software as to not infringe on copyrights or intellectual property.

Privacy Our design does capture a user’s private sleep data information which consists of audible sleep snoring and heartbeat measurements. We want to prevent unwanted access to audio and heartbeat data being recorded, thus the data will be encrypted to prevent unwanted individuals from accessing it.

Others Our sleep system poses no issues to politics or society and is sustainable to develop and use.

Sleep Smarter 25

VI. Bill of Materials

Part Name Cost ($) Our Cost ($) Availability/Lead Time

Raspberry Pi 35.00 0.00 Owned

SCA11H 175.01 175.01 Arrow: 1 Day

Accelerometer 7.95 0.00 Owned

Microphone 10.07 10.07 Amazon: 2 days

Analog to Digital Converter 6.99 6.99 Amazon: 2 days

Inflatable Pillow 9.99 9.99 Amazon: 2 days

¼” Electric Air Valve 9.59 9.59 Amazon: 2 days

¼” Brass T-Pipe Fitting 6.97 6.97 Amazon: 2 days

Electric Ball Pump 19.99 19.99 Amazon: 2 days

Relay 4.59 4.59 Amazon: 2 days

Solid State Relay 3.61 0.00 Arrow: 5-7 days

12 VDC 2A wall power 7.99 0.00 Owned supply

Medium-density fiberboard 7.98 0.00 Owned ¼” x 2’ x 4’

Soundproofing foam 10.99 10.99 Amazon: 2 days panels, 6 pack

Casing Hardware (Screws ~5.00 0.00 Owned and Wooden Stands)

Air hose ¼” x 25’ 9.97 9.97 Amazon: 2 days

¼” air hose repair kit 9.88 9.88 Amazon: 2 days

Wiring Accessories (Wires, ~10.00 0.00 Owned Heat Shrink, and Solder)

Buck Converter x2 2.00 0.00 Owned

Pillow Accessories (Pillow, ~10.00 0.00 Owned Pillow Case, Thread)

Smart Lights 69.99 69.99 Best Buy: Same day

Total 433.567 344.03 Owned Sleep Smarter 26

VII. Testing Strategy

Acceptance Tests

Test Case The device’s average setup time is no more than 30 minutes. (A) Name:

Step Action Expected Result Pass Fail

1 Read setup Takes a maximum of 5 X instructions minutes

2 Set up raspberry pi Takes a maximum of 10 X internet minutes

3 Set up heartbeat Takes a maximum of 10 X sensor attachment minutes

4 Set up air chamber Takes a maximum of 5 X into pillow minutes Average setup time: 22 minutes See attached setup instructions.

Test Case The device should be easy to set up and the user should not feel the need Name: to consult the manual after two consecutive uses. (B)

Step Action Expected Result Pass Fail

1 Give user manual Takes a maximum of 30 X and time their setup minutes

2 Survey users on their Majority reply easy and X experience wouldn’t need manual after two uses After initial setup, the user can just fall asleep, and could set an alarm. 100% of testers said they would not need to consult the manual after two consecutive uses.

Sleep Smarter 27

Test Case The device should be able to detect user’s sleep stages. (C) Name:

Step Action Expected Result Pass Fail

1 User has a high heart Device recognizes that the X rate, high heart rate user is awake variation, and some movement.

2 User heart rate is Device recognizes that the X slower and heart rate user is in light sleep stage variation is slower.

3 User has a Device recognizes that the X significantly slower user is in deep sleep stage heart and a very low heart rate variation.

4 User has a higher Device recognizes that the X heart rate and heart user is in REM sleep stage rate variation is increased.

Sleep Smarter 28

The above plots show heart rate and heart rate variation data. Using the data measurements, the sleep stages listed (Awake, Light, Deep and REM) were able to be detected. Test Case The application allows the user to view sleep data in a graphical display. Name: (D)

Step Action Expected Result Pass Fail

1 Open application Application opens X successfully

2 Select “View Sleep Tab is clickable and X Data” tab responsive

3 Visually inspect the REM cycle information is X REM cycle graph viewable

4 Visually inspect Heartbeat information is X heartbeat graph viewable

5 Visually inspect Snoring information and X snore data snoring mitigation device information is viewable Sleep Smarter 29

Shown in the Demo.

Test Case Name: The device should not have sharp edges that can cause the user pain. (E)

Step Action Expected Result Pass Fail

1 Set up sleep system Sleep system configured X in bed and runs properly

2 Have user sleep on Minimal discomfort X mattress and move experienced from the around in it system when the user moves to different mattress positions Ethan and Daniyal slept on it. No pain or discomfort.

Test Case The device sets off an alarm at the time the user-designated through the Name: application. (F)

Step Action Expected Result Pass Fail

1 User sets alarm Application shows the X using the application alarm that was created

2 User waits until the Alarm goes off during the X designated time designated time or within the time window Shown in the Demo.

Test Case When snoring is detected, the device should adjust the pillow to reduce Name: snoring every minute until snoring stops or until it reaches a maximum number of tries. (G, H)

Step Action Expected Result Pass Fail

1 Snoring is detected Air chamber inflates Not enough data

2 Snoring continues Adjustment of the snoring Not pillow should occur every enough minute, or until the user data stops snoring

3 Snoring stops Inflation of the pillow should Not stop because the user enough Sleep Smarter 30

stopped snoring data

4 Play snoring sound After a maximum number Not which doesn’t stop in of tries, device will stop enough response to pillow attempting to mitigate data adjustment snoring and go to an idle state Shown in the Demo.

Test Case The device can mitigate snoring. (I) Name:

Step Action Expected Result Pass Fail

1 Record user sleeping On average, snoring should X with device be stopped or quieted within 5 minutes of detection Insufficient testing, tested with Ethan and Daniyal (highest potential snorers). Both tests were recorded and recordings did not show any snoring and the algorithm also did not detect any snoring.

Test Case The device should be quiet so it does not wake up the user. (I) Name:

Step Action Expected Result Pass Fail

1 Use a decibel reader The volume should be no X to detect noise while more than 45 dB of noise air pump is running

2 Record user sleeping User should not be awoken X by the air pump

See deflation and inflation videos. Deflation was louder and the max decibel it reached when it was within 2 feet of the valve was 42 dB. Inflation was at around 33 dB. The videos show an app measuring the dB while inflation or deflation is happening.

Test Case The device can accurately track heart rate. (J) Name:

Step Action Expected Result Pass Fail

1 Person lays down on Ballistocardiogram begins X bed with a wearable measuring heart rate Sleep Smarter 31

( or Apple Watch)

2 Measure heart rate Get accurate/expected X using wearable (FitBit heart rate or Apple Watch)

3 Compare BCG heart rate is +/- 5 bpm X ballistocardiogram to expected heart rate bpm to wearable bpm.

The figure above displays the ground truth heart rate data in green and the predicted heart rate in red. Although this screenshot only shows 1 sample of a heart comparison, observing the tolerance real time over 5 minutes resulted in a tolerance of +/- 3 bpm.

Test Case The device’s air chamber should allow for strong airflow that is capable of Name: adjusting the user’s head in his sleep. (K)

Step Action Expected Result Pass Fail

1 Raspberry Pi sends Air pump successfully X inflate signal to pump starts filling air chamber and a head is on the and exerts enough force to Sleep Smarter 32

pillow lift head See video “InflationSpeed3x”

Test Case The device must be compatible with a smart light, and be able to turn on a Name: light when waking the user up. (M)

Step Action Expected Result Pass Fail

1 Device attempts to Device successfully X pair with smart light connects to smart light

2 Device sounds an Light turns on with alarm to X alarm and sends wake user signal to turn light on to wake the user up Shown in the Demo.

Integration Tests

Test Case Inflation device integration with the Raspberry Pi Name:

Step Action Expected Result Pass Fail

1 Raspberry Pi GPIO pins properly move X connects to servos servos and valve based on and valve of inflation signal device, and sends signals to open and close the valve

2 Raspberry Pi sends Air chamber inflates X inflate signal to pump

3 Raspberry Pi sends Air chamber deflates X deflate signal to pump Shown in Demo.

Test Case SCA11H sensor integration with Raspberry Pi Name:

Step Action Expected Result Pass Fail

1 Turn on Raspberry Pi Initial setup is run and the X Flask server begins running Sleep Smarter 33

on Raspberry Pi

2 SCA11H plugged in SCA11H connected to X and configured in server on correct port cloud mode

3 Person with a Heart rate data viewable on X heartbeat lays on bed server

The screenshot shown above displays the SCA11H posting data messages to the server hosted on the pi. This shows successful server/sensor configuration.

Test Case Microphone integration with the Raspberry Pi Name:

Step Action Expected Result Pass Fail

1 Read data on Raspberry Pi gets X Raspberry Pi from microphone input data the microphone

Sleep Smarter 34

The above screenshot shows a graph microphone data gotten on the pi.

Test Case Accelerometer integration with Raspberry Pi Name:

Step Action Expected Result Pass Fail

1 Read data on Raspberry Pi gets X Raspberry Pi from accelerometer input the accelerometer Sleep Smarter 35

The above screenshot shows a graphical representation of the accelerometer data on the x, y, and z axes. The data is shown with the x measurement on the top subplot and the z measurement on the bottom subplot.

Test Case App receives data from Raspberry Pi Name:

Step Action Expected Result Pass Fail

1 User provides Raspberry Pi can connect X Raspberry Pi with to WiFi WiFi password

2 Raspberry Pi sends Application receives data X data to application and it is viewable by the user Shown in demo.

Unit Tests

Unit Component Action Expected Result Pass Fail

Snoring Pump Turn on pump Pumps air into chamber X Mitigation Electric Valve Open valve Deflates air chamber X

Air chamber Inflate air Inflated properly, no leaks X chamber

Air pressure Inflate chamber Able to inflate fully X with head on it Sleep Smarter 36

Snore Play recorded Detects snoring within 5 X detection snoring noises minutes near microphone

Optimal Setting Alarms Set alarm Alarm able to be configured X Alarm Feature Functional Wait until Alarm goes off within X alarm designated time configure time frame passes

Sleep Visualization Open heart rate Data recorded and displayed X Tracking & of heart rate graph on on the application Analysis application

Visualization Open snoring Data in graphical form is X of snoring and graph on shown on the application snoring application mitigation device active

Analysis/Predi Sleep stage Sleep stage accurately X ction of sleep predicted predicted based off of sleep stages data

Peripherals Accelerometer Manually move The raspberry pi returns X accelerometer movement data

Microphone Make noise The raspberry pi returns X near the varying digital values microphone

Heartbeat Lay in bed with The module’s application X the module returns heart rate attached to the side

VIII. Risks

The highest risk components identified were sleep stage detection, contactless heartbeat sensing, snore mitigation, and quiet air inflation. An additional high-risk component is snore detection, which is crucial in determining when to make snoring mitigation adjustments. Sleep Smarter 37

Overall Risks

Risk Why? Potential Failures Risk Mitigating Proposal

Contactless Need to measure May not find a SCA11-H with WiFi heartbeat sensing heartbeat to detect useable or accurate sleep cycles sensor

Snore mitigation Need to successfully Chosen movement of Inflatable pillow along mitigate snoring so the head will not help neck region that the feature is reduce snoring useful

Quiet air inflation Head movement Inflation device may Sports ball pump must be done quietly be too loud or not within sound and gently so that the strong enough dampening box user doesn’t wake up

Snore detection Snoring must be May not be able to Place microphone on detected to determine detect snoring due to side of bed to listen when to start and noise or recognition for snoring stop mitigation limitations process

Sleep Stage Predicting deep sleep May not be able to Using 3 different Prediction vs light sleep vs REM collect required data sensors sleep accurately so to accurately predict (accelerometer, optimal alarm feature sleep stage. microphone, works properly Heartbeat data not heartbeat sensor) in precise enough to combination to detect variance. increase prediction Accelerometer can’t accuracy. detect movement far from the pillow.

Heartbeat Detection Contactless heartbeat measurement is high risk due to the difficulties of performing contactless heartbeat measurements and finding the optimal position for placing the component for heart rate detection. Through research, the ballistocardiogram approach to contactless heart rate measurement was determined to be the best. For the weights, design cost/time, the accuracy of heartbeat measurement, and obtrusiveness were the most important factors. Essentially our main goal is to deliver a design that the user is comfortable sleeping with. The heartbeat detection portion also must be accurate and precise to properly perform sleep Sleep Smarter 38 analysis. All other criteria were based on research, and how hard a given system would be to configure for heartbeat detection.

Criteria (With Weights) Option 1 Option 2: Option 3: Low- Option 4: Option 5: (Reference): RFID Frequency 24 GHz XBOX Kinect SCA10H/SC tags Pillow Radar A11H Microphone Balitogardiog ram

Requirement of External 0 -2 0 -2 -2 Antennas/Difficult Mounting (2)

Availability of Existing 0 -1 -1 -1 +1 Components (3)

Availability of Successful 0 1 1 +2 +1 Research (3)

Obtrusiveness to User (5) 0 -1 0 0 0

Proximity of device to 0 0 1 -1 -1 Pillow (4)

Product Cost (1) 0 +2 -1 -2 -2

Accuracy of Heartbeat 0 -1 -1 +1 -1 Measurements (5)

Design Cost/Time (5) 0 -1 -1 -1 -1

Score 0 -20 -7 -7 -14

The fact that the ballistocardiogram approach would be easy to implement by placing on the side of a mattress, and is not subject to advanced setup, design, or signal processing makes this option the best choice. Placing the sensor on the side of the mattress with the speaker mitigates risk because it allows the system to be integrated into virtually all bed setups. Placing the BCG sensor under the mattress requires the user to have a wooden or metal bed frame to set the sensor on. In the event that the user does not have a mattress frame, placing the sensor on the side of the mattress will allow for consistent and accurate heartbeat measurement.

Sleep Stage Detection Sleep stage detection is a high-risk component because of the difficulty of predicting the sleep stage without using medical grade equipment. Additionally, another major risk is predicting this accurately so that the user is not woken in deep sleep or REM sleep. The initial idea was to use a heartbeat sensor and use the heartbeat behavior throughout the sleep stages Sleep Smarter 39 to predict sleep stages, so the heartbeat sensor was used as the reference. Each sensor option was scored on its availability, cost, design time for sleep stage prediction algorithm, ease of collecting data, ease of integrating into a pillow, and accuracy of the sleep stage prediction. The most important criteria were the accuracy of sleep stage prediction which is crucial for the optimal alarm feature, and the design time for the sleep stage prediction algorithm since we have limited time to implement this. A weight is assigned to each criterion according to their importance, and each criterion was scored between -2 and 2. The Pugh table is shown below.

Criteria (With Weights) (Reference): Accelerometer Microphone Camera EEG, EMG, Heartbeat (detect EOG Sensor movement)

Availability (2) 0 +2 +2 +2 -4

Cost (1) 0 +1 +2 +1 -3

Algorithm 0 +4 +4 -4 -8 Design/Research Cost/(4)

Ease of Data Collection 0 +3 +3 +3 -6 (3)

Ease of Integrating into 0 +2 +2 -4 -4 Pillow (2)

Accuracy of Sleep Stages 0 -5 -5 -5 +20 (5)

Score 0 +7 +8 -8 -5

The two highest-scoring options were accelerometer and microphone. These sensors scored poorly on accuracy because they are unable to detect REM sleep or deep sleep accurately, but they are low cost and are easier to integrate/design. So, to get extra accuracy, a three-sensor approach was taken which combined the accelerometer and microphone with a heartbeat sensor. Heartbeat allows for determining changes in sleep stages more precisely as the heart rate and respiratory system slow down in light sleep and slow down even further in deep sleep. Additionally, the heartbeat has a high variation in REM sleep which is harder to determine with movement and noise alone. Accelerometer and a microphone were also added to determine basic sleep stages such as awake, light sleep, and deep sleep. This design mitigates risk because it uses a combination of three sensors which decreases the risk that multiple sensors incorrectly predict the sleep stage. The other options such as camera and EEG, EMG, EOG were not feasible because of algorithm design cost, cost, and/or availability.

Quiet Air Inflation Quiet air inflation is another high-risk component because it is required for this design to move the user’s head and mitigate snoring. The inflation device must be quiet and gentle so that Sleep Smarter 40 it does not cause the user to wake up. This is high risk because air compressors tend to be very loud, or quiet but not powerful enough to lift the user’s head. In order to roughly determine the pressure in PSI (pounds per square inch) required, the average weight of a human head was divided by an estimation of the area of the head that will be in contact with the pillow at any given time. This is shown in equation 1.

11 lbs / 9 푖푛2 = 1.22 PSI (1)

The estimated minimum pressure was 1.22 PSI. Next, a Pugh chart was used to identify the best air compressor pump for this design.

Aquarium Air Sports Ball Tire Air Industrial Air Mattress Pump Pump Air Pump Compressor Pump

Can reach a pressure -1 +1 +1 +1 +1 high enough to raise someone’s head (10)

Loudness (5) +1 0 0 -1 -1

Price (1) +1 +1 0 0 -1

Complexity of 0 0 -1 0 -1 controlling with Pi (3)

Physical size (3) +1 0 +1 0 -1

Auto shutoff feature (3) -1 -1 +1 +1 +1

Total -4 8 13 6 1

The sports ball pump was identified as the air compressor with minimal risk. This pump is small and can reach the desired PSI. It is low priced and has an auto-shutoff feature which is very useful. However, the loudness of the pump is a high-risk component. To mitigate this risk, a baffle box filled with convoluted foam padding will be designed to encase the pump. When testing, if the sound mitigating box is not enough, more soundproofing could be added within the box. The box will also be helpful to contain all of the parts and make a black box that the user Sleep Smarter 41 should not have to worry about. Also, to reduce complexity for the user, the pump should be powered with a wall outlet so that the user does not need to charge or replace a battery. The pump is battery powered, so it must be manually converted to be powered by an AC wall supply. A high-risk component that may fail is controlling the pump with the Raspberry Pi since it was designed for manual, button pressing control. A relay can be used to send and cut power to the device, which could be used to turn on and off the device. Also, if the settings cannot be pre- configured and remembered by the device, hardwiring could be used to configure the device each time it is started. The device needs to be purchased and evaluated in order to determine the level of difficulty it will take to control the pump with the Raspberry Pi.

Snoring Mitigation Mitigating snoring is one of the key components of our design, but it is a high-risk component because a poorly designed system can reduce the quality of the user’s sleep. Most of the design concepts that were considered were just variations of the inflatable chamber design. This was because the inflatable chamber was proven to work by a company that has already designed a snore mitigation product. The Pugh chart below was used to determine which concept to implement.

Criteria Concept

Single Motorized Multiple Multiple Neck Inflatable Pad Inflatable Inflatable Support Chamber Chambers Chambers with (Reference) (Parallel) (Perpendicular) Inflatable Chamber

Comfort (5) - -2 0 0 -1

Flexibility (3) - 1 1 1 1

Intrusiveness - -2 0 0 0 (5)

Simplicity (2) - -2 -2 -1 0

Cost (3) 0 -2 -1 0

Total - -21 -7 -2 -2

Sleep Smarter 42

Initially, the multiple inflatable chambers in parallel design was picked because of the possibility that it could slightly improve the already proven functionality of the inflatable chamber design. By allowing the chambers to move the head in more directions, it was assumed that it would be a better design compared to a single inflatable chamber. However, the cost of the design was not considered when that decision was made. The multiple chamber design would cost significantly more than using just a single chamber which is reflected in the Pugh table. This is because more chambers would be needed and because each chamber would need a pressure sensor to determine where the head was. The chance that the multiple chamber design would only slightly increase the effectiveness of reducing snoring did not justify the significant additional costs that it would require.

For the snore detection risk, initially, a microphone was going to be placed within the pillow apparatus in order to detect snoring. However, this may muffle the sound and lead to false readings due to the movement of the pillow and user. To mitigate this risk, it was decided to move the microphone from the pillow to the side of the bed to reduce muffling and excess noise from the microphone rubbing against the pillowcase. This also helps create a more comfortable design because fewer elements will be contained within the pillow, making the pillow more comfortable for the user. There is still a high risk associated with detecting snoring and filtering it from other noise. Signal processing may be difficult on the noise data due to the low volume and variation among different people’s snoring. Testing will be needed to confirm that an algorithm could recognize that the user is snoring.

IX. Management Plan

Original Plan Task Completion Date Member(s) Responsible

Air pump box assembly: Create a box that has August 26, 2019 AR soundproofing capabilities that can contain the Raspberry Pi, Air pump, and electrical components.

Air pump wiring: Take apart the electric air September 20, 2019 AR pump and wire it so that it can be controlled by the Raspberry Pi.

Solder relay to prototype board; test turning on September 20, 2019 AR the pump with it.

Get access to muRata sleep analysis software September 20, 2019 ED demo and analyze graphical sleep analysis.

Create a program that analyzes sleep data and September 20, 2019 ED determines sleep stages. DI Sleep Smarter 43

Microphone signal analysis: Calibrates the September 20, 2019 KK microphone to determine when the user is DI snoring.

Accelerometer configuration: Calibrates the September 20, 2019 ED accelerometer and interprets the data retrieved DI from it.

Load operating system onto an SD card and get September 20, 2019 AR Raspberry Pi up and running for testing

Pump to pillow configuration: Create the system September 27, 2019 AR for allowing air into the pillow and releasing air KK from the pillow.

Application development: Write code for September 27, 2019 DI displaying information in graphs and for setting KK an alarm.

Data analysis: Takes the data retrieved from the October 27, 2019 ED heartbeat sensor and accelerometer and DI determines REM cycles.

Alarm functionality: Enable the Raspberry Pi to October 27, 2019 KK trigger the phone’s alarm system at a specified time.

Construction of the physical device: Wire all the October 27, 2019 ED components together through the GPIO pins.

3-D print protective casing: Creates the October 27, 2019 ED blueprint for creating a protective case for some AR of the components. KK

Testing Completion November 26, 2019 ED AR DI KK

Actual Plan with Modified Completion Dates Name of Task/Milestone Originally Team Modified Comments Scheduled Member Completion Completion Initials Date Sleep Smarter 44

Date

Air pump box assembly: August 26, AR N/A Completed Create a box that has 2019 soundproofing capabilities that can contain the Raspberry Pi, Air pump, and electrical components.

Air pump wiring: Take apart September AR N/A Completed the electric air pump and 20, 2019 wire it so that it can be controlled by the Raspberry Pi.

Solder relay to protoboard; September AR N/A Completed test turning on the pump with 20, 2019 it.

Get access to muRata sleep September ED N/A Completed analysis software demo and 20, 2019 analyze graphical sleep analysis.

Create a program that September ED N/A Completed analyzes sleep data and 20, 2019 DI determines sleep stages.

Microphone signal analysis: September KK November 3, Completed Calibrates the microphone to 20, 2019 DI 2019 determine when the user is snoring.

Accelerometer configuration: September ED September 27, Completed Calibrates the accelerometer 20, 2019 DI 2019 and interprets the data retrieved from it.

Load operating system onto September AR N/A Completed an SD card and get 20, 2019 Raspberry Pi up and running for testing

Pump to pillow configuration: September AR October 13, Completed Create a system for allowing 27, 2019 KK 2019 air into the pillow and releasing air from the pillow. Sleep Smarter 45

Application development: September DI November 3, Completed Write code for displaying 27, 2019 KK 2019 information in graphs and for setting an alarm.

Develop snore mitigation October 20, AR N/A Completed algorithm 2019

Data analysis: Takes the October 27, ED N/A Completed data retrieved from the 2019 DI heartbeat sensor and accelerometer and determines REM cycles.

Construction of the physical October 27, AR November 3, Completed device: Wire all the 2019 ED 2019 components together through the GPIO pins.

Integration: App/RPI and November 12, ED December 1, Completed RPI/Pillow 2019 AR 2019 DI KK

Testing Completion November 26, ED December 4, Completed 2019 AR 2019 DI KK

X. Perspective

Sleep Smarter 46

The anticipated project was a low-cost sleep monitoring device. The sleep device was also originally planned to be a wristband. After observing the difficulties of making a low cost and comfortable wristband to accurately track sleep, we moved to a contactless sleep monitoring system where cost was not a priority. Our main priority for the project changed to make the product be as accurate as possible while still maintaining comfortability. For the contactless design, we originally intended on using the SCA10H ballistocardiogram sensor for heartbeat measurement. However with the difficulty of configuring, interfacing, and filtering the sensor data we chose to use the SCA11H sensor which encapsulates the SCA10H sensor for ease of use. Initially, noisy data was read from the SCA11H sensor. We thought that a more advanced signal processing algorithm would be needed to interpret this data. Through experimentation we realized that calibrating the bed sensor with the specified direction on the sensor. Additionally, having the user only sleep on their backs (as the sensor was calibrated) cased the data to be much less noisy. K-means was tested for classifying heart rate measurements read by the murata sensor. Unfortunately, the data tested with not very separable and it was not labeled - so using k-means clustering was determined not to be a good way to perform sleep stage prediction. Fine tuning our algorithm over several nights of recorded data with the fitbit ground truth, allowed us to create an algorithm that generalized well on unforseen sleep data. Another major challenge in this project was integration. There were a lot of networking issues that were encountered when integrating the app with the pi. One issue was dynamically getting the IP address of the Pi, since the Pi’s IP address will be different everything it connects to WiFi. We came up with a solution that allows the app to send a broadcast message to which the Pi responds to with it’s IP address. This was successful, but broadcast did not work in RIT’s network. Other problems were encountered with establishing and closing connections between the Pi/App cleanly and without any errors. Overall, we had to spend a significant amount of time making the networking for the project as clean as possible. This was done so any potential networking errors would be handled gracefully without breaking the App or the Pi. Limitation on time and funding directed us to make safer decisions when it came to planning the snore mitigation subsystem. The singular pillow design was proven to work through other projects which is why it was a safe design choice for us to make. We were not able to test if using multiple inflatable was more effective in mitigating snoring because it would be much more expensive and time-consuming. There are a few difficulties relating to the inflation of the pillow. Connecting the air pump to the pillow must be airtight and the connection to the lip of the pillow will be difficult to secure and seal. Also, the deflation of the pillow cannot be done with the pump, so a T-shaped fitting was needed and an electric valve must be controlled to let the air out. Analysis of the microphone data proved to be much more difficult than anticipated. The initial plan for detecting snoring was to perform frequency analysis on the data received from an electret microphone module, however, the analog to digital converter we purchased did not have a high enough sampling rate. We bought a 16-bit converter assuming that we would need that precision, but we failed to consider the fact that it meant having a lower sampling rate. As a result, we ended up with an algorithm that looks for peaks in sounds, but getting data in the lab Sleep Smarter 47 was a nightmare. For a long time, we thought that the microphone was behaving strangely, but it was just the lab introducing noise into the data.