From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ecg FFT

HEY ALL.PLZZZ I NEED HELP SOMEONE HELP ME   :S

 

i am working on a ECG  project. i implemented an ECG cirvuit that with a microcontroller for the conversion from analogue to digital . then i transmitted the signal to a serial port using max232 and db9 male on the circuit.

 

all i want is to design  a VI that takes that signal serially (serial port configuration) then filter the noise in it, and apply for fast fourier transform in order to display it with a clear peak QRS 

 

PLZZZ I AM NEW USER FOR LABVIEW.....    :S

Bill David
0 Kudos
Message 1 of 14
(4,831 Views)

My company happens to do such projects.  We'll be happy to work up a quote for you.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 2 of 14
(4,821 Views)

well first of all thank you for the reply . i appreciate that Dear.

 

well plz let me know the advancement you make concerning this project plz..

 

the attached VI is the how to tell labview how to acquire the ECG signal serially (VISA , read , write, close etc..) and a display it as a graph.

 

but i just  dont know where to add the filter function as well as the fast fourier transform to obtain a good signal and as much as clear.

 

thank you

Bill David
0 Kudos
Message 3 of 14
(4,785 Views)

OK, I'm not an expert on the SINGLE-POINT functions (Single-Pt FFT, Single Pt Filters), so somebody else might have a better answer.  It looks like those may fit your application better than the traditional way. I would experiment with those.

 

In any case, usually, you have to collect data points, equally spaced in time, into a BLOCK (array). How big the block is depends on what resolution you need.

The resolution (Hz) in an FFT result is  R = Fs / N, where Fs is the sample rate (samples / sec) and N is the number of samples in the block.

 

So, in the traditional method, you collect a block of N samples, apply the chosen filter to the block, then perform an FFT on the block.  You then have magnitude / phase for each of several frequencies occurring in that block.

 

As far as where you put it, it depends on what you're doing with it.

 

If you're recording fast data, but only displaying the spectrum on screen, then divide your loop so that you only do a display every 10th (for example) acquisition loop, and put the Filter + FFT in the display part.  That way you only do FFTs when you need to.

 

If you're recording the spectrum as well, then you put the Filter + FFT as soon as the data is available.

 

HTH,

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 14
(4,773 Views)

Hi shangal!

 

In my opinion, CoastalMaineBird's post is very usefull for your design, he summarized anything needed.

If your question was only where to put the filtering and the FFT in your design, than your problam is mainly solved.

 

If you need help in filter designing, I suggest you to use the example finder in Labview help, and search for "filter desing" or just for "filter".

In the search results you can fint the Design a Filter step by step.VI, which can be very useful for you.

 

If you need some ideas how to create the spectrum of the hearth beat signal, I suggest the example finder in Labview help again.

If you search for "FFT", you can find the STFT Spectrogram demo.VI, the FFT and Power Spectrum Units.VI and of course some other useful already useable programs.

If you search for "spectrum", you can find the Amplitude Spectrum.VI or the Basic Spectral measurement.VI (this is based on express VIs, so it's even more sipmle to use it)

 

I hope theese examples will help you to solve this filtering and spectral measurement issue.

If you have any problems, don't hesitate to post it!

 

Regards,

CLA, CLED
0 Kudos
Message 5 of 14
(4,728 Views)

Dear  BalazsNagy

 

thank you for help .. I am trying to do the things you told me to . let's try , and i will keep you updated.

 

thank you very much !

Bill David
0 Kudos
Message 6 of 14
(4,711 Views)

Dear CoastalMaineBird, Dear readers, plz help . i need you to cooperate with me.

 

here i attached you the Vi i was doing in order to obtain the ECG signal serially (masx232) and take it to labview, in order to filter it , do FFT Function and then display it with clear peaks of heart rate.

 

i just want you to look at it , and find any mistakes if there , and correct them for me .or give me another design for my purpose .i am sure you can help me with this .

by the way i am using labview 8.5

 

hope you cooperate with me .

 

thank you .

Bill David
0 Kudos
Message 7 of 14
(4,694 Views)

Have you tried it?  Does it work? Where does it have problems?  What have you tried?

 

It seems to me that you want someone else to do your work for you.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 8 of 14
(4,681 Views)

Dear CoastalMaineBird

thanks for being gentle this way .

 

and yes i tried it . a small portion of a signal showed up at first and then it disappears eventually. btw the appeared signal looked  like any random signal.

 


Bill David
0 Kudos
Message 9 of 14
(4,677 Views)

Looking at your code:

 

--- You have nothing going INTO the TONE MEASUREMENTS vi (it's unwired).  That makes the output likely to be very boring.

 

--- You have the AMPLITUDE and FREQUENCY outputs of the TONE MEASUREMENTS going to the Y and X inputs to make an X-Y graph.  But those outputs are scalars.  That means the graph will consist of a single point, where Y is the amplitude and X is the frequency of the dominant tone.  I've never seen a graph like that - is that what you want? If so, then you have to turn off Autoscaling on the X and Y axes, or your point will stay in the center and the scales will jump around.

 

--- Your FILTER usage might do some filtering but it won't be rigorously correct.  I don't see anything to enforce a sample rate.  You have a 5 mSec WAIT in the Serial port receiver loop but there are several things wrong with that:

a... That doesn't mean that it will run at 200 Hz.  It means that it will wait for 5 mSec from whenever the WAIT started.  If the receiver stuff takes more than 5 mSec, you're hosed.  If the scheduler decides to run your WAIT function AFTER the receiver, then you're cycling at something less than 200 Hz.  Use a WAIT til NEXT mSEC MULTIPLE to get around some of that.

b... Just receiving data at 200 Hz is no guarantee that it was sampled at 200 Hz.  

c... If your data is not sampled at a constant, known sample rate, then you cannot accurately filter it.

d... the CONVERT TO DYNAMIC DATA function produces no sample-rate info.  the filter has nothing to go on, and will use some default.

Therefore, you don't really know what you're filtering.

 

--- I'm not an expert on the express VIs you use, but I don't see how the TONE MEASUREMENTS vi can discern the sample rate.  It can't measure the frequency of a signal unless it knows a sample rate.

 

--- Your SERIAL PORT RECEIVER is flawed.  You are asking for how many bytes are available at the port, then reading that many and ASSUMING that it is a complete spreadsheet.  There is absolutely no guarantee of that.  You could be doing the asking at some point in the middle of a data message string.  If the incoming string is normally 20 bytes, you could ask after byte 10 and it will tell you there are 10 bytes available, and you take the 10 bytes and run with them.  The next time up, you see the 10 bytes from the PREVIOUS message, and maybe some new ones, and you're in garbageville.  You have to define the beginning / end of a message, so that you deal only in complete messages.

 

--- Minor point, but you usually don't need to view BOTH the linear and the logarithmic scale of an FFT spectrum.  If you need to be able to see either, you can save CPU time by having ONE graph, and a switch to either do the log scaling yourself, or switch the property of the graph to do it / don't do it for you.

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 10 of 14
(4,672 Views)