












Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Project; Class: Senior Design Project Lab; Subject: Electrical and Computer Engr; University: University of Illinois - Urbana-Champaign; Term: Fall 2006;
Typology: Study Guides, Projects, Research
1 / 20
This page cannot be seen from the preview
Don't miss anything!
Developers: Benjamin Schneider David Mahr Kuang Tan ECE 445 Senior Design Laboratory Professor Makela T.A. Hyesun Park September 25, 2006
Purpose: We intend 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. We chose this project because a device that could prevent the many injuries, fatalities, and monetary losses associated with these automobile accidents would be very beneficial to the welfare of our society. Objectives: 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). Our goal is to develop a device that will recognize the shift from wakefulness to sleep, via proper signal processing of the EEG output, and then relay that information wirelessly to an alarm system. The alarm system will display the awareness level of the user and alert the user that he/she is near to or has falling asleep. Our device, therefore, will consist mainly of an EEG, signal processing equipment, wireless linking system, and an alarm system. Benefits: ï· Driving Related Applications o Elimination of fatigue/drowsiness related car accidents ï§ 1,500 less highway fatalities per year ï§ 71,000 less motor-vehicle related injuries per year ï§ $12.5 billion saved per year o Provide late night drivers with a sense of safety ï· Medical/Everyday Applications o Keep hospital patients with concussions awake o Avoid nodding off at work o Stay awake in class Product Features: ï· Housing of EEG and signal processing components in a headset ï· Lightweight and comfortable ï· Wireless relay from headset to alarm system ï· Alarm that increases in volume until person is awake ï· LED strip showing the userâs level of awareness ï· Log of instances of sleep or near sleep (severe drowsiness) ï· Earpiece, vibration, and music alarm options
Figure 4 â Wireless Circuit Figure 5 â Buzzer Circuit T i t l e S i z e D o c u m e n t N u m b e r R e v D a t e : S h e e t o f W i r e l e s s R e c e i v e r T r a n s m i t t e r < R e v C o d e > K u a n g H a u T a n A S u n d a y , S e p t e m b e r 2 4 , 2 0 0 6 1 1 T o L E D c i r c u i t ( A )^1 G N D 2 A N T 3 C S O 4 C S S 1 / S S C L O C K 5 C S 2 / S S D A T A 6 C T S 7 P D N 8 V C C 9 M O D E 1 0 D A T A T X M - 9 0 0 - H P 3 - P P S S w i t c h V C C 5 V T o P I C T o P I C 6 G N D 5 G N D 4 G N D 3 G N D 2 G N D 1 A N T 1 4 1 3^ R S S I P D N 1 2 C S 2 / S S D A T A 1 1 C S 1 / S S C L O C K 1 0 8 G N D 9 N / C^ C S O 7 G N D 1 6 V C C 1 5 M O D E 1 8 D A T A 1 7 A U D I O R X M - 9 0 0 - H P 3 - P P S S w i t c h V C C 5 V T o L E D c i r c u i t
Figure 6 â Awareness LED Circuit 4 3 2 1 1 2 1 1 1 0 9 (^78) 6 5 7 4 A C T 1 1 0 7 4 1 4 1 3 2 3 (^4) 1 3 1 4 1 1 1 1 2 6 (^7) 1 0 1 6 7 4 A C 1 1 0 0 8 5 9 1 5 2 8 (^4) 1 3 3 1 1 4 6 1 2 1 1 1 6 (^7) 1 0 5 7 4 A C 1 1 0 3 2 8 1 5 9 1 3 2 3 4 6 1 4 (^1) 1 6 1 1 1 2 (^7) 1 0 8 7 4 A C 1 1 0 0 0 5 9 1 5 V^ C^ C^ _^ B^ A^ R V C C _ B A R V C C _ B A R V C C _ B A R T o R S S I G i n p u t o n L E D R i n p u t o n L E D C o n n e c t e d t o s w i t c h i n p u t f r o m r e c e i v e r d a t a p i n
couplings. This serves as two passive filters, one high pass and the other low pass with cutoff frequencies: RC f 2 ï° 1 ïœ The high pass filter has a cutoff of .34 Hz and the low pass filter has a cutoff of 48.23 Hz. The purposes of these filters are to reduce DC offset as well as noise related to specifically to power lines. This is acceptable because the frequencies we are concerned with are from 4 Hz to 30 Hz. Next, the outputs of the filters are connected to an op-amp with unity gain. This is known as a buffer circuit. The main purpose of the buffer circuit is to reduce drift current which could affect the output of the EEG. These outputs are then connected to an instrumentation amplifier. In the schematics we show how an instrumentation amplifier is constructed out of op-amps and resistors. We chose to use an instrumentation amplifier instead of building one ourselves from op-amps because they are manufactured with the purpose for EKG/EEG use. Building one ourselves would cause a much poorer instrumentation amplifier because the resistance of resistors vary by a small percentage as to what they are labeled as and can cause problems with noise. We chose to use the AD8221 manufactured by Analog Devices. The AD8221 is a high performance instrumentation amplifier, with a high CMRR, and a differential gain of up to 1000. Because the signal generated at the electrodes is on the order of 100uV, we plan to use two instrumentation amplifiers in series to produce a gain of 10,000. The equation for gain in the instrumentation amplifier is: Rg= 49.5kΩ G - 1 In both amplifiers, we desire a gain of 100. Therefore we simply connect a 495 resistance across the Rg pins (pins 2 and 3). These are connected in series resulting in a gain of 10,000. (G1 x G2 = 100x100 = 10,000) The output of the instrumentation amplifier is then sent to a 4th^ order butterworth low pass filter. This is an active filter built using op-amps and will have much better defined cut-offs than the two passive filters before the amplifier. The cutoff of the 4th^ order filter is set to 40 Hz. This is used to further reduce the noise one last time before the signal is sent to the PIC for signal processing. Signal Processing Module: A PIC16F877A exists as the main component of the signal processing portion of the device. The output of the EEG circuit exists as the only input signal to the PIC. This signal is filtered and amplified by the EEG circuit to limit the frequency content to frequencies less than 40 Hz and the voltage to between 0 and +5V. This analog input signal is converted to a digital signal via the PICâs internal ADC. The sampling rate of
this analog to digital conversion must be at least 80 samples/second (according the the Nyquist Theorem). The minimum sampling frequency of the PIC (1.25MHz) will be more than adequate for our application. The PIC will be programmed to find the frequency of the signal. This frequency will be deduced by measuring the number of zero crossings over a set time interval according to the equation: Number of Zero Crossings Frequency = 2 * Time Interval Due to drift in the EEG signal, the âzero crossingâ will not occur at 0V, but rather some unpredictable DC offset. To find that offset, the signal will be averaged. The frequency will be calculated by counting the number of times that calculated average value is crossed. Only the frequency digitized over the first half second will be analyzed (making the denominator equal to one) since division in binary can be problematic (rounding errors, etc.). This limiting of the time interval to half a second will also serve to speed up the recognition by the device of the state of the user. The PIC will also be programmed to classify the frequency of the EEG as being indicative of the user being highly alert (9 â 40 Hz), drowsy/low alertness (5 â 8 Hz), or sleeping (1.5 â 4 Hz). The user will be assumed to be in a high state of alertness initially (physiologically necessary to connect the device). The PIC will output a â0â for the âsleep indicatorâ and the âtransmitter powerâ outputs as long as the frequency of the EEG remains over 9 Hz (user still highly alert). If the frequency drops under 9 Hz, the PIC will change the âsleep indicatorâ and âtransmitter powerâ outputs to â1â (showing transition in alertness). If the frequency remains between 5 â 9 Hz, the âsleep indicatorâ and âtransmitter powerâ outputs will remain low. If the frequency increases above 9 Hz (increase in alertness), the âsleep indicatorâ and âtransmitter powerâ outputs will be high. If the frequency falls below 5 Hz (falling asleep), the âsleep indicatorâ output will be low and âtransmitter powerâ output will be high. As long as the frequency is below 5 Hz, the âsleep indicatorâ and âtransmitter powerâ outputs will be low. If the frequency increases beyond 5 Hz, âsleep indicatorâ and âtransmitter powerâ outputs will be high. Depending on the ensuing frequency (5 â 9 Hz, or >9Hz), the âsleep indicatorâ and âtransmitter powerâ outputs will behave as described above. The PIC will output â00â for the buzzer outputs as long as the frequency of the EEG signal is greater than 5 Hz. If the frequency drops below 5 Hz, the PIC will output â01â for the buzzer outputs. If the frequency of the EEG signal does not increase to a value greater than 5 Hz in 2 seconds, the buzzer output will change to â10â. Similarly, if the frequency does not increase to a value greater than 5 Hz in another 2 seconds, the buzzer output will change to â11â. At this point, the buzzer output will remain â11â until the EEG signal increases in frequency to a value greater than 5 Hz. If the frequency increases beyond 5 Hz at any point while the buzzer output is â01â, â10â, or â11â the output will change to â00â until the frequency drops below 5 Hz. The value of the resistors (220Ω) connected to the input/output pins was calculated based) connected to the input/output pins was calculated based on the maximum amount of current these pins could sink/source (as shown below).
Table 1: Pin designation for part TXM-900-HP3-PPS Pin# Name Description Equivalent Circuit 1 GND Analog Ground 2 ANT 50 â ohm RF input 3 CS0 Channel select 0 4 CS1 / SS CLOCK Channel Select 1/ Serial Select Clock. Channel select 1 when in parallel channel selection mode, clock input for serial channel selection mode. 5 CS2 / SS DATA Channel select 1/ Serial Select Data. Channel select 2 when in parallel channel selection mode, data input for serial channel selection mode. 6 CTS Clear-To-Send. This line will go high when the transmitter is ready to receive data. 7 PDN Power Down. Pulling this line low will place the receiver into a low- current state. The module will not be able to receive a signal in this state. 8 VCC Supply voltage (2.8V â 13V) 9 MODE Mode Select. GND for parallel channel selection, VCC for serial channel selection 10 DATA Digital / Analog Data input. This line will output the demodulated digital data Table 2: Pin designation for part RXM-900-HP3-PPS PIN
Name Description Equivalent Circuit 1 ANT 50 â ohm RF input 2-8 GND Analog Ground
9 NC No connection 10 CS0 Channel select 0 11 CS1 / SS CLOCK Channel Select 1/ Serial Select Clock. Channel select 1 when in parallel channel selection mode, clock input for serial channel selection mode. 12 CS2 / SS DATA Channel select 1/ Serial Select Data. Channel select 2 when in parallel channel selection mode, data input for serial channel selection mode. 13 PDN Power Down. Pulling this line low will place the receiver into a low- current state. The module will not be able to receive a signal in this state. 14 RSSI Received Signal Strength Indicator. This line will supply an analog voltage that is proportional to the strength of the received signal. 15 MODE Mode Select. GND for parallel channel selection, VCC for serial channel selection 16 VCC Supply voltage (2.8V â 13V) 17 AUDIO Recovered Analog Output (1 Vpp Analog Output) 18 DATA Digital Data Output. This line will output the demodulated digital data. Buzzer Module: The buzzer circuit will receive two inputs from the PIC. These inputs will be used as the select bits on a 4:1 multiplexer. The piezo-buzzer emits the loudest sound at its maximum current level (10mA for 12V). The intensity of the sound emitted decreases with decreasing current. Depending on the value of the select bits, the buzzer will be supplied with either 10 mA, 7.3 mA, 5.8 mA, or 0, as calculated below.
1 1 0 0 1 Yellow/down Red 1 1 1 1 0 Yellow/up Green 0 1 0 0 1 Red/down Red 0 1 1 1 1 Red/up Yellow G = Rbar + A R = RGbar + Abar (R+G) Green LED kmap A/GR 00 01 11 10 0 1 0 0 1 1 1 1 1 1 Red LED kmap A/GR 00 01 11 10 0 0 1 1 1 1 0 1 0 0
The post-processed EEG signal after being filtered and amplified needs to have a range of 0 to 5 V for the PIC to be able to analyze the signal and have frequencies between 1 Hz to 40 Hz to detect alertness thresholds properly. The PIC will have to be able to detect the frequency within .1 Hz of its actual value. RSSI signal has to be at least 3.85 V for the LED circuit to function. When the âsleep indicatorâ bit is sent via the wireless module, the communication must have a range of at least 6 ft. In addition, for the sleep detector to work properly, the alarm must go off less than 1 second after the subject falls asleep.
EEG Module: ï· Assess the gain of the instrumentation amplifier using function generator and oscilloscope. The theoretical gain will then be compared with the actual gain. Adjustments may need to be made accordingly. in out V
ï· Adjust gain of amplifier accordingly to keep signal between 0-5 V for signal processing. Test using oscilloscope.
ï· Assess the effectiveness of both the passive and active filters. DC offset and high frequency noise should be sufficiently reduced. We should try to low pass filter with a cut-off frequency as low as possible (just above the highest frequency we care about). Wireless Module: ï· Transmitter: By moving the transmitter away from the receiver, signal strength is recorded using an oscilloscope on the receiving end (plugged into the RSSI pin), a graph is plotted out to show the distance traveled vs. the strength of signal/loss of signal. ï· Modulation of signal: By using the oscilloscope, the signal can be checked to see if the transmitted/received signal is the desired voltage and sequence. Signal Processing Module: ï· A function generator will be used to simulate input waveforms that may be seen by the PIC (i.e. waveforms with frequency less than 40 Hz). The outputs of the PIC will be monitored on an oscilloscope. The frequency of the waveform will be slowly decreased (simulating a person steadily falling asleep) and the correctness of the resulting outputs will be evaluated. That is, the consistency of a high or low value (over frequency ranges that the outputs should be constant), and the rate of transition (when frequency crosses alertness threshold) of the âsleep indicatorâ output will be studied. ï· The timing of the buzzer outputs (switching every 2 seconds while frequency remains under 5 Hz will be checked by inputting a waveform with a frequency less than 5 Hz for an extended period of time. Also, the rate of transition to â00â from â01â, â10â, and â11â will be analyzed by quickly increasing the frequency of input waveform from less than 5 Hz greater than 5 Hz (simulating a person suddenly waking up). ï· The amplitude of the generated waveform will correspond to possible outputs of the amplifying EEG circuit. ï· The division involved in averaging the signal (to find the dc offset) may cause a certain amount of error due to the rounding involved in binary division. The extent this error will have to be evaluated by providing a waveform input with a frequency very near one of the alertness transition points (5 Hz or 9 Hz) and monitoring the outputs. The maximum difference between the desired transition point and the actual point in which outputs transition will provide the extent of this error.
Differential Amplifier Simulation: Gain= - Input: Sinusoid, Amplitude 100uV, Frequency 8Hz Output: Sinusoid, Amplitude 1 V, Frequency 8Hz
Filtered Simulations: Input: Frequency Sweep from 0 to 100 Hz, Amplitude 100uV
Part Number Manufacturer Description For Status Price Qty Total N/A N/A Ag/AgCl Electrodes EEG Obtained $0.19 3 $0. AD8221 AD Instrumentation Amplifier EEG In Transit
AD8698 AD Op-Amp EEG In Transit
Circuit Transit 74ACT11074 TI D-type Flip- Flop
Circuit Obtained $1.30 1 $1. 74ACT11032 TI Quadruple 2- Input Positive OR Gate
Circuit Obtained $1.30 1 $1. 74ACT11000 TI Quadruple 2- Input Positive NAND Gate
Circuit Obtained $1.30 1 $1. 74ACT11008 TI Quadruple 2- Input Positive AND Gate
Circuit Obtained $1.30 1 $1. Total $340. ***** Parts obtained from ECE Parts Shop ~ Price unknown Labor: Dream Salary of $60,000 or $30/hour ($30/hour)(3 people)2.5(10 hours/week)(10 weeks) = $22, Total: $22, 840
Ben David Kuang 9/25 â 10/1 Evaluation of necessary code Complete Design Review Build wireless circuit 10/2 â 10/8 Create simple PIC program Build EEG Circuit Build LED circuit 10/9 â 10/15 Build/Test signal processing circuit Troubleshoot EEG Circuit Interface with LED circuit 10/16 â 10/22 Building Buzzer circuit Interfacing EEG with signal processing circuit Interface wireless with signal processing circuit 10/23 â 10/29 Interface signal processing circuit with buzzer circuit Order spare parts/ Work where needed Learn Easytrax 10/30 â 11/5 Complete integration of modules Complete integration of modules Mock-up Demo preparation 11/6 â 11/12 Testing/Debugging Testing/Debugging Testing/Debugging 11/13 â 11/19 Testing/Debugging Testing/Debugging PCB Board Development 11/20 â 11/26 Give Thanks (Work as necessary) Give Thanks (Work as necessary) Give Thanks (Work as necessary)
11/27 â 12/3 Prepare for Demo Work as necessary Work as necessary 12/4 â 12/10 Complete Signal Processing/Buzzer portion of Final Paper Complete EEG portion of Final Paper Complete wireless/LED portion of Final Paper
As 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), and thus frequency call on our device to wake them up, will inevitably be the victim of device error. That is, all technology fails at some point, whether due to user error or device malfunction, and the failure of our device can have drastic consequences to both the user and innocent bystanders sharing the road with the user.