It has been well established that sleep is a crucial factor for productivity and
even health. While ideally people should sleep for at least 8 hours a day,
modern changes in work habits and cultural stresses has significantly affected
not only how much we sleep, but also how we sleep. HypnoLarm targets this
issue, and strives to make the most out of the sleep we get by addressing the
problem from a modernistic ergonomic viewpoint.
It has been proven that waking up during different sleep stages has profound and
significant effects on an individual’s alertness and energy levels. HypnoLarm is a
sleep optimization system that aims to use “free-form” electroencephalography
(EEG) to continuously track and analyze a user’s sleep stage in real time. It can then
optimizes waking for users around their desired set time through a combination of
sleep stage detection and prediction.
Analog low pass filtering of EEG signals in the 1 – 30 Hz range.
Multiplexing and sampling of EEG data using Arduino Mini processor unit.
Digitally filter signal at cutoff of 30Hz.
Cluster analysis of EEG signals using frequency domain parameters for sleep
EEG Signal Collection
For this project, we used the Biopac Ag-AgCl dry EEG electrodes. Using CAD and
3D printing, we designed and printed electrode caps to cover and attach the
shielded wire leads to the electrodes.
2. The alarm module
Processor unit which receives EEG data wirelessly from the sensor sheet, and
analyzes the signals to identify sleep stages. The algorithm tracks the user’s sleep
over the entire night, and determines an optimal time to wake the user around his
or her desired time through a combination of sleep stage prediction and detection.
foam ensures only
voltage data from the
user’s scalp is recorded.
EEG electrodes spaced 1 inch
apart, center-to-center in order
to best replicate a clinical EEG
Central Arduino microprocessor
unit performs multiplexing and
digital low-pass filtering of EEG
sensor reading, then sends data
array to alarm module via
The HypnoLarm design comprises two separate modules operating in tandem with
each other through a wireless communications protocol:
1. The sensor sheet
An array of dry EEG sensors encased in foam to accurately record EEG signals during
Sensor Sheet Final Design
EEG signals have magnitude in the microvolt range. A much larger voltage
magnitude is needed to detect changes in the signal. We used an instrumentation
amplifier with Rg = 560Ω to get a gain of 89.2.
The Arduino Mini Pro analog inputs accept voltages in the 0 – 5V range. Since EEG
signals can have negative voltages, this poses a problem for the Arduino during
reading. To get around this, we use a non-inverting summing circuit to shift the
EEG signal from the -2.5 – 2.5V range into the 0 – 5V range. The summing circuit
is currently unity gain, but offers another stage for us to introduce more gain if we
need to in the future.
During the course of this project, a cluster-analysis method was chosen to identify sleep
stages from EEG data samples. This method allows for an abstraction of using signal
properties to determine state.
The clustering method first receives instruction for EEG signal feature parameters to
extract, which may or may not be deterministic in sleep stage identification. A set of prescored EEG sleep data is then fed into the algorithm, and their features extracted. The
algorithm then categorizes the feature vector values based on the sleep stage (cluster)
for that particular sample. This is followed by PCA analysis which identifies and calculates
3 eigenvectors, from the feature parameters, that provide the greatest intra-cluster
differentiation. Each sample is then plotted on a 3-D vector space and color coded for its
corresponding sleep stage, with the 3 eigenvectors as the axis. Visible clusters of points
for each stage of sleep is formed, and sleep stage can be identified by the cluster a
sample point falls into.
Shielded wire does not eliminate all of the noise present in our signal. In the next
analog stage, we implement a low pass filter to eliminate frequencies outside our
desired range. As mentioned previously, our frequency range of interest is the 1 –
30 Hz range. The second order filter has a cutoff frequency of 29Hz. Following
the low pass filter, we have a unity gain buffer that transforms the high
impedance input into a low impedance input before we enter the Arduino.
Two-stage analog and digital filtering to Accurately extract EEG signal features of
effectively eliminate EEG signal noise interest for determination of sleep stage.
without distorting signals in spectrums of
Stage Scoring Using Clusters
Sleep Stage Clusters Formed Using Pre-scored Sleep EEG Data
Multiplex EEG sensors to identify and Perform time continuous reading of EEG
select single channel with best signal signals while performing analysis in realquality for sleep stage analysis.
Maintain constant sampling rate of each
EEG sensor’s signal.
Stable wireless communication protocol of sufficiently large data rate.
Overall Alarm Algorithm flow chart