Introduction: Smart Pillow

Picture of Smart Pillow

This Instructable describes how to make a smart pillow that is sensitive to snoring!

The smart pillow relies upon vibration to indicate to the sleeper when he snores while sleeping. It works automatically when a person puts his head on the pillow.

Snoring is an unfortunate condition because it affects not only on the snoring person but also people who are sleeping around him. Snoring has been voted as the greatest medical reason behind divorce in the USA. Additionally, sleep apnea can cause a wide array of health problems that can be mitigated by ensuring a sleeper does not choose a position that leads to snoring.

In this Instructable, we will build a system which can detect & analyze sounds. When it analyzes a snoring sound, it will turn on a vibration motor so that the sleeper wakes up. When the sleeping person lifts his head off the pillow, the vibration motor will stop. When a sleeper changes their sleeping position they are more likely to settle into a different position that will prevent snoring.

Step 1: Pillow Tasks:

Picture of Pillow Tasks:

  • The pillow has a touch sensor so that the system is enabled automatically when the person places his\her head on pillow, and is idle when he raises his head up.
  • When the system detects a snoring sound or any other cacophonic sound, a vibrator is turned on to wake the sleeper up.
  • Features 2 user settable vibration modes: continuous or pulsed.The system is useful for people who suffer from snoring. For safety, people who suffer from very deep sleep can also use the system because it can detect doorbells, ringing phones or crying babies.

We implemented this project with a Silego SLG46620V CMIC, a sound sensor, a vibration motor, force-sensing resistor and some passive components.

The total number of components for this design is quite minimal, despite not utilizing a microcontroller. Since GreenPAK CMIC’s are low-cost and have low-power consumption, they are an ideal component for this solution. Their small size also would allow them to be easily integrated inside the pillow without manufacturing concerns.

Most projects that depend on sound detection have a "false trigger rate", which is necessary due to the possibility of error amongst a variety of sensors. The sensors associated with this project merely detect a level of sound; they do not detect the type of sound or the nature of its origin. Consequently, a false trigger can be caused by an act such as clapping, knocking or other noise unrelated to snoring that may be detected by the sensor.

In this project the system will ignore the short sounds which cause false trigger rate, so we will build a digital filter that can detect a sound segment like the sound of snoring.

Look at the graphic curve in figure 1 which represents the sound of snoring.

We can see that it consists of two sections which are repeated and time correlated.
The first section detects snoring; it is a sequence of short pulses that lasts for 0.5 to 4 seconds, followed by a silence period which lasts for 0.4 to 4 seconds and may contain background noise.

Therefore, to filter out other noises the system must detect a snoring segment, which lasts for more than 0.5 sec, and ignore any briefer sound segment. To make the system more stable, a counter should be implemented which counts the snoring segments to launch the alarm after the detection of two sequential snoring segments.

In this case, even if a sound lasts for more than 0.5 sec, the system will filter it unless it is repeated within a specific time frame. In this way, we can filter the sound that can be caused by a movement, cough or even short noise signals.

Step 2: Implementation Plan

Picture of Implementation Plan

The design of this project consists of two sections; the first section is responsible for detecting sound and analyzes it to detect the sound of snoring to alert the sleeper.

The second section is a touch sensor; it is responsible for automatically enabling the system when a person puts his head on the pillow, and to disable the system when the sleeping person lifts his head off the pillow.

A smart pillow can be very easily implemented with a single GreenPAK configurable mixed-signal IC (CMIC).

You can go through all steps to understand how the GreenPAK chip has been programmed to control the Smart Pillow. However, if you just want to easily create the Smart Pillow without understanding all the inner circuitry, download free GreenPAK software to view the already completed Smart Pillow GreenPAK Design File. Plug your computer to the GreenPAK Development Kit and hit program to create the custom IC to control your Smart Pillow. Once the IC is created, you can skip the next step.
The next step will discuss the logic that is inside the Smart Pillow GreenPAK design file for those that are interested in understanding how the circuit works.

How it works?

Whenever a person puts their head on the pillow, the touch sensor sends an activation signal from Matrix2 to Matrix1 through P10 to activate the circuit and to start taking samples from the sound sensor.

The system takes a sample from the sound sensor every 30ms within a 5ms time frame. In this way, energy consumption will be saved & short sound pulses will be filtered.

If we detect 15 sequential sound samples (no silence lasts for more than 400ms between any of the samples), it is concluded that the sound is persistent. In this case, the sound segment will be considered a snoring segment. When this action repeats after a silence, which lasts more than 400ms and less than 6s, the captured sound will be considered snoring and the sleeper will be alerted by vibration.

You can delay warning for more than 2 snoring segments to raise accuracy from pipedelay0 configuration in the design, but this may increase response time. 6sec frame would need to be increased as well.

Step 3: GreenPAK Design

Picture of GreenPAK Design

First Section: Detection of Snoring

The output of the sound sensor will be connected to Pin6 which is configured as an analog input. The signal will be brought from the pin to the input of ACMP0. The other input of ACMP0 is configured as a 300mv reference.

The output of ACMP0 is inverted and then connected to CNT/DLY0, which is set as a rising edge delay with a delay equal to 400ms.The output of CNT0 will be high when the detection of silence lasts for more than 400ms. Its output is connected to a rising edge detector, which will generate a short reset pulse after detecting silence.

CNT5 & CNT6 are responsible for opening a time gate that lasts for 5ms every 30ms to take sound samples; during these 5ms if there's a detection of a sound signal, the output of DFF0 gives a pulse to the counter CNT9. CNT9 will be reset if a silence detection lasts for more than 400ms, at which point it will restart the counting of sound samples.

The output of CNT9 is connected to DFF2 which is used as a point to detect a snoring segment. When a snoring segment is detected, the output of DFF2 turns HI to activate CNT2/Dly2, which is configured to work as "falling edge delay" with a delay equal to 6 sec.

DFF2 will be reset after a silence detection that lasts for more than 400ms. It will then start to again detect for a snoring segment.

The output of DFF2 passes through Pipedelay, which is connected to pin9 through LUT1. Pin9 will be connected to the vibration motor.

The output of Pipedelay transitions from Low to High when it detects two sequential snoring segments within the time gate for CNT2 (6 sec).

LUT3 is used to reset the Pipedelay, so its output will be Low if the sleeping person lifts their head off the pillow. In this case, the time gate of CNT2 is finished before detecting two sequential snoring segments.

Pin3 is configured as an input & is connected to a "Vibration mode button". The signal coming from pin3 passes through DFF4 and DFF5 configures the vibration pattern to one of two patterns: mode1 and mode2. In case of mode1: when snoring is detected, a continuous signal is sent to the vibration motor, which means that the motor runs continuously.

In the case of mode2: when snoring is detected, the vibration motor is pulsed with the timing of CNT6 output.

So when the output of DFF5 is high, mode1 will be activated. When it is low(mode 2), the output of DFF4 is high, and the output of CNT6 will appear on pin9 through LUT1.

Sensitivity to the sound sensor is controlled by a potentiometer which is set in the module. The sensor should be initialized manually for the first time to get the required sensitivity.

PIN10 is connected to the output of ACMP0, which is externally connected to an LED. When the sound sensor is calibrated, the output of pin10 should be quite low, which means that there is no flicker on the external LED which is connected topin10. In this way, we can guarantee that the voltage which is generated by the sound sensor in silence doesn't exceed the 300mv ACMP0 threshold.

If you need another alarm in addition to vibration, you can connect a buzzer to pin9 so that a sound alarm will be activated as well.

Second section : Touch sensor

The touch sensor that we built uses Force-sensing resistor (FSR). Force-sensing resistors consist of a conductive polymer which changes resistance in a predictable manner following application of force to its surface. The sensing film consists of both electrically conducting and non-conducting particles suspended in a matrix. Applying a force to the surface of the sensing film causes particles to touch the conducting electrodes, changing the resistance of the film. FSR comes with different sizes and shapes (circle & square).

The resistance exceeded 1 MΩ with no applied pressure and ranged from around 100 kΩ to a few hundred Ohms as a pressure varied from light to heavy. In our project, FSR will be used as head touch sensor and it is located inside the pillow. The average human head weight is between 4.5 and 5kg. When the user puts his head on the pillow, a force is applied on the FSR and its resistance changes. GPAK detects this change and the system is enabled.

The way to connect a resistive sensor is to connect one end to Power and the other to a pull-down resistor to ground. Then the point between the fixed pull down resistor and the variable FSR resistor is connected to the analog input of a GPAK (Pin12) as shown in figure 7. The signal will be brought from the pin to the input of ACMP1. The other input of ACMP1 is connected to a 1200mv reference setting. Comparison result is stored in DFF6. When a head touch is detected, the output of DFF2 turns HI to activate CNT2/Dly2, which is configured to work as "falling edge delay" with a delay equal to 1.5 sec. In this case, if the sleeper moves or turns from side to side and the FSR is interrupted less than 1.5 sec, the system is still activated and no reset occurs. CNT7 and CNT8 are used to enable FSR and ACMP1 for 50 mS every 1sec in order to reduce power consumption.

Conclusion

In this project we made a smart pillow which is used for snoring detection to alert the sleeping person by vibration.

We also made touch sensor using FSR to activate the system automatically when using the pillow. A further enhancement option could be to design in parallel FSR’s to accommodate larger size pillows. We also made digital filters to minimize the occurrence of false alarms.

Comments

About This Instructable

161views

5favorites

License:

Bio: Silego provides a development platform based on an easy-to-use hardware and software GUI that allows users to easily create custom ICs. We provide design files ... More »
More by Silego:Make a Maze Runner RobotSmart PillowHalloween Ghoulish Illuminator
Add instructable to: