SUR-SUR
Non-Intrusive Detection system for Sleeping Student at School
Sistema de detección no intrusivo para estudiantes dormidos en la escuela
Non-Intrusive Detection system for Sleeping Student at School
RELIGACIÓN. Revista de Ciencias Sociales y Humanidades, vol. 4, núm. 15, Esp., pp. 251-260, 2019
Centro de Investigaciones en Ciencias Sociales y Humanidades
Recepción: 18 Enero 2019
Aprobación: 02 Mayo 2019
Abstract: The role of poverty rate, medical diagnoses, napping and medication on sleep habits contribute to the academic performance of the children. The problem of sleeping students in the classroom is an underestimated problem in Malaysia. The goal of our project was to produce a non-intrusive, portable and easy to use solution to detect whether or not a person was falling asleep while in the classroom. The methods used in our system were sensors to detect whether or not the eye was open or closed and sensors to detect whether or not the head was dipped below a certain angle. This data was transmitted wirelessly where a microcontroller was used to determine whether or not to activate our alarm system. Our project was developed in C code and testing and verification were performed to validate the accuracy of the sensors and alarm decision system.
Keywords: Teaching Practice, Clinical Supervision Assessment.
Resumen: El papel de la tasa de pobreza, los diagnósticos médicos, la siesta y la medicación en los hábitos de sueño contribuyen al rendimiento académico de los niños. El problema de dormir a los estudiantes en el aula es un problema subestimado en Malasia. El objetivo de nuestro proyecto era producir una solución no intrusiva, portátil y fácil de usar para detectar si una persona se estaba quedando dormida o no mientras estaba en el aula. Los métodos utilizados en nuestro sistema eran sensores para detectar si el ojo estaba abierto o cerrado y sensores para detectar si la cabeza estaba o no por debajo de cierto ángulo. Estos datos se transmitieron de forma inalámbrica donde se utilizó un microcontrolador para determinar si activar o no nuestro sistema de alarma. Nuestro proyecto se desarrolló en código C y se realizaron pruebas y verificaciones para validar la precisión de los sensores y el sistema de decisión de alarmas.
Palabras clave: Práctica docente, Evaluación de la supervisión clínica.
Introduction
A student is a learner, or someone who attends an educational institution. To have a bright future and a good career it is really necessary for a student to maintain a good academic performance. (Acebo Wolfson & Carskadon 1997) Investigation in the field of sleep problems among the student is a nearly new field. There is even limited research when it comes to exploring the effect of sleep problems and the impact it has on academic achievement (Buckhalt, El-Sheikh, & Keller 2007). But now a days, it is seen that there are so many problems faced by them which are affecting their mental & physical health which in turn affecting their academic performance adversely. Sleep is a necessary component of student and young growth. Bad or lacking sleep can have a dramatically negative influence on a student everyday activity, especially during a school hour. Side impacts may comprise drowsiness, off-task behavior and a disability to focus
The excessive use of mobile, social networking sites effect youngster irregular sleeping patterns. Due to such problems students are facing heavy drowsiness during class hour.These applications also can be applied to the manufacturing industry where workers must stay awake during critical late night hours while operating heavy and dangerous machinery. Additionally, situations where a user must stay awake such as late night security shifts could also benefit from such a system. Because our system is portable and low cost, this can become a viable end user product which can be sold to throughout the world
The purpose of this project is to provide a portable system to detect drowsy driving. The use of IR LED’s at 900 nm and an appropriate IR sensor was used to determine if the eye was closed or not. The basic idea here is that there would be a different reflection between a closed and open eye. The output of this sensor was digital which did not provide the greatest flexibility.
The other part of the drowsy student detection system was the use of mercury tilt switches. Essentially, the circuit would be closed at a level angle and open at a certain angle. We used three of these tilt switches with the use of a three-input NOR gate to provide greater flexibility in the use of the tilt switches. The sensing circuit was mounted on a pair of glasses along with a 9 V battery and LINX Transmitter so that the unit was autonomous.
These two signals were sent wirelessly into a PIC microcontroller which used prior history of the student behavior to determine whether or not to activate the alarm system. For the alarm system, three alarms were used with the purpose of providing differing levels of warning. The alarms used were a vibrator, a buzzer and a light. The alarm circuit was controlled by the 5V input from the PIC which was then amplified to provide enough power to activate the alarms through the use of transistors. The entire station was built on a circuit board with a 12V source from a battery power bank.
Design Background
The development was divided into three main components which were handled individually and then collaboratively once they were integrated. The first part was to design and verify the eye sensor. This involved choosing the correct wavelength for the eye sensor and the choice of whether or not to use a digital or analog circuit (Ozdemir, Boysan, Selvi, Yildirim, & Yilmaz 2015). In addition to the sensors, this subproject also involved determining how to effectively send four signals wirelessly to the PIC microcontroller [9].
The second part of the project was the software algorithm design on the PIC microcontroller. This involved designing a smart algorithm to not only determine the time needed to trigger alarms but also a way to incorporate prior history into reducing or increasing time thresholds. This subproject also involved providing an easy to use interface for the end user and extensive testing and verification to ensure that the alarms were being triggered correctly according to actions of the user.
The third part was the alarm system. This involved the choice of the three alarms which was a vibrator rated at 3V, a buzzer rated at 6V and lamps which were rated at 12V. The design challenge here was to create a switching circuit which could use the 5V input from the PIC in the second subproject. Other considerations in this subproject included the values of resistors to use to limit the current and testing and evaluation to ensure that the components would run effectively while remaining safe for the end user.
The following is a block diagram showing the overall functionality of the system:
Overall, the system we have designed would take in data via glasses on whether or not the eyes were closed or not. This data is then sent wirelessly to a PIC microcontroller where it controls our three alarms. The three alarms are:
Vibrator: Discreet alarm, first alarm user feels.
Buzzer: Audio alarm if the user does not respond to initial alarm.
Light: To notify users in the car and other cars in the area that the driver is asleep.
Eye Sensor
The eye sensor consists of the IS489 light detector and the LN175 light emitting diode. Light from the diode is emitted at a wide angle of 120 degrees and will shine on the eye and surrounding skin and be reflected back to the sensor. The sensor outputs a logic high equal to Vcc (5volts in our circuit) when the sensor does not detect light and logic low (0 volts) when it does. When the eye is open the light reflection from the diode is insufficient to be detected by the sensor and it outputs logic high. When the eye is closed, muscles pull the skin from the eyelid closer to the sensor causing the reflection to increase and the light detector to output logic low.
Power Considerations
The IR LED has a maximum forward current of 100mA and a maximum forward voltage of 1.7V. The diode is supplied with 5V and a resistor size must be chosen to satisfy:
If = 3.3/R < 100mA
Therefore the minimum value for R is 33 ohms. At our chosen value of 500 ohms the diode and resistor consume 33mW. The light detector power consumption is several orders of magnitude less than this and therefore negligible.
Safety
ANSI standards specify a maximum exposure limit to IR light as 610uW/cm2 (Acebo Wolfson & Carskadon 1997). The LED used in this device has a radiant intensity of 7mW and an aperture of 5mm2. At this intensity, the safe distance can be calculated as:
Our design has the LED placed within 3mm of the eye so it would appear as if this is unsafe according to ANSI permissible exposure. However, this exposure occurs at an angle of 90 degrees to the front of the eye because the LED is placed at the side of the head. Under these conditions, the eye cannot focus directly on the light emitted from the diode which should reduce the actual exposure intensity. Also the radian intensity stated in the data sheet for this device is for maximum current of 100mA. Under typical conditions for our device the current will only be about 7% of this. Light output should be directly proportional to current, thus the actual intensity used in this project is less than stated in the data sheet. Before this project is marketed a more thorough investigation of actual light affecting the eyes and if it exceeds allowable exposure must be performed.
Tilt Sensor
The tilt sensor consists of Durakool TO8 series mercury tilt switch. The contacts in the switch are closed at a range of 0 degrees to 35 degrees after which the contacts are open. The sensor will give us an indication of a person’s head nodding forward which is a good indication of fatigue. The switch works in all directions, therefore, to have better control of the angle at which the switch is open three were used, each offset from the other slightly to provide greater design flexibility for what head angles activate the sensor. When the switches are closed, a logic high signal is passed to the next component of the circuit but when it is open pull-down resistors are used to bring the level down to logic low.
Data Transmission/Receiver
Data Transmission is achieved with the use of Linx HP3 series wireless transmitter and receiver. The wireless transmitter transmits the data from the sensors to the receiver at 903.37 MHz at a maximum distance of 100 feet which far exceed the needs of this design. The transmitter and receiver only transmit data on one channel at a time therefore an encoder/decoder pair is used to convert the data from the sensors to a serial stream for transmission and reception. The encoder and decoder require the use of a resistor-capacitor circuit to determine the frequency of the serial stream. The values of the capacitors and resistors are determined by equations given in the data sheet for these devices. The three RC components needed for the encoder are RTC, RS, and CTC. The value of RTC must be greater than or equal to 10k ohms and RS must be twice this amount. 10k and 20k ohms were chosen for RTC and RS respectively. CTC must have a value between 400 pF and 15uF. The value used in this design is 0.01uF. The choice of these components determines the frequency of the serial stream according to:
With the choices of the components the frequency is about 4.35 kHz. The transmitter accepts data modulated at a frequency anywhere between 100 Hz and 28,000 Hz so this choice of components is acceptable.
The decoder must have its RC components chosen to properly decode the information sent from the encoder. The components used in the decoder are R1, C1, R2, and C2. R1 and C1 are chosen according to:
R1C1 = 3.95RTCCTC
Thus, the values chosen for R1 and C1 are 39,500 ohms and 0.01uF respectively. The values of R2 and C2 must be chosen according to:
R2C2 = 77 RTCCTC
Thus the values chosen for R2 and C2 are 820k and 0.01uF respectively. The circuit for the transmitter/encoder is shown in figure 2.3 and the circuit for the receiver/decoder is shown in figure 2.4. An inverter is used on the output of the decoder corresponding to the eye sensor so a high signal will indicate a closed eye. The three signals from the tilt sensors are all inputs to a logical NOR gate so that the signal will only be high when all signals from the sensors are low. This is the actual indication of whether or not the head is tilted and the signal then goes to the microcontroller.
Power Considerations
The transmitter consumes 17mA at 5volts making its total power dissipation 85mW. The Receiver consumes 35mA at 5 volts making its total power dissipation 175mW. The encoder and decoder draw negligible power compared to this.
The sensor components are powered by a 9v alkaline battery. The battery voltage is regulated to 5v by the MC7805CT voltage regulator. This battery must source 33mW for the LED and 85mW for the transmitter giving a total of 118mW. The 9-volt Energizer Industrial battery is capable of providing this for 15-25 hours.
PIC Microcontroller
The microcontroller, the PIC16F877A, will be used to collect the data received from the sensors via the wireless communications. As described in the wireless communication section, the data will be transmitted via two wireless links which will feed into two inputs of the PIC microcontroller. The nature of the data will be a logical high or low denoting whether or not the eye is closed or open or whether or not the head is tilted past a certain angle.
Software Design Flowchart and Explanation
The software algorithm can be split up into three main components shown below
In this part the software, the user has the ability to adjust the sensors and glasses before running into the main data collection code. Once this is done, the system will then set the danger level and begin data collection. The event log variable is checked to ensure that it has not gone over 200 which ensure that each danger level has the same window of length.
In the data collection program, the following variables are modified which are then sent into the alarm activation and eye closure rate
portion of the program:
Essentially the system trying to see if the eye blinking rate has changed. The reason is that is the user begins to blink rapidly, this could indicate they are falling asleep because their eyes are very dry. If they starting to blink slowly, then this could indicate slowed reaction time and heavy eyes which could mean they are falling asleep. The type of alarm is a short 1 second pulsed alarm which will give the user an early warning and possibly forces them to pull over to get some rest. The methodology for this portion of the software is that the rate of blinks per 10 seconds is measured throughout the operation of the system. This value is stored into the variable rate_total. The other variable, rate_1 is the blink rate for the most recent 10 second time period. This is compared to the value of rate_total and if the difference between the two is greater than 1.5x, then the alarm will be triggered. Otherwise, nothing will happen and the alarm activation sequence will commence.
Eye Sensor Testing Procedures, Results and Analysis
Testing of the eye sensors consisted of varying several parameters and recording their effect on the distance at which the sensor detects objects. These consist of sensor placement, light output from LED (adjusted with potentiometer), different reflective surfaces, and varying lighting conditions.
The test show sensitivity is affected by the distance between the IR LED and light detector. The results of this test are shown in figure 5. The closer the diode and light detector are to each other, the further away they detect objects. If the two are placed too close together (less than three millimeters, the light detector will always output low because it directly receives IR light from the diode since the diode has a wide degree of emission.
The next test is testing the relationship between sensitivity and the resistance in series with the diode (light output). The results are shown in figure 6. The more light the diode outputs, the greater the distance objects will be sensed. After experimenting with how the sensor reacts to the eyes and eyelids we found that the sensors must be within 5 mm to effectively detect blinking. For this reason we placed the diode and light detector 3 mm apart to increase sensitivity and then used 500 ohms for the resistor value to decrease sensitivity and save power, an added benefit.
The green line is reflection sensitivity used with a highly reflective silver object. The sensitivity is much higher with this object and this test was performed since it was originally thought that the eye is more reflective than the eyelid but we found that this is not the case. Other tests performed with varying skin color showed negligible sensitivity differences. Finally tests were performed to find a site to place the sensors relative to the eye. The best results come from the sensors being placed directly in front of the eye but this is undesirable because it severely reduces vision. After experimenting with locations above, below, inner corner, and outer corner it was decided the best location is the outside corner since the muscles in the outside corner of the eye push skin sufficiently close to the sensor to cause a response, and because it only slightly blocks peripheral vision.
Software Algorithm Testing Procedures
A variety of tests were performed to test the software algorithm’s performance and accuracy. The following table below shows the specific tests and purpose.
The eye and head tilt test were run under one test because the same software algorithm was being used for both the eye and head. Thus, the times should be identical. Running the test for both the eye and head on together is only done to illustrate how the times for alarms to activate decrease in half.
Software Algorithm Testing Results and Analysis
The tests were conducted using a stop watch and the results and analysis are shown below:
First Alarm Trigger Times (Vibrator)
Second Alarm Trigger Times (Buzzer)
Third Alarm Trigger Times (Light)
Overall, the results indicate that our software algorithm does decrease the time thresholds when going from a lower danger level to a higher danger level. The differences in time can be attributed a lot to our use of the stopwatch where an error can cause a difference in almost a second. Another result which we expected was that when both the head was down and the eye was closed, the times were decreased in half which is what we would want to happen in a real life situation.
Danger Level Tests
The eye blinking appears to need more blinks to trigger the next danger level due to the quickness of an eye blink. This relative quickness compared to the nodding of a head gives more time for the head counter to increment requiring less nodding than blinking to trigger the next danger level.
These results were fairly consistent because no data was being inputted while the test was running. This test merely shows that if the user does not exhibit unsafe behavior than every ten seconds the danger level will be reduced.
Eye Rate Tests
Eye closure rate testing was performed by leaving inputting data into the system for a short time and then leaving the system alone to lower the rate. The results below show the effects of increasing the rate either by slow blinking or fast blinking.
Slow Blinking:
After 3 slow (1 second eye closure) blinks, the early warning alarm activated. This test was repeated several times where it took from 3-5 slow blinks to activate the early warning alarm.
Fast Blinking
After 5-6 fast blinks, the early warning alarm activated. The reason for this is that fast blinks take less time and thus the variables are not incremented as often as in slow blinks. Thus, more fast blinks would be required. This is a design problem where if we change the software to accommodate the fast blinks we would inherently change the algorithm for the slow blinks. Thus, we left this code as it was after the testing and analysis.
Conclusion
At the conclusion of the project we successfully demoed a working project. We were able to detect when the angle of the head was below a certain threshold and when the eye was closed. On the software side we were able to provide suitable timing to our alarms. Also, we were able to utilize prior history in determining alarm timing thresholds which made our system “smart.” All of the alarms activated and functioned correctly as specified. We were able to successfully create a pair of safety glasses which acted independently and sent signals to our base station. Overall, our design was completed and all objectives set forth from the beginning of the project were met.
REFERENCIAS
Acebo Wolfson & Carskadon (1997). Relations among self-reported sleep patterns, health and injuries among adolescents. Journal of Sleep Research, 26, 149.
Arora, Broglia, Thomas, & Taheri (2014) Associations between Specific
Buckhalt, El-Sheikh, & Keller (2007). In press. Children’s sleep and cognitive functioning: Race and socioeconomic status as moderators of effects. Child Development. AlphaLab, “IR Paper” ¬- http://www.alfalab.ca/irpaper.html
Clinical Samples. Comprehensive Psychiatry, 59, 135-14
M. Hallett, O. Bai, and C. Bonin, “Predicting Movement: When, Which and Where,” in 2007 IEEE/ICME International Conference on Complex Medical Engineering, 2007, pp. 5–7.
Ozdemir, Boysan, Selvi, Yildirim, & Yilmaz (2015)Psychometric Properties of the Turkish Version of the Sleep Hygiene Index in Clinical and Non-
Sedra, Adel & Kenneth Smith (2016). Microelectronic Circuits (The Oxford Series in Electrical and Computer Engineering). Oxford: Oxford University Press, 2016.
Technologies and Adolescent Sleep Quantity, Sleep Quality, and Parasomnias. Sleep Medicine, 15, 240-247
Yazdi, Sadeghniiat-Haghighi, Zohal, and Elmizadeh (2012) Validity and Re-liability of the Iranian Version of the Insomnia Severity Index.