Project 2
Project 2
Project 2
ABSTRACT
Feeling sleepy while driving could cause hazardous traffic accident. However, when driving alone on highway or driving over a long period of time,
drivers are inclined to feel bored and sleepy, or even fall asleep. Nowadays most of the products of driver anti-sleep detection sold in the market are
simply earphone making intermittent noises, which is quite annoying and inefficient. As such, there is a high demand for cheap and efficient driver
sleep detection. Therefore, we came up with an idea and successfully developed a sleepy detection and alarming system, which could effectively meet
this demand.
1. INTRODUCTION
Project motivation and purpose The goal of this project is to develop a system that can accurately detect sleepy driving and make alarms accordingly,
which aims to prevent the drivers from drowsy driving and create a safer driving environment. The project was accomplished by a Webcam that
constantly takes image of driver, a beagle board that implement image processing algorithm of sleepy detection, and a feedback circuit that could
generate alarm and a power supply system. 1.2.Functions and Features This system has many features that make it unique and functional. These
features include: 1. Eye extraction, use open and close to determine sleepiness 2. Daytime and night detection 3. Real time i mage processing and
detection 4. Sound and flashing LED warning system to redraw driver’s attention 5. Little inference and potential hazard to driver’s normal driving 6.
Portable size with car cigarette charger socket power supply
2. DESIGN OF PROJECT
General design alternatives The first alternative design between the final implementation and the initial plan, for the software part, is the choice of the
camera. We desired to use Kinect for capturing the input images at first. However, in pragmatic application, we found out in order to connect the
Kinect, three drivers need to be installed, which are Opening, NITE and Sensor Kinect. Though these three can be successfully installed on the
computer and run the Kinect, the exactly same files could not be installed on the Beagle board. We found out that was because the Beagle board could
not understand the binary file format. However, despite of this change in our plan, we still successfully implemented both the daytime detection and
night detection, based on the advancement of algorithm. The accuracy is pretty high, which reaches 93% at daytime and 82% at night. Another
advantage of changing the camera is the significant cost reduction. The new webcam is only 6 dollars while the Kinect is more than 99 dollars. The
anther alternative is the adding of the battery. In order to meet the rigorous requirement of power supply of Beagle board, a USB battery module is used
intermediately. This alternative solution makes the product more portable and 6 sustainable since the Battery can be easily and constantly charged by
the dc-dc power converter. Meanwhile, the dc power converter can be supplied by cigarette power jack installed on the car, which turns this alternative
into an advantage
3. SOFTWARE FLOW CHART AND ALGORITHM
Description The algorithm aims to accurately detect the sleepiness of the driver by open eye and close eye recognition. The sleepy detect ion algorithm
is built on C++ and OpenCV library. The test was first implemented and tested on the computer, then on the Beagle board. The algorithm includes two
parts: daytime detection and night detection. First and Foremost, based on the average intensity of pixels, the algorithm cla ssifies the environment as
daytime or night. For daytime, the image quality is good enough, therefore no image enhancement is required; for night, because the poor contrast of
the images, histogram equalization, a method to expand the color range of the image from 0 to 255, is implemented. In this ca se, we need a light the
slightly illuminate the driver. In the next step, as soon as the driver has entered the car, two base images are recorded automatically – open eye as well
as close eye. These two images are used as the base for further determination of whether the drivers’ eye is open or close. A fterwards, the driver could
start driving. The detection algorithm is in real time and the eye portion is extracted by using the iterative Haar Classifier. After the current eye portion
is extracted, we use template matching function built in OpenCV to determine if the eye is open or close. If the eye has been closed for more than two
seconds, sleepiness is detected and the program will send a signal to Beagleboard. The detailed flow chart of the algorithm i s shown below
4. VERIFICATIONS
Testing procedure Software: The test was initially executed on the computer and then on the Beagloboard. To verify the eye portion algorithm, the
tester stood 0.2 to 0.3 away from the Webcam which was located in front of the tester at an angle with ±15°. The image of the eye section was extracted
successfully and was highlighted by a red rectangle. To test the daytime detection, we controlled the environment light inten sity to be 80W and the
tester stood at the same detection position as above. When the tester closed the eye for more than two seconds, the program showed “eye closed” at
terminal as required. In addition, when the tester blinked the eye, nothing happened as expected. To test the night detection, the only difference is that
we controlled the surrounding light intensity to be 20W. We successfully got the same detection result as daytime. Beagleboard: We compiled our code
on the Beagleboard and ran with webcam connected. For each of our main loop we tried to capture an image and analyze it, a timer is used to record the
time for each loop. The average time is within 0.33 second as satisfied our 19 requirement. For the GPIO pin output, we were able to send out a control
signal varying from 1.788V to 1.835V which satisfied our requirement(1.8V±5%). These control signals were able to drive LEDs and buzzer
successfully. For the GPIO pin output, we fed a control signal of 0V to the pin and our program is able to identify that the pin is set to low, which meets
our requirement.
5. CONCLUSION
Accomplishments As for the software part, we fulfilled our goal successfully. The detection algorithm could not only work effectively and
accurately at daytime, but also at night. The Eye portion extraction is smooth and in real time with no delays on the computer. In addition, there is a
bonus function in the software part – detection with glasses. For the Beagleboard, we achieved two major difficulties. First, we were not able to power
up the board with any commercial chargers initially, including the ones for iPhone, for Assume, or the USB charger on car. But later we added
DXPOWER battery to power our board and used the power supply we designed to charge the battery to solve the problem. Second, we experienced a
few difficulties while installing the OpenCV library on Beagleboard, but were able to solve it by changing flags in make files to the one corresponding
to ARM board architecture. The power supply unit basically completes all its design requirements. By adding the extra USB battery stage, the problem
of powering the entire microcontroller and alarming system has been solved. Moreover, the alarming system works as we supposed. The volta ge ripple
of the power supply unit can be mitigated by applying more resilient capacitor components. It is apparent that the overall project success is not derived
from one team member’s mind but the keen coloration within our group. Each part is indispensable and every team member made t he great dedication
on the completion of this design project. The pace is intense, the learning, immense. 5.2 Ethnical consideration 1. to accept responsibility in making
decisions consistent with the safety, health, and welfare of the public, and to disclose promptly factors that might endanger the public or the
environment [5]; By using our Driver Sleep Detection and Alarming System, customers would be warned when his/her physical condition is not good
enough for driving and thus 27 prevents dangerous behaviors from happening. It is consistent with the safety and welfare of t he public. 5. to improve
the understanding of technology; its appropriate application, and potential consequences; By using OpenCV and related libraries, we try to develop and
improve algorithm for eye closeness detecting. We then apply this technology to our application in order to help drivers achieve a better and safer
driving condition. 7. to seek, accept, and offer honest criticism of technical work, to acknowledge and correct errors, and t o credit properly the
contributions of others; We consult Professor and TAs for review advices and improve, seek online resources to help correcting errors, and properly
cite the contributions of other people. 9. to avoid injuring others, their property, reputation, or employment by false omalicious action; We design our
product using qualified components and follow proper safety rules, avoid wrong actions happening to other people.
6. FUTURE WORK
Use OpenGL to control the frame rate more accurately 2. To achieve a higher accuracy at night 3. Use parallel programming such as CUDA to
make code faster and more efficient 4. Use bash script to enable our program to auto start after booting. 5. Use parallel programming and multi thread
to handle image capturing, sending control signal, and running algorithm separately. 6. Design hardware enclosure for PCB , microcontroller and USB
battery 7. Use more advanced components in out/in capacitors to reduce the voltage 28 ripple of the output voltage
7. UNCERTAINTY
The precision of night vision detection has some spaces to improve due to the algorithm and hardware ability limitation. The accuracy of the algorithm
needs further optimization for the night condition.
REFERENCES
[3] "TPS61032 (ACTIVE) 5-V Output, 1-A, 96% Efficient Boost Converter." Texas Instruments, Jan 2012. .
[4] "LM 2679-5.0 (ACTIVE) 5-V Output, 5-A, 96% Efficient Buck Converter." Texas Instruments, Jan 2012. .