Two Peak detection and extraction of timing information in arduino

Discussion in 'Embedded Systems and Microcontrollers' started by Goverdhan R, May 13, 2016.

  1. Goverdhan R

    Thread Starter New Member

    Mar 10, 2016
    5
    0
    I want to use arduino to detect peak and extract timing information. As shown in image attached i want ST,T1,DT to be detected using arduino. Detealis about signal frequency:1-2Hz, Some noise exists. So how can i detect ST,t1,DT.
     
    • ppg.png
      ppg.png
      File size:
      281.8 KB
      Views:
      28
  2. Sensacell

    Well-Known Member

    Jun 19, 2012
    1,184
    277
    Feed the signal into an ADC, write some code to detect peaks an slope reversals.
    Read a timer to calculate the time values.

    You may need an analog low pass before the ADC, to filter out the noise.
    Sample it at a much higher rate to increase your timing resolution.
     
  3. dannyf

    Well-Known Member

    Sep 13, 2015
    2,196
    417
    first, you have to define ST, t1, DT: what are they?
     
  4. RichardO

    Well-Known Member

    May 4, 2013
    1,342
    429
    Your signal looks like a EKG waveform. If it is then the peak for the QRS is usually greater than the T wave peak. But, I think in some cases, the T wave can actually be greater than the QRS. Also, sometimes the T wave can be inverted from the QRS. These abnormalities could make your measurements trickier to do.

    Note also that the heart rate can be higher than 2 Hz and lower than 1 Hz. I have had my heart rate close to 180 BPM (not fun) and my resting rate has been as low as 50 BPM.
     
  5. Goverdhan R

    Thread Starter New Member

    Mar 10, 2016
    5
    0
    St, dt, t1 are defined in image i have attached earlier. This all are time intervals in milliseconds.
     
  6. dannyf

    Well-Known Member

    Sep 13, 2015
    2,196
    417
    unless you intend to feed images to your computer, you have define those measurements in terms of logic.
     
  7. hugeone

    New Member

    May 15, 2016
    7
    1
    IMHO arduino is not the best choice. I would actually consider faster boards with much better ADCs . Maybe ST Nucleo F446 (eight quit)
     
  8. NorthGuy

    Active Member

    Jun 28, 2014
    611
    121
    I once had a heart monitor. I used it to keep my heart rate below 145 when I jog as was recommended to improve cardiovascular system. I also used the monitor to learn calming down at rest. After some training I could lower my heart rate to 30. I would guess other people could go even lower.
     
  9. Febri Suyitno

    New Member

    Dec 3, 2016
    1
    0
    So, the answer is? lol there's no one answer the question.
     
  10. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,512
    514
    Free engineering is not free.
     
  11. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,911
    881
    Collect a lot of data. A simple sketch can perform an analog read and write the time and value to the console. Grab that data and analyze it with a spreadsheet. As far as I can see, you need the minimum value, an error value for the minimum, the peak value and error range. The slope of the last n-m points and the slope of the last n points, to see if the curve is increasing or decreasing (n and m determined experimentally. Then you have enough data to write an algorithm for your three values.

    I'd use case statements to implement three different situations. 1) Calculating ST, 2) Calculating T1 and 3) Calculating DT

    You'd use the techniques/ values developed in your test program in performing the calculations in the three cases defined above.
     
  12. dannyf

    Well-Known Member

    Sep 13, 2015
    2,196
    417
    he didn't help himself much.
     
  13. BR-549

    Well-Known Member

    Sep 22, 2013
    2,184
    421
    Why not record the change in the polarity of the signal with a timer? You will need a little dead band to prevent false starts.
    Start a timer1 at the positive change at ST. When the polarity changes to negative, Stop timer1 and start timer2. Store timer1, reset timer1. This stored timer1 value is the length (time) of ST.
    When the signal gets about half way thru T1.....the polarity will change. Stop timer2. Start timer1. Store timer2 and reset timer2. When the polarity of T1 changes at the end of T1, Stop timer1. Start timer2. Store timer1. Reset timer1. Add timer1's new stored value to timer2 stored value. The result is the length (time) of T1.
    The signal will change polarity again at the beginning of ST. Stop timer2 and start timer1 again for beginning of next ST. Store timer2. reset timer2. Add the stored timer2 value to the ST value......this is your DT value.

    This will only work for the signal that you showed. But one can play with the dead band and use multiple timers.

    Hardware speed is what limits you.

    You did want just the time component and not the amplitude? Right? i.e......timing information.
     
Loading...