• No results found

Tests and Results

45

I

n this chapter, I am going to view the methods that I used for testing verifying each element, entity and the integrity of the system. I will also show the results that I have got after conducting the tests. Please note that the discussion of the final results can be found in Chapter Five.

4.1: Testing the functionality of the ADS1293

T

his test was one of the trickiest as I was not actually just testing the functionality of the ADS1293, but also testing the correctness of my code and even the soldering of the ADS1293. The problem is that the designer cannot make sure if the all the QFN

packaged IC’s pads are soldered correctly to their footprints. Therefore, if I soldered the IC and performed the test for configuration and it failed, I cannot tell for sure if the issue is with code or with soldering or even with the ADS1293 chip itself (highly

sensitive to ESD).

The test was simply to hook the ADS1293 to the MCU using SPI bus -see Figure 28-, writing a value to a specific register and then reading this register. As expected, the first test failed, but I was confident that the problem is not with my code, so I re-soldered the chip again and retested it and finally, it worked.

46

Figure 28: Circuit used for testing ADS1293

4.2: Testing the ESP8266 (server/client comm.)

T

his test was not as hard or tricky. The strategy was to connect a potentiometer to the client, read the voltage across the potentiometer using the analog to digital channel (ADC) -see Figure 29-, send the value to the server and display the received value using the serial plotter.

47

Figure 29: Circuit used for testing ESP8266

Eventually, the test succeeded, and I was able to plot the change in the voltage continuously and wirelessly as I was changing the value of the resistance on the potentiometer.

4.3: Testing the first prototype integration

I

n this test, the target was to verify that the integration of both the software and the hardware produces the expected results; a clean ECG signal. To conduct this test, I used the circuit shown in Figure 10. I connected my body to the circuit using ECG

Ag/AgCl electrodes (27). Of course, it did not work from the first trial due to bugs in the code, but after debugging and testing, it worked and produced the output signal

shown in Figure 30.

48

Figure 30: Result for the first prototype test

The ECG lead that I tested in this test was ECG Lead II (right leg is the reference, right hand is the negative and left leg is the positive (28)). Later, I used this output signal to verify my MATLAB code.

4.4: PCB design rule check tool (DRC)

T

his is an automated checking tool provided by Altium Designer (29). Usually, the designer will start by setting his rules for the DRC tool before starting with the PCB layout.

The reader can refer to section 3.4.2 where I talked about this topic.

49

4.5: Post-soldering inspections

W

hen it comes to surface-mount dimensions (SMD) soldering, one needs to be very careful as he/she is dealing with small dimensions. But even with caution taken, there will always be room for small yet critical mistakes.

Personally, I prefer to perform a check routine after soldering every single component as well as an integration test. Two kinds of inspections were used; electrical inspection using a digital multimeter (DMM) to look for short circuits, and visual inspection using an electronic microscope -see Figure 31-.

Figure 31: Feedback from the microscope

50

4.6: Serial port setup in MATLAB

T

o verify the code responsible for setting up the serial port and scanning the incoming data, I used the same circuitry in Figure 29. The expected result was just like the one for the test of the ESP8266 in section 4.2, only here the ARDUINO serial plotter is replaced with MATLAB graph. Eventually, the test succeeded.

4.7: Tune the factors of the filters

D

esigning a filter can involve some trial and error procedures. The approach I used for deciding the designing factors of the filter -mainly the cutoff frequency- was to

perform a power spectral density (PSD) analysis for the pre and post-filter signal.

For example, the ECG signal shown in Figure 32 contains a linear trend component.

Figure 32: Raw ECG signal

When performing a PSD analysis on this signal, the designer can notice a high-power component at the frequency 1 Hz as illustrated in Figure 33 below.

51

Figure 33: PSD of the raw ECG

Using this information, the designer can set the cutoff frequency for the HPF to be equal to 1Hz. The resultant ECG signal is illustrated in Figure 34 below.

Figure 34: ECG signal after HPF with CF=1Hz

And when performing the PSD analysis on the filtered ECG signal, we can see that the peak at the frequency 1Hz has disappeared as illustrated in Figure 35. The signal is still noisy and can be filtered using a low-pass filter (LPF), but this is for demonstration reasons only. Note that this is not the output signal from the system that I designed and thus, it does not represent the noise of a wearable ambulatory ECG signal.

52

Figure 35: PSD for the filtered ECG

Figure 36: ECG signal after a wavelet denoising filter

4.8: Computation time calculation

T

o calculate the computation time needed to perform a specific function, I used the combination of the MATLAB functions “tic” and “toc”. When performed, the elapsed time starting from executing the “tic” until executing the “toc” will be printed on the command window of MATLAB. This can be useful when optimizing the code.

53

4.9: Code integration test

H

ere, I verify the functionality of the code as one entity. To do that, I used the signal that I have acquired using the first prototype -which emulates the final prototype- which illustrated in Figure 30. A portion of the resultant signal from the filtering block as well as a sample of the final ECG signal along with its features are illustrated in the two figures 37 and 38 below respectively.

Figure 37: Output signal form the filtering block

Figure 38: ECG signal with its extracted features (P, Q, R, S and T-waves)

54

4.10: Final prototype test

I

n this test, I want to verify the functionality of the final prototype -the PCB-, and that is done by simply redoing the same test done in section 4.3 but using the final

prototype instead of the first one.

The results are illustrated in Figure 40 below.

Figure 39: Final prototype "client"

Figure 40: Output signal from the final prototype

55

Based on the previous results, I can say that the test of the final prototype has failed to meet the desired output behavior.

The final test that was supposed to be done after this one is to test the integration of the final prototype with the MATLAB software. Since the final prototype has failed to produce the wanted signal, the final test was postponed.

In the next chapter, I am going to discuss the final results and try to predict the reason for such failure.

4.11: Quantitative evaluation of the algorithms

I

n this test, I perform a statistical evaluation test that evaluates the performance of the algorithms in MATLAB. Those algorithms are supposed to detect and identify the targeted features in the ECG signal (P, Q, R, S and T-waves).

To do that, I must have an ECG signal with prespecified statistics that can be used as a ground truth for the evaluation test. I used the WFDB toolbox for MATLAB and Octave (37) (38) -provided by Physionet (30)- to generate a synthesized ECG signal. Using this tool, one has full control over the main parameters of the ECG signal such like the heart rate mean and standard deviation as well as the additive noise and the sampling frequency.

I tested the algorithms by inputting:

• A clean ECG signal with normal rhythm

• A noisy ECG signal with normal rhythm -see Figure 45 and 46-

• A noisy ECG signal with arrhythmia (tachycardia)

• A noisy ECG signal with arrhythmia (bradycardia) The statistical measures of the performance are:

• Estimated heart rate mean (HRmean_est)

• Estimated heart rate standard deviation (HRstd_est)

• Positive predictivity or precision (PP) = (true positives / condition positives) * 100

• Sensitivity (Se) = (true positives / (true positives + false negatives)) * 100

• Accuracy (Acc) = ((true positives + true negatives) / (true positives + true negatives + false positives + false negatives)) * 100

56 Terms used for the evaluation:

• P, Q, R, S and T: condition positives

• P_det, Q_det, R_det, S_det and T_det: detected positives

• neg_P, neg_Q, neg_R, neg_S and neg_T: detected negatives

• P_trueP, Q_trueP, R_trueP, S_trueP and T_trueP: true positives

• P_falseP, Q_falseP, R_falseP, S_falseP and T_falseP: false positives

• P_trueN, Q_trueN, R_trueN, S_trueN and T_trueN: true negatives

• P_falseN, Q_falseN, R_falseN, S_falseN and T_falseN: false negatives

• Fs: sampling frequency [Hz]

• Anoise: additive uniformly distributed measurement noise [mV]

• HRmean: heart rate mean [beats per minute]

• HRstd: heart rate standard deviation [one beat per minute]

• T: total elapsed time [minutes]

• N: total number of heart beats

The results for each test are illustrated in the figures 41-44 below:

Figure 41: Evaluation test 1

57

Figure 42: Evaluation test 2

Figure 43: Evaluation test 3

58

Figure 44: Evaluation test 4

Figure 46: Synthesized ECG with Anoise = 0.1mV Figure 45: Synthesized ECG with Anoise = 0.2mV

59

Related documents