Sleep Detector

36
No Doze EEG Sleep Detector Created by: Benjamin Schneider David Mahr Kuang Tan ECE 445, SENIOR DESIGN PROJECT FALL 2006 TA: Hyesun Park December 5, 2006 Project No. 9

description

project

Transcript of Sleep Detector

Page 1: Sleep Detector

No Doze EEG Sleep Detector

Created by:

Benjamin SchneiderDavid MahrKuang Tan

ECE 445, SENIOR DESIGN PROJECT

FALL 2006

TA: Hyesun Park

December 5, 2006

Project No. 9

Page 2: Sleep Detector

ABSTRACT

An appreciable difference exists between brainwaves of a person that is awake and a person that is on the verge of sleep. As a person transitions from alertness to sleep, the alpha rhythms of his/her brainwaves decrease in frequency, diminish in amplitude, and become more irregular in frequency. These brainwave changes can be sensed using an electroencephalogram (EEG). We developed a device that will recognize the shift from wakefulness to sleep, via recognition of the frequency of the EEG signal, and then relay that information wirelessly to an alarm system. The alarm system will visually display the awareness level of the user and provide audio alerts when the user is drowsy or has falling asleep.

ii

Page 3: Sleep Detector

1. INTRODUCTION....................................................................................................................41.1 Purpose...............................................................................................................................51.2 Specifications......................................................................................................................51.3 Subprojects.........................................................................................................................2

1.3.1 EEG Module.........................................................Error: Reference source not found1.3.2 Sleep Signal Processing Module..........................Error: Reference source not found1.3.3 Buzzer Alarm Module..........................................Error: Reference source not found1.3.4 Wireless Communication Module........................Error: Reference source not found1.3.5 LED Awareness Indicator Module............................................................................21.3.6 Audio Module............................................................................................................21.3.7 Power Supply Module...............................................................................................2

2. DESIGN PROCEDURE...........................................................................................................32.1 EEG Module Design...........................................................................................................32.2 Signal Processing Module Design......................................................................................32.3 Buzzer Module Design.......................................................................................................52.4 Wireless Module................................................................................................................5 2.5 LED Awareness Indicator Module Design.........................................................................52.6 Audio Module.....................................................................................................................62.7 Power Supply Design.........................................................................................................6

3. DESIGN DETAILS..................................................................................................................73.1 EEG Module.......................................................................................................................73.2 Signal Processing Module..................................................................................................83.3 Buzzer Module....................................................................................................................93.4 Wireless Module................................................................................................................9 3.5 LED Awareness Indicator Module...................................................................................103.6 Audio Module...................................................................................................................113.7 Power Supply....................................................................................................................11

4. DESIGN VERIFICATION..............................................13Error: Reference source not found4.1 Testing..............................................................................................................................13

4.1.1 EEG Module ...........................................................................................................134.1.2 Signal Processing Module.......................................................................................154.1.3 Buzzer Module........................................................................................................154.1.4 Wireless Module......................................................................................................164.1.5 LED Awareness Indicator Module..........................................................................164.1.6 Audio Module..........................................................................................................164.1.7 Power Supply Module.............................................................................................17

4.2 Conclusions.......................................................................................................................17

5. COST......................................................................................................................................185.1 Parts..................................................................................................................................185.2 Labor.................................................................................................................................18

6. ETHICAL CONSIDERATIONS............................................................................................196.1 Device Ethics....................................................................................................................19

7. CONCLUSIONS....................................................................................................................20

REFERENCES.......................................................................................................................21iii

Page 4: Sleep Detector

APPENDIX A – BLOCK DIAGRAMS.................................................................................22

APPENDIX B – SCHEMATICS............................................................................................23

APPENDIX C – FLOW DIAGRAMS...................................................................................28

APPENDIX D – SIMULATIONS & TEST DATA...............................................................30

APPENDIX E – PICTURES..................................................................................................40

APPENDIX F – PARTS AND COST....................................................................................45

APPENDIX G – MISCELLANOUS......................................................................................47

APPENDIX H – PIC CODE...................................................................................................48

iv

Page 5: Sleep Detector

1. INTRODUCTION

An EEG collects brainwaves by measuring the voltage differentials across the scalp. These brainwaves vary in frequency and amplitude and fall into four main categories: alpha, beta, delta, and theta. The type of brainwave, which is based mainly on frequency, is indicative of a person’s level of awareness (see Table G.1). We created a device that monitors the frequency of a user’s brainwaves, and alarms the user (and using both visual and audio alerts) when the user’s brainwaves decrease in frequency to a point that is indicative of drowsiness or sleep. This process is accomplished through the use of an EEG, a signal processing module, a wireless transmission unit, and alarm circuits. The EEG provides the signal processing PIC with the brainwave signal. The PIC then calculates the EEG signal’s frequency, determines the user’s awareness level, and outputs accordingly. The PIC outputs are then relayed wirelessly to the audio and visual alarm units.

1.1 Purpose

Our goal in creating this product was to develop a life saving device that will alert drivers that are drowsy or have fallen asleep. Fatigue exists as the direct cause of approximately hundred thousand crashes in the United States each year. Additionally, drowsiness is a major contributor to driver inattention: the cause of one million crashes annually, or one-sixth of all crashes. These automobile accidents result in fifteen hundred fatalities, seventy-one thousand injuries, and twelve and one half billion dollars in monetary losses [1]. Even with this magnitude of loss, no effective sleep detector for drivers is currently available on the market. We chose this project because a device that could prevent these tragic physical damages and financial losses associated with fatigue related automobile accidents would be very beneficial to the welfare of our society.

1.2 Specifications

The main specification of our device is that the user must be alerted within one second of the occurrence of sleep. To accomplish this feat, several specifications were set for each module. The EEG module must amplify the microvolt brainwave signal to provide the signal processing PIC with an input signal of at least 1V peak-to-peak and a maximum of 10V peak-to-peak (0.5V – 5 V in amplitude). The EEG module must also eliminate any DC bias in the brainwave signal, and filter out any signal with a frequency outside the range of 1 to 40 Hz. Also, the EEG module must be supplied by +5V and -6V. The signal processing, buzzer, wireless, LED awareness indicator, and audio modules must be supplied by +5V. The PIC microcontrollers in the signal processing and audio modules must not source or sink more than 25mA. The buzzer circuit must have three distinct volume levels in which the module progresses through (separated by 1.5s). The RSSI signal of the wireless module has to be at least 3.85 V (for the LED circuit to function). Also, the communication between the transmitter and receiver in the wireless module must have a range of at least 6 ft.

1.3 Subprojects

Our project is divided into several subprojects which each perform specific task (see Figure A.1):

1.3.1 EEG Module

The EEG module amplifies brainwaves via the differential voltage measured on the scalp by electrodes on the forehead. The EEG circuit should amplify the brainwave signal to at least 1 V peak-to-peak and sufficiently filter out frequencies 2.38 to 39.38 Hz. A favorable SNR ratio also needs to be maintained throughout the amplification process.

v

Page 6: Sleep Detector

1.3.2 Signal Processing Module

The signal processing module is used to calculate the frequency of the analog EEG signal. The determined frequency is then used to classify the level of awareness of the user. This module outputs four different signals: Transmitter_Power, Sleep_Indicator, Buzzer0, and Buzzer1. The Transmitter_Power output serves to power up the wireless transmitter. The Sleep_Indicator output serves as the data bit sent by the transmitter. Shift in the value of these outputs reflect a change in the awareness level of the user, and thus, changes in the values of these two signals will only occur at 8 Hz and 12 Hz – the threshold frequencies between high alertness and low awareness and between low awareness and sleep, respectively. Buzzer0 and Buzzer1 outputs are used to select the volume level of the buzzer alarm.

1.3.3 Buzzer Module

The buzzer module is used to alert a sleeping user. This module receives two input signals from the signal processing unit. These inputs select the volume of the buzzer by selecting one of four different voltage levels that are available to the piezo-buzzer. When the user is not asleep, the buzzer will be silent. However, when the user falls asleep, the buzzer proceeds through a progression of three alarm volumes from lowest intensity to highest intensity. The transitions in the alarm volume are separated by 1.5 seconds. The alarm will remain at the highest intensity until the user is no longer asleep.

1.3.4 Wireless Module

The wireless module receives two signals from the signal processing module which are used as the control inputs for the LED logic module (after proper conversion). Transmission range of this module is about 10 to 15 feet.

1.3.5 LED Awareness Bar Module

The LED logic module receives two digital inputs from the wireless module, and uses them inputs, which are based on the awareness status of the user, to select the color of the LED. This module also controls the output of the audio module.

1.3.6 Audio Module

This module receives input from the LED logic module. By using a PIC, this module generates melodies based on the input from the LED logic module (reflects status of the user). Audio is transmitted via a speaker as an output.

1.3.7 Power Supply Module

The power supply module converts input voltages from 6V to 24V unregulated DC source into +5V and -6V with respect to ground. Batteries that can be used in this module are 12V batteries, 9V batteries, or AA/AAA batteries.

vi

Page 7: Sleep Detector

2. DESIGN PROCEDURE

2.1 EEG Module Design

The function of the EEG module was to successfully acquire brainwaves signals, sufficiently amplify the signal and filter out extraneous noise. This is an essential component of the project as this signal will be used to determine the awareness of the subject. Disposable Ag/AgCl electrodes were used on the scalp and placed on the right and left side of the forehead (E.3). An additional electrode was placed on the neck to act as a ground. 5.1kΩ resistors were also placed in series with the electrodes in order to protect the user from the circuit [6].

To initially amplify the signal, instrumentation amplifiers were used. An instrumentation amplifier is a specific type of differential amplifier used to measure small voltage differentials of the inputs while attenuating common inputs [7]. Instrumentation amplifiers are more advantageous to use over operational amplifiers as they are specifically designed to have low DC offset, low drift, low noise, and high common-mode rejection ratio. The AD620BNZ instrumentation amplifier from Analog Devices was chosen because it was rated high in these areas.

High-pass and low-pass filters were used to attenuate undesirable noise. Noise that was of most concern was DC offsets and 60 Hz noise. DC offsets can occur due to shifting of the electrode wires or the dipole present in the eye [6]. 60 Hz noise is due primarily to power lines. Both active and passive high-pass filters were used to filter out DC offsets. The advantages we found to using active filters were that they have sharper cut-offs, are less subject to feedback, act as a buffer to the circuit and also proved to respond quicker to spontaneous DC offsets. Passive high-pass filters were made using only resistors and capacitors, while active high-filters were made using operational amplifiers in addition to resistors and capacitors. For the low-pass filter, we used the MF6CN-50, which is an active 6th order low-pass filter designed by National Semiconductor.

2.2 Signal Processing Module Design

The main objectives of the signal processing module are to determine the frequency of the EEG signal, classify that frequency as a specific awareness level, and then output based on the user’s awareness state. The module has one input and four outputs. The single input is an analog AC voltage signal supplied by the EEG circuit. This input signal should have an amplitude between 0 and 5V, zero DC offset, and be properly filtered to only include frequencies between 1 and 40 Hz. Upon reaching the signal processing module, the input signal will pass through a half-wave rectifier to eliminate negative voltages in the signal. This module has two digital output signals to the wireless module, Transmitter_Power and Sleep_Indicator, and another two digital output signals to the buzzer circuit, Buzzer0 and Buzzer1. These outputs depend on the current and previous awareness states of the user. The user’s awareness level is based on the frequency of the EEG signal. If the frequency is greater than 12 Hz, the user is highly alert. If the frequency is between 8 Hz and 12 Hz, the user has a low awareness. And finally, if the frequency is less than 8 Hz, the user is sleeping. Using the above mentioned frequency based awareness divisions, the signal processing module determines the frequency of the input signal, and then assigns an awareness level based on that frequency. Subsequently, the user’s previous and current awareness levels are compared, and the module outputs based on that comparison. That is, if the previous awareness level is higher than the current awareness level, a decrease in awareness level has occurred, and the module will output a high Transmitter_Power output (to power up the transmitter) and a low Sleep_Indicator output (to signal a downward transition). Conversely, if the previous awareness level is lower than the current awareness level, an increase in awareness takes place, and the module will output a high signals for both the Transmitter_Power and

vii

Page 8: Sleep Detector

Sleep_Indicator outputs. If the current and previous awareness states are equal, both of these outputs will be low. As far as the Buzzer0 and Buzzer1 outputs are concerned, as long as the new awareness state is not sleeping, both of these outputs will be low. However, if the state transitions to sleep, the module will output ‘01’ for Buzzer1 and Buzzer0, respectively. If the new state continues to be sleeping after 1.5s, these output signals will switch to ’10’. If sleeping persists for another 1.5s, Buzzer0 and Buzzer1 will transition so that both outputs are high signals. These high output signals will continue for both Buzzer0 and Buzzer1 until the new state is not sleeping.

In order for our device to properly function as a sleep detector, it is imperative for the frequency analysis of the EEG signal to be accurate. After researching the possible options for this task (analog circuits, microcontrollers, digital signal processing chips), we decided that based on the functionality, low cost, and relatively low complexity, the PIC16F877A would be best suited for our project. After selecting the PIC as our frequency analysis tool, we went through a series of possible algorithms before finding the most accurate code for determining the EEG input’s frequency. In our first algorithm, the average value of the EEG signal was computed over 256 ms. Then the number of times the signal crosses that average value was counted over the next 500 ms. The frequency of the signal could then be calculated according to the equation:

(2.2.1)

where the ‘Number of Zero Crossings’ is equal to the count of transitions across the average value, and ‘Time Interval’ is equal to the amount of time the transitions are counted. And since, ‘Time Interval’ is equal to 500 ms, the equation reduces to:

Frequency = Number of Zero Crossings. (2.2.2)

However, we found voltage spikes in the EEG signal resulted in an average value that was greater than a majority of the input waveform. This high average resulted in fictitiously low frequency readings. Since this algorithm could not provide an accurate frequency reading, we developed a new algorithm.

In our second algorithm, the number positive peaks in the input signal were counted. That is, the number of times the inputs at time (t) and (t+2) were less than the input at time (t+1) were tallied. The frequency of the signal was then described by the equation:

Frequency = 2 * Number of Positive Peaks (2.2.3)

where the peaks are summed over 500 ms. However, noise at low frequencies led to additional peaks in the input signal. These extra peaks resulted in fictitiously high frequency readings. Again, since our algorithm could not correctly provide the frequency of the input signal, we developed a new algorithm.

In our third, and final, algorithm, the number of transitions to zero that occurred in the input signal are counted. That is, the number of times the input signal goes from a positive value to a zero value are added up. The frequency of the input is then described by the equation

Frequency = 2 * Number of Zero Transitions (2.2.4)

where the number of falling edges are counted over 500 ms. This algorithm is able to provide consistently accurate frequency analysis, and conduct the analysis with the second allotted in the design specifications, and thus, we selected to use it as the code for our device.

viii

Page 9: Sleep Detector

2.3 Buzzer Module

The main objective of the buzzer module is to alert a sleeping user. As listed in the design specifications, the buzzer circuit must have three distinct alarm volume levels in which the module transitions through (with 1.5 s separating intensity levels) every time the user falls asleep. We decided the easiest way to provide four different volume levels would be through the use of a simple voltage divider. Connecting different sections of the voltage divider as inputs to a 4:1 multiplexer, four different voltage levels, ranging from 0 to 5V, could be used to supply the buzzer. With the proper select input bits from the signal processing unit, the buzzer circuit could easily behave as desired.

When the user is awake, the select bits are ‘00’ and the 0V (grounded) input is selected to supply the buzzer. As such, the buzzer is silent. Following the occurrence of sleep, the select bits transition to ‘01’ for 1.5 s, and the buzzer sounds at its lowest volume. After 1.5 s, the select bits change to ‘10’ for the next 1.5 s, and the buzzer sounds with medium intensity. Finally, the select bits shift to ‘11’, and the buzzer sounds at its highest volume until the select bits are changed.

2.4 Wireless Module

The wireless module’s main objective is to transmit a sleep indicator data bit and a clock flag data bit to the LED logic circuit from the PIC in the headset unit. The module should have a range of 6 to 10 feet (about the maximum range a driver could be separated from the base alarm unit in a car or truck). The data should be transmitter and receiver specific, with no data loss in data communication, easy to control, and can be powered by a consumer power supply unit.

We were offered the use of the HP3 series transmitter receiver pair. It operates on the 900MHz band, uses FM/FSK modulation, and has a maximum range of 1000 feet. It has a built in SAW filter for out of band rejection, receive signal strength (RSSI) and power down (PDN) lines. It uses 2.8 to 13V DC and only needs minimal external components. It has an option of 8 channels in parallel mode or 100 channels in serial mode. After looking in depth into its design, we decided to make use of the data output and the RSSI output to relay the sleep indicator data bit and the clock flag data bit, respectively. Since we were using the power down lines to relay clock signals, the LM555 timer was used to generate microsecond delays so that sleep indicator and clock flag signals are synchronized perfectly. A MAX232 chip is also used to provide level voltage regulation for data coming out of the receiver.

2.5 LED Awareness Indicator Module

The LED module circuit is used to drive an LED bar that changes color based on user awareness. This module should receive wirelessly an input from the signal processing PIC. Also, the output of this module controls the audio module. The input into this module should be stable and the output should be able to drive at least 3 LEDs. In theory, the combination of the clock flag and sleep indicator bits should change the color of the LED from yellow to orange to red. Visual cues will then alert the user of their awareness status (yellow corresponding to the highest state and red the lowest). The logic implementation is based on K-Maps.

We implemented this design by using a combination of 4 gates. The gates used are OR gates, AND gates, NAND gates and D-FlipFlops. The respective chips are 74F08PC quad 2-Input AND gate, SN74LS74AN dual D-type positive-edge-triggered flip-flops with preset and clear, SN74F00 quad 2-input positive-NAND gates, and SN74LS3 Quad 2-input positive-OR gates. The LED used is the HLMP-4000 bi-color LED lamps, which features three leads with a common cathode and a diffused wide visibility lens.

ix

Page 10: Sleep Detector

2.6 Audio Module

The audio module was initially not included in the first design. It was added on because our further research showed that audio stimuli plays an important role in alerting a user from sleep. The audio cues implemented in our design include a start up melody, a warning melody, and a danger siren. Inspired by the workings of the Theremin, the design was implemented by using a variable frequency oscillator. This variable oscillator was implemented through the use of a microcontroller with various delays between “high” and “low” outputs. The microcontroller output is then amplified (gain of 200) to produce audio via a speaker.

This design was implemented using a PIC16F877A from MICROCHIP, a 5MHz oscillator, and an LM386N, a low voltage audio power amplifier. It receives input from the LED logic module, and outputs a 0.1KHz and 2KHz variable frequency melody on cue.

2.7 Power Supply Module

The main functionality of the power supply design was to produce stable voltage regulation from portable power supply sources like AA or AAA batteries or from 9volt batteries. This module provides +5V and -6V to the head set unit, and +5V to the base alarm unit.

By using the LM 317T 3-Terminal Adjustable Regulator from National Semiconductor, many of our requirements were fulfilled easily. LM317T has a guaranteed output of 1.5A, current limit constant with temperature, and the output is protected from short circuit. By using two LM317T +5V power supplies were created on the headset and base alarm unit. Later on, since the op-amps require a -6V lead relative to ground, the LM7905 3-Terminal Negative Regulator from National Semiconductor was added to regulate -6V to the headset unit. This device also has the same safety features as the LM317T.

x

Page 11: Sleep Detector

3. DESIGN DETAILS

3.1 EEG ModuleThe purpose of the EEG was to amplify the brainwave signal within 1 Vpp in order to be processed by the PIC. Because brainwaves measured on the scalp are on the order of 10 uV, we chose to amplify by a gain of approximately 122,000 [6]. Each instrumentation amplifier has a max gain of 10,000, thus we chose to operate two instrumentation amplifiers in series. The gain on each instrumentation amplifier is determined by adjusting the value of a resister across pins 1 and 8 on the chip as can be seen in Figure B.2. Equations 3.1.1 and 3.1.2 show how the gain is calculated via the resistor value. Because the two instrumentation amplifiers are placed in series, the total gain is the calculated by the product of each individual amplifier gain. Equation 3.1.3 shows the total gain.

(3.1.1)

(3.1.2)

(3.1.3)

Passive high-pass filters were placed directly before the input into the first instrumentation amplifier. These passive high-pass filters were built using resistors and capacitors and had a cutoff frequency of 0.34 Hz (Fig B.1). The purpose of these filters was to eliminate any DC offset before amplification. The equation used to determine the resistor and capacitance values is shown in Equation 3.1.4. Two active 2nd order high-pass filters were used directly after the output of each instrumentation amplifier. These active high-pass filters were built using operational amplifiers in addition to resistors and capacitors and had a cutoff of 2.34 Hz (Fig B.1). The purpose of these filters was to eliminate DC offset that had been improperly amplified by the instrumentation amplifier. The equation used to determine the resistor and capacitor values for this filter is shown in Equation 3.1.5.

(3.1.4)

(3.1.5)

xi

Page 12: Sleep Detector

An active 6th order low-pass filter was placed directly before input into the PIC A/D. This low-pass filter was an MF6CN-50, an IC built by National Semiconductor. The cutoff frequency was determined by adjusting an internal clock via the value of a resistor and capacitor across pins 11 to 9 and 9 to ground, respectively (Fig B.2). The purpose of this filter was to attenuate any high frequency noise within the signal, specifically noise due to 60 Hz power line interference. The cutoff frequency of the low-pass filter was 39.44 Hz. Equation 3.1.6 shows how the cutoff frequency was calculated.

(3.1.6)

At the end of conditioning, the signal should be an amplified signal of gain 121,825 with a frequency range of approximately 2.34 to 39.44 Hz. This is acceptable as we are looking for the transitions of a signal at 8 Hz and 12 Hz.

3.2 Signal Processing Module

The signal processing module consists of a FOX F1100E oscillator, a Microchip 40-pin DIP PIC16F877A, and various resistors and rectifiers providing current and voltage protection, respectively, for the PIC. The complete schematic for the module can be viewed in Figure B.3. A +5V input through a 1KΩ resistor is provided to pin 1. This high input voltage (with current limited by the resistor) prevents the memory of the PIC from being cleared. The analog EEG signal is provided as an input to pin 2. The PIC outputs – Buzzer1, and Buzzer0, Transmitter_Power, and Sleep_Indicator – are assigned to pins 34, 35, 37, and 38, respectively. The oscillator has a 20 MHz frequency of oscillation. 1N5822 Schottky diodes are used for the two Vdd inputs and EEG signal input (pins 11, 32, and 2, respectively) in order to protect the PIC from negative voltage. The 220Ω resistors in series with the PIC inputs and outputs are used to guarantee the PIC does not source or sink more than 25 mA. The resistor value is based on the following calculation:

Vmax = Imax*R (3.2.1) 5V = (25mA)*R

R = 200Ω

where the 200Ω result exists as the minimum resistance value.

The main detail involved in the design of the signal processing module exists as the programming of the PIC. The flow chart showing the logic behind the PIC program can be seen in Figure C.1. The code used to program the PIC can be view in Appendix H.

The PIC has an internal A/D converter that we used to convert the analog EEG signal into a digital signal for frequency analysis. The ADC converts the analog input into a 10-bit digital sample. We set the ADC to sample at a rate of 500 samples per second. We chose the rate to be 500 samples per second because it was a convenient choice for the PIC code and because such a rate would be more than adequate to satisfy the Nyquist criterion. That is, since the EEG signal of interest has a bandwidth of 40 Hz, the Nyquist criterion dictates that the sampling rate should be 80 Hz or higher to avoid aliasing. Since the accuracy of the frequency analysis of the PIC is a significant factor in the functionality of our device, we decided making the sampling rate significantly higher than the minimum rate (to increase accuracy) would be the best plan.

xii

Page 13: Sleep Detector

Using the ADC samples, the number of times the input transitions from positive to zero is counted over a 500 ms time interval. The PIC then assigns the awareness state and compares the old and new awareness levels. This process takes old microseconds due to the high frequency of the external oscillator. The PIC then outputs based on the current and previous awareness states. This process has a maximum delay of 100 ms. Therefore, one entire cycle takes only about 600 ms – a value that is well below the design specification of 1 second.

3.3 Buzzer Module

The buzzer module consists of two MCP320B2 Mallory Sonalert 6VDC piezo-buzzers, three 1KΩ resistors, and a Phillips Semiconductor HCT4052 4:1 multiplexor. The complete schematic for the buzzer module can be seen in Figure B.4. The three 1KΩ resistors are placed in series with +5V voltage source to set up a simple voltage divider. The node before the first resistor, the node after the first resistor, the node after the second resistor, and the grounded node are connected to pins 4, 5, 2, and 1, respectively (or mux inputs 3, 2, 1, and 0, respectively). The output of the multiplexer is then connected to the buzzers. The possible voltage levels available to the buzzer are described by the following equation:

Vin = Vtotal * (Req/RT) (3.3.1)

yielding 5V, 3.33V, 1.67V, and 0V as the input voltages to mux inputs 3, 2, 1, and 0, respectively. Since the volume of the buzzer depends on the voltage available, this setup allows this module to have 3 distinct alarm volumes and a silent state. 3.4 Wireless Module

Our wireless module was built with the readily available HP3 Linx Transmitter/Receiver RF pair. This design was fairly straightforward after consulting application notes from the Linx HP3 documentation. Other IC components include in this design is the MAX232 component and the LM555 component. How these components are connected can be seen from the schematics in figure B.5. Basically, the PIC in the headset unit controls the power down line of the transmitter as well as the data line. Whenever an instruction is made to change the status of the LED by transmitting a low or high signal through the data line, the transmitter will need to be powered up. On the receiver side, two outputs are considered essential; the RSSI line, and the data line. The RSSI line transmits the clock flag signal and the data line transmits the sleep indicator bit. The power down line requires at least 3V to power on the transmitter and has a turn on time of 10ms. When the transmitter is turned off, the receiver has an internal high pull on the data line. On the receiver side, a high or low value of the data pin is obtained relatively to the power supply (+5V). This is created by using a MAX232 component. The MAX232 component is basically an inverter connected to a Vcc of 5V. By passing it through twice, a level voltage of 5-10V is obtained.

As mentioned before, the transmitter has a delay of about 10ms. During this delay, the transmitter encounters noise during transmission. Therefore, a resistor-capacitor IC (LM555) is used to make sure the LED logic circuit receives both sleep indicator bit and the clock flag signal (RSSI) bit at the same time and the noise is bypassed. The equation governing the delay generated by the LM555 IC is as follows.

T = 1.1 RA C (3.4.1)

In this case, a resistor value of 10kΩ and a capacitor value of 1µF was used to generate a delay of approximately 11ms. This bypasses the noise created during the power up of the transmitter. The output

xiii

Page 14: Sleep Detector

voltage is 2/3 of the Vcc voltage. The timing interval is independent of voltage supply. Application design is obtained courtesy of National Semiconductor.

The output of LM555 goes to the clock flag pin on the D-flipflop in the LED module, and the sleep indicator bit goes to the responding gate inputs on the LED module. A flow diagram of the whole process can be seen from figure C.1 and C.2.

The Linx HP3 series chip uses an FSK transmission scheme to send data over the airwaves. There was a very detailed talk about antenna design and placement given in the Linx documentation. However, for the short distances that we were planning on transmitting (less than 10 ft.) we could use almost any antenna we wanted to. In the end we ended up using an external antenna on the base alarm unit and none on the headset unit. Transmission worked flawlessly.

3.5 LED Awareness Indicator Module

The LED module design was simple to design. By controlling the inputs to the LED, and accurate timing, the whole process can be simplified to a 2 state diagram. We implemented this design by using a combination of 4 gate ICs. The gates used are OR gates, AND gates, NAND gates and D-FlipFlops. The respective chips are 74F08PC quad 2-Input And Gate, SN74LS74AN dual d-type positive-edge-triggered flip-flops with preset and clear, SN74F00 quad 2-input positive-NAND gates, and SN74LS3 Quad 2-input positive-OR gates. The LED used is the HLMP-4000 bi-color LED lamps. It features three leads with a common cathode and comes with a diffused wide visibility lens. A schematic can be seen in figure B.6. The circuit requires only a +5V power supply.

For our design, 3 colors are used to indicate user awareness:Red SleepingYellow Normal/ High awarenessOrange Low awareness

Table 3.5.1 – Colors indicating user awareness. LED has three leads with one as common cathode. Maintaining a high on red and yellow leads creates the color orange.

The logic behind the LED color changes is as follows:Action (Sleep indicator) Previous Color Following Color

High Yellow YellowHigh Orange YellowHigh Red OrangeLow Yellow OrangeLow Orange RedLow Red Red

Table 3.5.2 – Sleep indicator moderation of LED colors based on previous user state

To signify change of LED status, the clock flag signal (which is controlled by the power on of the transmitter) changes to high, then to a low, the positive edge triggered D-flipflops will transmit the new state to its outputs, and thus altering the color of the LED.

Thus, the K-map equation generated is as follows.Red RY’ + A’Y + RA’ Yellow R’ + A

Table 3.5.3 – K-Map equation for Red and Yellow leads of the LED. ‘R’ being the previous pin to the red LED lead and ‘Y’ being the previous pin to the yellow LED lead. ‘A’ is the sleep indicator bit.

xiv

Page 15: Sleep Detector

The LED leads require a voltage of 1.7V to be turned high (and brightness improves as voltage increases) and below 1.7V is considered low (off state). The brightness of the LED generated overall is quite good and very visible.

3.6 Audio Module

The audio Module design uses frequency changes and delays with the generated square waveforms from the PIC to generate sounds of the 0.1KHz to 2KHz range. By manipulating these values, pitch, length of tone and quality of tone can be changed to create simple melodies. The components used in this module include the PIC16F877A, a 5MHz oscillator, and a LM386N low voltage audio power amplifier. The schematics can be seen in figure B.7. in appendix B along with other components.

By generating square waveforms using the PIC, 3 melodies were produced. This included a start up melody which displayed a continuous increase in frequency followed by a continuous decrease, a warning melody which featured various beeps at different frequencies separated by predetermined delays, and a danger siren created by using a looped frequency change comprised of 3 frequencies with no delays.

Frequency (kHz) Time (ms) Delay (us) Delay/2 (us)0.2 5.000 5000.000 2500.0000.3 3.333 3333.333 1666.6670.4 2.500 2500.000 1250.0000.5 2.000 2000.000 1000.0000.6 1.667 1666.667 833.3330.7 1.429 1428.571 714.2860.8 1.250 1250.000 625.0000.9 1.111 1111.111 555.5561 1.000 1000.000 500.0001.1 0.909 909.091 454.5451.2 0.833 833.333 416.6671.3 0.769 769.231 384.6151.4 0.714 714.286 357.1431.5 0.667 666.667 333.3331.6 0.625 625.000 312.5001.7 0.588 588.235 294.1181.8 0.556 555.556 277.7781.9 0.526 526.316 263.1582.0 0.500 500.000 250.000

Table 3.6.1: Translation of frequency into delay which is used to generate waveforms using the PIC

3.7 Power Supply Module

The power supply module uses 2 LM317T and an LM7905 as its primary component. These are TO-220 package linear adjustable voltage regulators. LM317T is connected to two resistors as shown in Figure B.8 in Appendix B. The overall functionality of our power supply design is to regulate voltage from 7V to 12V which can be found in a car to power up our device.

The equation that governs the output voltage in terms of the control resistors and acquiescent current draw is shown in Equation 3.1.1.

Vout = 1.25(1 + R2 / R1) + Iadj(R2) (3.7.1a)

xv

Page 16: Sleep Detector

As seen in Figure B.8, the divider resistor is actually the combination of R1 and R2. This allows us to adjust the output voltage to exactly 5.00 volts above ground. As such, the resistor values of 300 Ω and 900Ω was used.

The power supply took an unregulated 9-volt DC signal from a battery as input. It used this signal to power the voltage regulators that took the voltage from 7 volts to 5.00 volts. Due to this voltage drop across the regulator, the power not sent to the output terminals was dissipated as heat through the regulator. If the voltage to power up these components is marginally higher, heat sinks will have to be attached to the metal pins behind these components to dissipate heat. The application design is obtained courtesy of National Semiconductor.

The LM7905 component circuit is straightforward in design and required little external components as shown in figure B.9. It is packaged in a T0-220 power package. The power supply to the component is a 9V DC signal from a battery flipped in polarity.

The total power supply used by the base alarm unit and the headset unit is about 2W. (Table G.2 in appendix) This translates to roughly about 2 hours running on a 280mAH 9V battery or 10-15 hours running on 4 AAA batteries rated at 2000mAH in the worst case scenario (danger siren on).

4. DESIGN VERIFICATIONxvi

Page 17: Sleep Detector

We went through a series of tests to ensure our device was working properly. Since low awareness and sleep of a user cannot be instantaneously achieved, we needed to find an alternate method of testing our device. We decided the best testing method would be to supply a sinusoidal waveform from a function generator to the input of the EEG circuit. However, the lowest amplitude output of the function generator is 1mV and we required a signal in the range of tens of microvolts to properly simulate brainwaves. To solve this problem, we added an amplifier with a gain of 1/100 to the beginning of the EEG circuit. With the additional amplifier in place, we inputted the function generator output to the EEG circuit, and monitored the amplified output of the EEG circuit on an oscilloscope. We then fed the EEG output into the single processing circuit. Varying the frequency of the function generator signal, we observed the outputs of the buzzer, audio, and LED awareness indicator modules to determine the level of functionality of the device.

4.1 Testing

Each of the modules making up our project were first tested individually to ensure correct functionality. That is, each module was tested to verify design specifications were met. Then, modules were integrated together and the resulting product was tested for functionality. The tests performed on each module are detailed below.

4.1.1 EEG ModuleFeatures tested in the EEG module include the gain and CMRR of the instrumentation amplifiers, frequency responses of filters, and overall functionality of the EEG to acquire brainwave signals.

To examine the actual gain of the circuit, the actual gain of each instrumentation amplifier was determined by taking the ratio of output voltage to input voltage (Eq. 4.1.1.1). Using a 1 mVpp sine wave as an input into the first instrumentation amplifier with theoretical gain of 4941, a 4.93 Vpp sine wave was output (Fig D.1). This results in an actual gain of 4930 which is slightly less than the theoretical value. For the second instrumentation amplifier with theoretical gain of 24.656, a 0.1 Vpp sine wave was input and a 2.75 Vpp sine wave was output (Fig D.2). This results in an actual gain of 27.5 which is slightly higher than the theoretical value. These deviations from the theoretical value could be a result of inconsistencies in the actual resistor values or possible fluctuations in the output of the function generator. At any rate, the actual gain of the entire circuit can be calculated as 135,575, which is still sufficient for its purpose.

(4.1.1.1)

The Common-mode rejection ratio (CMRR) of an instrumentation amplifier measures the tendency of the device to reject input signals common to both input leads [8]. A high CMRR determines the effectiveness of an instrumentation amplifier and is especially important when measuring very small voltage differentials. The CMRR can be calculated by Equation 4.1.1.2.

(4.1.1.2)

Ad=Differential Gain, As=Common-mode Gain

To test this, the inputs are shorted and the output is determines the common-mode gain. The differential gain is the actual gain of each amplifier. For the first amplifier with actual gain of 4930, the common-mode gain was determined as 0.2. Thus, the calculated CMRR was 87.83dB which is a very good value

xvii

Page 18: Sleep Detector

for an amplifier of such a large gain (Eq. 4.1.1.3). For the second amplifier with actual gain of 27.5, the common-mode gain was much less than 0.001. The CMRR is much greater than 200dB which is very good and expected because the gain is much lower (Eq. 4.1.1.4). Thus, the CMRR of the instrumentation amplifiers is above satisfactory.

(4.1.1.3)

(4.1.1.4)

The frequency responses of each filter were compiled by sweeping frequencies from 0 to 100 Hz with 1 Vpp sine waves with steps of 0.1 Hz between each point. These were then compared to the simulation data produced in PSpice.

The simulated and actual frequency responses of the passive high-pass filter with cutoff of 0.34 Hz are shown in Figures D.3 and D.4, respectively. It can be seen that both the simulation and actual data are very similar. The simulated and actual frequency responses of the active 2nd order high-pass filter with cutoff of 2.34 Hz are shown in Figures D.5 and D.6, respectively. It can also be seen that both the simulation and actual data are very similar as well. This testing shows that both types of high-pass filters are working effectively and will successfully cutoff low DC offset noise.

The simulated and actual frequency responses of the active 6th order low-pass filter with cutoff 39.44 Hz are shown in Figures D.7 and D.8, respectively. It can be seen that the actual frequency response of the low-pass filter is much sharper than the simulated response. Because the low-pass filter we used was an IC, it did not exist on PSpice, thus we were not able to do exact simulation. Instead, we built an active 6th order filter in PSpice using operational amplifiers, resistors and capacitors. This is the reason the simulated and actual frequency responses differ, however, the actual response is more desirable. This shows that the low-pass filter is working effectively and will sufficiently cutoff high frequency noise above 39.44 Hz.

Finally, the active low-pass and high-pass filters were connected in series. As expected, both the simulated and actually frequency response attenuate frequencies below 2.34 Hz and above 39.44 Hz (Fig D.9 and D.10). Again, we see that the actual response is much sharper and more desirable than the simulated response.

When everything was finally connected as seen in Figure B.2, the EEG signal was tested. A sample of the EEG output can be seen in Figure D.11. It can be seen that signal is approximately 27 Hz and is 734 mVpp. This is within our desired range and verifies the EEG module is working properly as a whole.

To test the ability of the EEG to detect brainwaves from awake to drowsy to sleeping, the oscilloscope was setup to read for an extended period of time. The time/division was set at 50s/div, giving a total read time of 500 seconds or 8.33 minutes. The scope data was imported into Matlab and the average frequency was calculated every 5 seconds according to how the PIC calculated frequency. In Figure D.12, it can be seen that over the time, as the subject becomes increasingly drowsy, the frequency of brainwaves decreases. Thus, if the EEG were connected to the rest of the modules the alarm would have been turned on and wake the user.

4.1.2 Signal Processing Module

xviii

Page 19: Sleep Detector

The design specifications for the signal processing module dictate that the Transmitter_Power output should be high for all transitions in awareness levels, the Sleep_Indicator output should be high for increases in awareness levels and low for decreases in awareness levels, and that both outputs should be low if no transition occurs. Also, the specifications call for the Buzzer1 and Buzzer0 outputs to be low for all states expect the sleep state, and during the sleep state these outputs should progress from ‘01’ to ‘10’ and finally to ‘11’ (changes separated by 1.5 seconds).

Since the awareness level of the user is based solely on the frequency of the user, varying the input frequency is necessary to test the functionality of the signal processing module. The frequencies of interest, or threshold frequencies, are 8 Hz and 12 Hz. This is the case since a frequency of greater than 12 Hz is indicative of high awareness, between 8 and 12 Hz is indicative of low awareness, and less than 8 Hz is indicative of sleep.

The first test conducted on the signal processing module involved providing a 1Vpp sinusoidal AC signal with zero DC offset directly to the EEG signal input of the PIC. LEDs were placed in series with the resistors connected to the outputs of the PIC. As such, a high output would cause the LED to light up, while a low output would elicit no change in the LED. The frequency of the input signal was slowly decreased from 20 Hz to 1 Hz and the outputs of the PIC were monitored via the LEDs. The PIC performed as expected except for an alternation in awareness state at the threshold frequencies. This alternation was obvious as the Transmitter_Power and Sleep_Indicator output constantly switched from high to low. The results of this test can be seen in Figure D.13. This indecision at threshold frequencies persisted in each of the three algorithms used for the PIC. This persistence suggests that the problem is not code related, but is most likely due to noise within the PIC. This noise may be minimized by using a higher quality microprocessor. However, the alternation in output values, from 13.3 Hz to 11.6 Hz and from 8.3 Hz to 7.2 Hz, is not necessarily a bad occurrence it results in informing the user slightly before the dangerous states of low awareness and sleep are reached. Also, the PIC performance was tested with different input voltage amplitude. The PIC performed in the same manner for input signal voltage amplitudes ranging from 0.5 Vpp to 8 Vpp. This result suggests that the 1 Vpp signal provided by the EEG module is adequate for correct functionality.

The second test involved providing the PIC with the output of the EEG module. In this test, the EEG circuit was provided with 0.001 Vpp AC sinusoidal signal from the function generator. The frequency of the input signal was then decreased slowly and the PIC outputs were monitored via LEDs. The PIC appeared to perform well at higher frequencies, but had some erroroneous outputs at frequencies below 10 Hz. Specifically, the PIC did not send an output reflecting a decrease in awareness until about 5 Hz (instead of 8 Hz). By monitoring the PIC input on the oscilloscope, we found that high frequency noise enters the input at lower frequencies. The difference in the quality of the input between high and low frequencies can be seen in Figures D.17 and D.18, respectively. It appeared that the extra peaks arising from the noise were falling to zero at points resulting in fictitiously high frequency readings. We then increased the amplitude of the input signal to 0.004 Vpp and the extra zero transitions were eliminated. The PIC then performed as the specifications dictate (expect for the alternation in outputs around threshold frequencies discussed above).

4.1.3 Buzzer Module

The design specifications of the buzzer module call for three distinct volume levels and a silent state based on the select inputs from the signal processing module. The functionality of this module was tested in three manners. In the first test, all combinations of select inputs were provided by direct connections to +5V voltage source and/or ground. The buzzer circuit performed as expected with silence for ‘00’ for the select inputs, lowest volume for ‘01’ inputs, medium volume for ‘10’ inputs, and highest volume for ‘11’ inputs. In the next test, the PIC was provided with a 1 Vpp AC sinusoidal input

xix

Page 20: Sleep Detector

with a frequency below 8 Hz. As dictated in the design specifications the buzzer module went through a progression of low, medium, and high volume alarms separated by 1.5 seconds. As expected, the buzzer module continued with the highest volume alarm until the frequency of the input was increased to a value greater than 8 Hz. Finally, the buzzer circuit was tested by providing a .004Vpp AC sinusoidal signal with a frequency below 8 Hz to the EEG circuit. The buzzer circuit performed as expected going through the progression of volumes and remaining at the highest volume until the input frequency was increased to greater than 8 Hz.

4.1.4 Wireless Module

The main concern with testing of the wireless module was the range as well as the correct LED color change. Testing was done in phases to ensure proper integration with the signal processing module and LED awareness indicator module. The oscilloscope was valuable to see the correct voltages and delays were being generated in the RSSI and DATA lines from the receiver. The function generator was used to power up the RSSI in simulating continuous on-off of the transmitter. Frequency was set at 1Hz (1 action per second)

Phase Setup Results1 Wireless Pair on same protoboard sharing power

supply with MAX232 chip connected. Transmitter power line and data line was controlled via DIP switches.

Correct power transmission, noisy data line. Oscilloscope showed expected voltages.

2 Connection with LM555 timer and LED module was added. RC values on LM555 was adjusted until proper delay of 10ms was achieved/

LED changed colors correctly when DIP switches were changed accordingly.

3 Transmitter was transferred to another protoboard. Accuracy and range was tested by having protoboard as far as the laboratory allowed (10-20 feet)

Glitches can sometimes be seen because DIP switches were no debounced. However, overall the results were satisfactory.

Oscilloscope snapshots can be seen of the phases in Appendix D from figure D.19 to D.24

4.1.5 LED Awareness Indicator Module

The LED awareness Indicator Module was easy to test. All we had to do was input the correct change using DIP switches. The circuit was later integrated with the wireless module and the Audio module. Integration was simple and flawless. The hardest part was debugging when some wires came out loose. This was done by carefully following the logic diagram and tracing input and output values. Overall, there was little problem in implementing this module.

4.1.6 Audio Module

The amplifier circuit worked flawlessly from the application notes. Although we tested around with changes in resistor values and other components, not many changes can be discerned from the audio quality from the speaker. Volume was satisfactory. The hardest part of testing the audio module was predicting the output of the waveform generated. This was done by trial and error by reprogramming the PIC multiple times until a satisfied melody was produced.

4.1.7 Power Supply Module

xx

Page 21: Sleep Detector

We tested the power supply module with the EEG circuit. Initial attempts were foiled because the correct DC offset cannot be obtained with our initial design of having 12V, 6V and 0V as the +5, 0 and -5 power supply differential. We decided to change and have a true +5V, ground and -5V produced using two separate power supplies. This worked for our needs. We further tested the regulation of the voltage regulators by increasing the power supply to the voltage regulators. Voltage regulation remained at 5V but the components (LM317T) got very hot. Other components remained in working order. Without the voltage regulators these components would have been completely destroyed especially the PIC due to high current.

Power for each individual component was found by connecting related components to the power supply and reading off the voltage and current values and by using the following equation:

Power = Voltage x Current. (4.1.7.1)

4.2 Conclusions

Overall, the test results of project were very successful. The brainwave signals were sufficiently amplified and filtered to be read correctly by the PIC. The buzzer circuit and base alarm unit also indicated when both thresholds were crossed accurately via buzzers, melodies, and the LED awareness bar. There were some discrepancies with frequencies near the thresholds, however if there is a false positive at the threshold, that can also be advantageous to alert the user he or she is just starting to get drowsy. These discrepancies were due to the lack of ability of the algorithm to deal with noise in the EEG signal. To make our product more marketable, the EEG signal or the algorithm for the PIC could be improved.

5. COST

xxi

Page 22: Sleep Detector

The total cost of our product is based on the price of the parts used and the labor put into constructing the device. A detailed breakdown of the cost related to the parts and labor can be found below.

5.1 Parts

Table F.1 shows the cost associated with each of the parts used in our device. The module in which each part is utilized is also reflected in the table. The price of the parts used in the EEG module sums to $15.77. The cost of the signal processing unit is $8.95. The cheapest module, the buzzer circuit, has a parts cost of only $6.33. The wireless module is by far the most expensive module has a price total of $301.91. The majority of that sizable cost is from the wireless receiver/transmitter which has a price of $300. The prices of the LED awareness indicator module and the audio module are $9.97 and $13.53, respectively. And finally, the total cost of the power supply module is $7.90. There were also miscellaneous costs associated with circuit boards and project enclosures totaling to $33.94. The total cost of all the parts used in our device sums to $399.78.

5.2 Labor

We estimate each member of our group worked on average about 10 hours per week over the 10 weeks spent on the project. This time spent conducting research and designing the device in both individual and group settings. In total, 300 hours of work were completed during the creation of our product. We also project a salary of $30 per hour ($60,000 per year) for each group member. Using the above mentioned estimations, the resulting total cost of labor is $22,500.

Labor Cost = 2.5 x Hourly Salary x Total Working Hours (5.1)

Total Cost = Parts Cost + Labor Cost (5.2)

The total cost of our project is $22,899.78 according to Equation 5.2.

xxii

Page 23: Sleep Detector

6. ETHICAL CONSIDERATIONS

6.1 Design EthicsAs a whole, this device functions in a manner that can greatly benefit society through the

prevention of the injuries, fatalities, and monetary losses that stem from fatigue induced automobile accidents. As such, there are few unethical circumstances that could result from the use of this device. Probably the greatest danger is that this device will instill a sense of overconfidence. That is, people may choose to drive in states of fatigue that they would never have dared to without this device. Although our device is meant to keep people awake, it cannot substitute for the physiological requirement of sleep. Consequentially, users that chose to drive in state of significant fatigue (constantly falling asleep) will put both themselves and other drivers sharing the road with the user at risk. That is, regardless of the volume of the devices’s alarms, a very fatigued user is unlikely to be woken up in the few seconds between the start of sleep and when a crash occurs. Also, our product, like all other technology, will inevitably fail at some point due to either user error or device malfunction. And since our product serves as a safety device, failure will put the trusting user in serious danger.

xxiii

Page 24: Sleep Detector

7. CONCLUSIONS

Overall, the project was a success and all of the objectives stated in the design review were met. Specific goals achieved were a clean, single channel EEG using minimal circuitry to keep the device portable, algorithms adapted specifically for EEG frequency detection, a sequence of buzzers to awake the user, wireless communication to a wireless base alarm unit with LED awareness bar, and melody production. We were also able to make the device completely portable, operating only on battery power.

In addition the success of our project, there are areas that can be improved upon to improve the overall quality of the product. As expected, the EEG signal was greatly subject to noise due to DC offsets and high frequency noise. More filtering at different places in the EEG circuit could have improved this; however, the drawbacks include more space needed on the circuit board as well as greater power drain. Another alteration that may have been able to aid in this problem is adding more electrodes. Most EEGs have multiple channels with electrodes placed all around the head. This could have led to a sharper EEG; however, this would add complexity to circuit and be much more of an annoyance to the user. Overall, we are happy with the success of the EEG module allowing for a very convenient design.

Another challenge faced was the issue of the PIC alternating awareness levels at the measurement threshold. This was an issue with both the EEG and function generator connected. Sources of this problem could have been anomalies in the algorithm or noise in the received signal. These problems could be possibly alleviated by improving the algorithm or be improving the signal conditioning in the circuit. However, this is not that bad of a problem because if the user is approaching the threshold, he or she should be aware of this.

We would have also liked to have translated the entire project onto PCBs, however we did not for a few reasons. The main reason was the issue of making the device portable. It was presumed that the ways the signal was conditioned in the EEG may need to change when hooked up the battery, which was true. This would have been extremely difficult to adjust resistor and capacitor values when they need to be soldered.

Our cost was relatively high; however, this could be very easily reduced. The majority of the cost of our project was the 300 dollar wireless transmitter and receiver. For our wireless transmission, all we require is the transmission of one bit. Because of this, we could use a much more affordable wireless module, thus reducing the expense of the device.

Another issue that could be easily improved upon was the battery life. Currently our device is using 9 V batteries to power both circuits which would provide for about 2 hours for both units. This may not be long enough for an entire long drive. This could easily be improved upon by using four 1.5 V batteries in series instead of a 9 V. Also, because our circuit uses voltage regulators, it can handle any combination of batteries so long as the voltage is above 5 V.

The project proved that designing an EEG sleep detector is feasible and within the realm of possibility of production. With improvement in a few certain areas, the marketability of the product can be increased significantly. This product could be very beneficial to society and we are very pleased to have achieved all of our objectives in the design process.

xxiv

Page 25: Sleep Detector

REFERENCES

[1] NYS Department of Motor Vehicles Traffic Safety Committee, “Drowsy Driving and Fatigue,” July 2006, http://www.nysgtsc.state.ny.us/drow-ndx.htm.

[2] Robert D. Ogilvie and John R. Harsh, Sleep Onset. New York: American Psychological Association, 1994.

[3] Mitsuaki Yamamoto, Night—day—night Sleep—Wakefulness Monitoring by Ambulatory Integrated Circuit Memories. Boston: Psychiatry and Clinical Neurosciences, 1999.

[4] Sleep Computing Committee of the Japanese Society of Sleep Research Society (JSSR), “Proposed supplements and amendments to ‘A Manual of Standardized Terminology, Techniques and Scoring System for Sleep Stages of Human Subjects’, the Rechtschaffen & Kales (1968) standard”, Psychiatry and Clinical Neurosciences (2001), 55, 305–310.

[5] E. Huupponen I et. Al., “Automatic analysis of electro-encephalogram sleep spindle frequency throughout the night”, Med. Biol. Eng. Comput., 2003, 41,727-732.

[6] Webster, John G. Bioinstrumentation. Hoboken, NJ: John Wiley & Sons, Inc. 1994.

[7] “Instrumentation Amplifier”. National Semiconductor: Linear Brief. March 1969, http://www.national.com/ms/LB/LB-1.pdf.

[8] eCircuit Center, “Common-Mode Rejection (CMR)”. January 2006, http://www.ecircuitcenter.com/OpModels/CMR/Op3_CMR.htm.

xxv