跳至主要内容

WEEK4

Heart rate detection

Hardware

This week, we continued the test of the second-order filter and started to compile the code. The filter that worked successfully last week failed again. We carefully checked every possible cause but still found no problems. The method was to connect the signal generator to the input of the filter and the oscilloscope to the output of the filter. A sine wave signal of a certain frequency was input and it needed to check if this signal can pass through the circuit normally. We checked the circuit and the connection was good. Next, the components were checked one by one and no problems was found. Some of the components were also replaced. However, the situation didn’t improve much.

In addition to the retest of filter, the compilation of the code has also begun. We plan to display the value of heart rate on the screen of the Arduino. Only in this way can the smart watch play a practical role.

Then, we simulated the filter.

The result verified that the principle of the second order filter was correct and it should work as expected. However, it did not work in fact because of some problems in hardware.

Software

This week, we worked out the software algorithm of the heart rate detector, which is shown below.



Illustration:
1.      input signals (100Hz) 200 samples per group

2.      Smooth the input by calculating the mean value of each four continuous samples and storing the outcome into a new array; Find the maximum and minimum value of the smoothed signal to obtain the threshold value by the formula:
threshold = (maximum + minimum)/2;

3.      Judge each two adjacent samples whether they conform to that the former is lower than the latter and the threshold value is between these two. If yes, the variable of heart beats counters plus one and goes into the filter. If no, refill them with next two samples.

4.      After then, a filter is applied to filter off the average heart rate which is over 200 or under 50. Also put three continuous average heart rates into an array to calculate these differences to check if the sensor is put stably on the hand without any unexpected situation. if these differences are smaller than the limited value, then the display will finally show your heart rate. repeat it by replacing the new sample to the oldest sample in the array.

For the result of it, with the input of strobe light with different frequencies, the output is shown below.

Figure 1: Result for 1.5 Hz strobe light

Figure 2: Result for 1 Hz strobe light


Figure 3: Result for 3 Hz strobe light
In these three figures, the heart rate detector could accurately detect the heart rate within restricted difference and all the outcomes are approximately equivalent to the correct heart rate within error ±2.5 beats/min.

评论

此博客中的热门博文

WEEK 2

Part 1 - Pedometer The whole algorithm was shown below. Part 2 - Heart Rate Sensor 1.Use simple band-pass filter (1-3Hz) to reduce the affect of the noise.  f1=1/(2*pi*R1*C1)=1Hz f2=1/(2*pi*R2*C2)=3Hz where C1=1uF           R1=560K           C2=5.3uF           R2=10K The band-pass filter with a pass-band from 1 Hz to 3 Hz to allow the heart beat signal to come through and the rest of the signal noise to be rejected.  2. Use amplifier to amplify the signal we expected.  Gain = 1 + (R2/R1) Gate= 1+1M/10K=101 The oscilloscope was used to measure the voltage drop on the photoresistor. As expect, the voltage will change because the red light through the figure will change with the oxygen content of blood. The expected result is a pulse wave similar to human heartbeat, but the amplitude was about 3mV measured by multimeter. However, the noise was larger that the pulse although a filter was connected. The noise co

WEEK 5

Clock demonstration program warn the error input Timer demonstration Complete circuit Poster

WEEK3

2. Heart Rate Detector (1).       Use the simple filter, the result can be observed, but with many noises . (2)      So, we build the second order filter combinated with low pass filter and high pass filter. LOW-PASS FILTER HIGH-PASS FILTER Demonstration