Link to this chapter Copy to clipboard
Cite this chapter Copy to clipboard
Embed this chapter on your site Copy to clipboard
Embed this code snippet in the HTML of your website to show this chapter
Open access peer-reviewed chapter
By Wahidah Mansor, Mohd Shaifulrizal Abd Rani and Nurfatehah Wahy
Submitted: November 18th 2010Reviewed: June 11th 2011Published: August 29th 2011
Nowadays, controlling electronic devices without the use of hands is essential to provide a communication interface for disable persons to have control over their environment and to enable multi-tasking operation for normal person. Various methods of controlling electronic devices without the use of hands have been investigated by researchers, for examples sip-and-puff, electro-oculogram (EOG signals), light emitter and others [Ding et al., 2005, Kumar et al., 2002; Breau et al., 2004]. In our previous study, EOG signal was found to be suitable for activating a television using a specific protocol [Harun et al., 2009], however, it could not be used when a person is not facing the system. Thus, a method that is more flexible has to be investigated.
The use of neural signals to directly control a machine via a brain computer interface (BCI) has been studied since 1960s. Using an appropriate electrode placement and digital signal processing technique, useful information can be extracted from neural signals [Holzner et al, 2009; Jian et al., 2010; Gupta et al., 1996.] One of the events that can be detected from this signal is eye blink. It can be used as a mechanism to activate and control a machine which can help disable people to do their everyday routines.
Most BCI systems employs a computer to process neural signals and perform control. Since portable system offers benefits such as flexibility, mobility and convenience to use, it is more preferred than a fixed system. An embedded system can be designed to provide portability feature. To include this feature, a microcontroller is required to control its operation and provide a communication link between human and machine.
This chapter discusses how neural signal and embedded system can be combined together to activate a fan connected to a motor. It covers the introduction to neural signal, neural signal processing, embedded system and EEG based fan system hardware and software.
Neural signal or commonly known as electroencephalogram (EEG) is the representation of electrical activity of the brain. The overall excitation of the brain determines the amplitude and patterns of the signal. The excitation depends on the activity of the reticular activating system in the brain stem. The pattern changes markedly between states of sleep and wakefulness. The EEG signal is divided into five frequency bands; beta, alpha, theta, delta and gamma. Beta frequency is in the range of 12 Hz – 22 Hz and occurs when the person is awaken and in the state of alertness. Alpha is in the range of 8 – 13 Hz and is present when a person is awaken and relaxed with eyes close. Theta exists in the frequency range of 4 – 8 Hz when a person is sleepy, already sleep and in the sleep transition. The slowest wave is delta which is in the frequency range of 0.5 to 4 Hz and is associated with deep asleep. And finally gamma (22 – 30 Hz) consists of low amplitude & high frequency waves resulting from attention or sensory stimulation. Figure 1 shows the normal EEG signal of a relaxed patient. The signal consists of beta waves which lie in the frequency range of 13 to 22 Hz. Figure 2 shows EEG signal with eye closure and eye opening. The negative amplitude shows the eyelids closure and positive value shows the opening of eyelids.
The recorded EEG signals always contain artifacts which impede the analysis of the signals. The artifacts include muscle signals, heart signals, eye movements, power line interference, eye blinks and others. Artifacts in EEG signals typically are characterized by high amplitudes. Eye blinking artifacts always present in EEG signals since it is difficult to make the subject open his/her eye for a long time. In some cases, eye blinking artifacts may be useful and are required as a parameter for activating a system.
In EEG signals, eye blinks occur as peaks with relatively strong voltages. Eye blinks can be classified as short blinks if the duration of blink is less than 200ms or long blinks if it is greater or equal to 200ms [Bulling et al, 2006]. The amplitude of the peaks varies between different subjects. They are often located by setting a threshold in EEG and classified for all activity exceeding the threshold value.
Eye blinks can be classified into three types: reflexive, spontaneous and voluntary. The eye blink reflexive is the simplest response and does not require the involvement of cortical structures. Spontaneous eye blinks are those with no external stimuli specified and they are associated with the psycho-physiological state of the person. The amplitude of spontaneous eye blink is in the range of -4 to 3 V with duration of less than 400 ms and frequency of below 5 Hz. The EEG signal obtained when the eyes moved to the right and left is shown in Figure 3. This signal contains a lot of artifacts caused by spontaneous eye blinking and eyelid movements as the eyeball moved. The signal obtained from these eye movements are not suitable for activating a system as the occurrence of eye movements is difficult to detect. Figure 4 shows EEG with eye movements upward and downwards. This signal consists of noise which covers the required information to be extracted.
Voluntary eye blinking which is intentional blinking due to predetermined condition, involves multiple areas of the cerebral cortex as well as basal ganglion, brain stem and cerebella structures. Figure 5 shows the EEG signal with voluntary eye blinks. This EEG signal has larger amplitude and longer duration (400 -500 ms) compared to that obtained from spontaneous eye blink. This signal has been filtered which remove the signals above 5 Hz leaving only very clear eye blinking signals. Other artifacts such as 50 Hz power line interference and noise have also been removed using analogue filtering provided by the EEG instrument.
The suitable event for activating a system is three continuous eye blinks (with a duration of 1.5 to 2.5 seconds between eye closure and opening as they are not present when the subject is in relax condition [Abd Rani et al., 2009 ]. The duration between the first cycle of eye opening and closure and the second cycle should be 3 to 4.5 seconds.
Basically, there are two ways of acquiring the EEG signals from the subjects; invasive and non-invasive techniques. In the invasive technique, electrodes are implanted in the subject’s brain and located on the brain surface whereas the non-invasive technique uses electrodes that are placed on the scalp. In most cases, non-invasive technique is more preferable than the invasive technique since it is harmless and easy to use. The standard electrode placement for the non-invasive technique is called International 10-20 system where 10% and 20% of a measured distance starting from craniometric reference points such as nasion, inion, left and right pre-auricular points are used to locate the EEG electrodes. The placement of electrodes for 10-20 system is shown in Figure 6. In this arrangement, a reference and ground electrodes are placed either on the ear lobe or mastoid.
As mentioned previously, the recorded EEG signals contain artefacts which have to be removed in order to obtain good morphological signals. Once a clean EEG signal is obtained, the second stage is to amplify the signal. EEG signal amplitude obtained from the scalp is very small, range up to 100mV which is difficult to see without amplification. The signal also has low frequency. It is necessary to analyse the signal to examine the characteristics of the signal and to ensure the noise has been removed. The signal can be analysed using Fast Fourier Transform (FFT), time-frequency analysis or time scale analysis. The FFT only gives frequency information of the signal, thus, time-frequency analysis or spectrogram is normally used to view the frequency at each time point.
The next stage is extracting the underlying information in the signal. Depending on the purpose of the study, this stage can be feature extraction or event detection as shown in Figure 7. If the EEG signal is to be used for activating equipment, a simple and an easy way is to detect an event from the signal, for example eye blinks and use the output which in the form of pulses to activate the equipment. Classification process is necessary if specific features are needed to perform the activation. This stage is also called translation process where the pattern classified is translated into suitable signal to activate equipment.
A computer system that is embedded in an electronic device to perform specific functions is called embedded system. It forms part of the system and controls one device or many devices. The main controller in this system is either a microcontroller or digital signal processing. A microcontroller is a small computer on a single integrated circuit which is designed to control devices. It consists of CPU, memory, oscillator, watchdog and input output units on the same chip. The microcontroller is available in wide range from 4 to 64 bits.
A PIC microcontroller is commonly used in embedded system due to its simplicity and ease of use. It offers several advantages such as design time saving, space saving and no compatibility problems. However, it has limited memory size and input/output capabilities. Figure 8 shows the block diagram of internal architecture of PIC16F877 microcontroller. The PIC microcontroller is built around Harvard architecture where two memories; one for program and the other one for data are separated. Separate buses are used for program and data memories. This eliminates jumping of program code into data or vice versa. PIC microcontroller uses RAM memory or known as file registers to store data during execution and a working register called W register to perform arithmetic and logic functions. User program is stored in the flash program memory and a status register is used to indicate the status of microcontroller through flag bits such as carry, zero, digit carry flags and others. PIC16F877 microcontroller has three 8 bits parallel input/ouput ports, 8 channels of analog inputs and serial outputs.
A block diagram of EEG based fan system incorporating microcontroller is shown in Figure 9. It consists of EEG acquisition system, a microcontroller and a motor circuit. Three electrodes are connected to the EEG acquisition system and located on the subject’s scalp at frontal, occipital and ear lobe. The EEG acquisition system is responsible for recording the EEG signals and passing the signals to the microcontroller system. The recorded EEG signal consists of voluntary and spontaneous eye blinks. Thus, to activate the motor, four seconds eye blinks in EEG signal is used. The functions of the microcontroller are to process the EEG signal, detect four-second eye blinks and use the detection results to control the movements of motor that is connected to a fan. Here, PIC16F877 is used as it can read analogue signal directly without the need of external analog to digital converter circuit. Three eye blinks within duration of four seconds are used since it is the best technique to activate a system [Abd Rani et al, 2009].
There are a few ways of connecting a motor to the microcontroller. If a dc motor is used, a circuit shown in Figure 10 can be implemented. This is a simple circuit which requires 5V supply to operate. A relay can be used to activate the motor if it is connected to 240V ac supply. Figure 11 shows the connection of the microcontroller to the devices on the motor circuit that comprises a transistor, a diode, a relay and a motor.
The PIC microcontroller cannot work without software. A controlling program is required to read EEG signals from a subject, detect three time eye blinks and activate the motor. A program written in C language or PIC assembly language can be used to perform the detection and control operation. The process of detecting three time eye blink and activating the ac motor is shown in Figure 12. Initially, the program examines whether the EEG signal amplitude exceeds the maximum threshold voltage, is below minimum threshold voltage or lies between the threshold voltages. When three eye blinks within duration of four seconds is detected, the program sends logic 1 to the output of the microcontroller to drive the relay to activate the motor.
The functionality of the system can be examined in two stages. In the first stage, the performance of the system in detecting four second eye blink is evaluated. Here, the recorded EEG signals that are stored in excel file are used. A digital acquisition card is used as a communication medium between the computer and microcontroller system. The function of DAQ card is to transfer the recorded EEG signals from the computer to the PIC microcontroller. A program written in Visual Basic is used to send the EEG signal from the computer to the microcontroller. To view the EEG signal received at the output of DAQ, an oscilloscope is placed at one of the DAQ analogue channels. The transmitted EEG signal displayed on the computer screen is compared with the signal observed on the oscilloscope. The eye blinks are detected using software written in C language which is programmed on the microcontroller. In order to view the signal send to the motor, the output of the microcontroller is connected to the oscilloscope.
In the second stage, the functionality of the motor circuit is tested using a simple routine shown in Figure 13. A switch is connected to the input of the microcontroller to initiate the testing. When the switch is turned on, the routine activates the relay that is connected to the motor. Once it is confirmed that the eye blink detection module and motor activation routines are working successfully, these routines can be combined together.
The EEG signal containing eye blinks observed at the output of DAQ is shown in Fig. 14. This signal contains three eye blinks and the length of the signal is 4 seconds. The eyelid closure and opening can be observed clearly through the signal negative and positive amplitudes.
Figure 15 shows the EEG signal with voluntary eye blinks and the pulse obtained when four second eye blinks is detected. This pulse is observed at the Port B of the PIC16F877A microcontroller. The motor starts moving once the transistor connected to port B is switched on.
Figure 16 shows the EEG signal when the subject is in relax condition. This EEG signal contains spontaneous eye blinks which are not detected by the PIC microcontroller. The amplitude of spontaneous eye blinks is below the threshold value which causes the PIC ignores them and no pulse is generated at the output.
A system that can activate a fan using EEG signal detected by a microcontroller has been described in this paper. The results showed that eye blinks can be detected successfully using PIC16F877A. With a program running on PIC16F877 microcontroller, a simple motor can be activated using neural signal. This application is suitable for people who cannot move their hands or the whole body to control a fan. Using this system, users can control a fan easily without any conventional remote controller. This system is useful for elderly people and disable persons as well as able-bodied people.
For future work, wireless electrodes should be employed in this system. The purpose is to make the users to feel comfortable with no wires hanging on their head. With wireless connection, the microcontroller module can be located at a distance from the user which provides more freedom for normal person to move around. However, this system requires intelligent software to eliminate interference and prevent false detection.
The authors would like to thank Universiti Teknologi MARA, Shah Alam, Malaysia for providing facilities to carry out this research project.
3348total chapter downloads
Login to your personal dashboard for more detailed statistics on your publications.Access personal reporting
Edited by Horacio Martinez-Alfaro
By Tijani Ismaila B., Rini Akmeliawati and Momoh Jimoh E. Salami
Edited by Bishnu Pal
By Bishnu Pal
We are IntechOpen, the world's leading publisher of Open Access books. Built by scientists, for scientists. Our readership spans scientists, professors, researchers, librarians, and students, as well as business professionals. We share our knowledge and peer-reveiwed research papers with libraries, scientific and engineering societies, and also work with corporate R&D departments and government entities.More about us