EOG signal conditioning and samples acquisition
For the sampling stage, an Atmega 328p microcontroller was chosen, this microcontroller is embedded in the Arduino Uno development board. The microcontroller was configured to sample the EOG signal coming from the pre-processing circuit at a rate of 2 milliseconds. To remove the noise, generated due to electromagnetic interference a first-order Infinite Impulse Response (IIR) digital filter with a cut off frequency of 10 Hz was designed and implemented. It is important to have a deterministic sampled rate to assure that the IIR filter performs correctly, therefore the 500 Hz sampling rate was generated through the interrupt service routine of one of the timers of the Atemga 328p. To design the digital filter first, the analog low pass filter is designed with the required cut-off frequency leading to the next transfer function (Equation 1).
\[LP=\frac{62.83}{s\ +62.83}\]
Then the continuos low pass filter is converted to the digital domain with the use of the bilinear transform or Tustin method. The discrete transfer function taking into consideration a sampling rate of 2 milliseconds is presented below and a bilinear transformation (Equation 2). \[LPD\ =\ \frac{0.05912z+0.05912}{z-0.8818}\]
To program in a microcontroller the discrete transfer function it is necessary to express it in the form of sums and multiplications leading to the next expression (Equation 3).
\[y\left(n\right)\ =\ \ 0.8818y\left(n-1\right)+0.05912x\left(n\right)\ +\ 0.03912x\left(n-1\right)\]
Where y(n) represents the actual output of the filer, x(n-1) represent a one delay input value of the analog to digital converter of the microcontroller, while x represents the actual input of the ADC. Finally y(n-1) is one delay output value of the difference equation.
Since the difference equation depends on values from past inputs and particularly past output values, IIR filters are commonly known as recursive filters. When the microcontroller is first to turn on, the past input and output values are set es zero and in this way, the filter starts to calculate the output signals. Each time the microcontroller enters the interrupt service routine of the timer, the microcontroller triggers the analog to digital conversion unit of the Atmega 328., then the sampled data is sent through serial communication through a single board-computer for further processing. During the above process, the difference equation must compute the output value that will be seen through serial communication. The Universal Asynchronous Receiver Transmitter Protocol was the selected communication protocol to enabled the connection with other external devices. With the help of Python 20 samples for up movements, 20 for down movement, and 20 blink movements were recorded.
Later, time analysis of the sampled signals was performed to extract observations or characteristics of the EOG signal, in this case, the root means square (RMS) value (Equation 6), the average value (Equation 5), (AVR), and the distance between the positive peak and negative of the signals were chosen as characteristics (Px), this calculation is express in the equation 7. This process is commonly known as feature extraction. The expressions used to calculate the mentioned features are shown below.
\[AVR\ = 1/N\sum_{i=1}^{N}|x_i|\]
\[RMS\ = \sqrt{1/N\sum_{i=1}^{N}x_i^{2}}\]
For the relation of the Average Rectified Value (AVR), and the Root Mean Square (RMS) N represents the sample size of the recorded eye movement and xi is the value on each data index i in the size of the sampled eye movement signal.
\[P_X\ =\ P2-P1\]
The distance or number of samples between the maximum peak value (P1) of the EOG signal and the minimum peak value (P2) was the final predictor (Px )chosen to classify the movement of the EOG signal. The distance between peaks is simply calculated by subtracting P1 from P2. Figure 10.4 illustrates this process for and blink movement of the EOG signal.