LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

analyze signal from accelerometer

Hello,

 

I have made an TUG-test measurements with accelerometers. TUG means timed up and go test. Subject is sitting on the chair,then after signal GO he stand up (Phase 1) walk to the mark on the floor (phase 2), turn around (phase 3), walk back (phase 4), turn again (phase 5) and sit down (Phase 6). 

I have data from accelerometer in .txt  - Those data are acceleration in all axis.. so acc x , acc y, acc z , then angular velocity in all axis so gyr x, gyr y and gyr z , and then I have yaw,roll and pitch for each accelerometer (And few more,but those are most important). I put accelerometers on arm,back,calf,thigh and hib. Now, I need from theese data find the way, how to recognize each phase, show it in graph or anywhere and calculate the time of each phase. I also know the whole time of one attempt. Please is there anybody who could help me to solve this problem in labview? I could send the data from accelerometers if it will be necessary. Thank you very much.

0 Kudos
Message 1 of 11
(5,049 Views)

If your data is in a text file your first step would be to read the data from the text file. Then display the data to see that you've correctly read it.

 

Search for 'Read from Text File' in NI Examples Finder. (Help>Find Examples .. in LabVIEW)

0 Kudos
Message 2 of 11
(5,045 Views)

As noted, you need to break the problem down and identify which part you are seeking help in. We can't (and won't) write the program for you, but we can offer assistance on how to go about each step. So, as a start, we have:

 

  • Reading the text file. What is the format of the text file? Do you have tabular-like data? Can Excel read it directly? If so, then you can use the Read From Spreadsheet File funciton. If your format is more complicated then you will need to parse the file.
  • Graphing the data. Are you trying to display this data in 2D or 3D? There are many examples that ship with LabVIEW showing you the 3 types of 2D graphs and the various 3D graphs.
  • Analyzing the data. You've actually pointed out 2 types of calculations:
    • "how to recognize each phase" - I'm not sure I understand what you mean by this. The phase of what?
    • "calculate the time of each phase" - again, I'm not sure what you mean but this. Are you referring to the phase difference between signals?
0 Kudos
Message 3 of 11
(5,031 Views)

At first I would like to thank both of you for advices,

 

Smercurio:

 

1. Yes excel could read it directly and it is in tabular form. For example values for roll are in one column. Values for acc x are in other column etc.

2. How to recognize each phase: It means that I have to recognize in the dependence of signal each phase of movement (Standing up,walking, turning ....) Which could be done for example this way: Standing up phase --> e.g. there is a steep rice in graph of roll for accelerometer on back. So I values overruns certain limit it has to be marked like begining of this phase.  Then follows walking phase which could be very easily seen on another graph for example pitch of waist.

 Generally it means that I have to choose 6 graphs (e.g. roll values for accelerometer on back which is represented by 13th column in the txt file, pitch values for accelerometer on calf which is represented by 14th column etc.) or less if it will be possible. Get them in one figure, each under the each and make a marks of each phases to all of them as I wrote upwards. Each phase (Because the movement of accelerometer had changed) is defined by rapid change in values and I need to detected them.

3. Calculate time of each phase: I know the total time of each attempt. But I need to calculate from that separations of phases how long each phase was.. For example standing up 1s, walking 3s etc.

 

I hope that I described the problem more properly now. I want to write the program by myself and I theoretically know how to do it, but I don´t know how to programming it, that´s the reason why asking you experts. I am totaly beginner user of Labview. Thank you again.

 

 

0 Kudos
Message 4 of 11
(5,020 Views)

OK. The first part, as mentioned, is being able to read the file into LabVIEW and just get some graphs so you can see what's going. This should be relatively easy. Since your file is tabular a Read From Spreadsheet File will read the file and give you a 2D array. You can wire the 2D array directly to a graph to display all of the columns. If you only want to graph and/or use specific columns then you can use Index Array to pick off the columns you want.

 

Do you have an example file that you can upload?

 

Also, have you gone through the LabVIEW tutorials and looked at some of the examples?

0 Kudos
Message 5 of 11
(5,002 Views)
Hello, I have tried to read data from spreadsheet, but graphs are relatively wrong. Yes I will uload  .zip file which includes calibrated data from accelerometer (Only axis for acceleration - acc_x,acc_y and acc_z; axis for angular velocity gyr_x, gyr_y and gyr_z and axis for magnetic field) and all data which includes calibrated data and data as row,pitch,roll etc.
0 Kudos
Message 6 of 11
(4,978 Views)

What doesn't look right? You data files contain some rows which are headers so these will need to be removed before you graph them. Also how you "massage" the data depends on whether you want to use a regular waveform graph or an XY graph. For the calibrated files a waveform graph seems most appropriate since there is no column to indicate an "X" value. For the non-calibrated files there is a "counter" column which you could use as X values, or you could simply toss out this column. This is what I get when I plot one of the calibrated data files ("MT_00323271_stehno.txt"):

 

 

 

Does that look right?

Message Edited by smercurio_fc on 05-02-2009 08:13 AM
Message Edited by smercurio_fc on 05-02-2009 08:13 AM
0 Kudos
Message 7 of 11
(4,958 Views)

I had one mistake in one block, but now it is ok.... I was still thinking about the whole problem and I tryed to found out solution of recognizing phases. I´ll try to describe it below. If it is ok, please could you give me advice how to construct it in labview?

 

Generally:

 

I looked at all graphs and decide to choose only data from 2 accelerometers positioned on back and calf.

 

1st. phase (Standing up): 

- load acc_x, acc_y and acc_z data from file ...zada.txt and make magnitude of vector. which is  acc=root(accx^2+accy^2+accz^2),show it in the graph

-make first derivation of acc vektor with changeable step of derivation,show it in another graph

-by clicking  on a mouse (if it is possible) in the graph (on curve) of derivation or the first one, make 2 marks and get value from axis X which belong to this mark
-by this clickes I will set the beginning of standing phase and the end of sitting phase

-show the values separately somewhere as x1 and x7

 

2nd phase (walking):

Very similar to 1st phase:

-load only acc_x, acc_y data from file ...lytko.txt and make magnitude of vector. which is  acc=root(accx^2+accy^2), show it in the graph

-make first derivation of acc vektor with changeable step of derivation,show it in the graph

-by clicking  on a mouse (if it is possible) in the graph (on the curve) of derivation make a mark and get value from axis X which belong to this mark
-by this click I will mark the beginning of standing phase

-show the value somewhere as x2

 

3rd phase (turning around):

this phase is detecetable only from yaw values in file ...zada.txt (same file as for first phase), but file manager which has proccesed data made the graph like on picture 1 but the real graph looks like on picture 2. I need to find the way how to make from picture 1 pucture2. On picture 2 I made a red mark approximately in points where 1(turning begins), 2(turning ends and starting 4th phase (Walking), 3(end of 4th phase, starting turning again - 5th phase), 4(ends turning and starts 6th phase (sitting).

-If it is possilbe to make 4 marks in one graph and get the values similary as in cases above

-show them somewhere as x3,x4,x5 and x6

 

 

calculation of time for each phase:

-If I will know the values x1,x2....x7 I can calculate time of each phase 

- sampling frequency was 120Hz

-Time of each phase is calculate like:

 

t1=(x2-x1)/120

t2=(x3-x2)/120

t3=(x4-x3)/120

t4=(x5-x4)/120

t5=(x6-x5)/120

t6=(x7-x6)/120

 

-and show the values of t1-t6 somewhere

 

 

Download All
0 Kudos
Message 8 of 11
(4,920 Views)
It is possible to do what you want. You can choose to either click on a graph and draw a mark or you could simply use cursors to move to a location and simply record that location. Using cursors is simpler, and I've attached a starting example showing the implementation for the 1st phase, which is getting X1 and X7. Is this kind of what you were thinking?
0 Kudos
Message 9 of 11
(4,897 Views)

Hello,

 

thank you very much, it is really amazing. It took me quite long time to orientate in it, as I said I am new user of this software. Anyway this code is great. I have tryed to finnish whole program, but have some problems. (Program in attachment)

 

1. In yaw graph - I couldn´t load the data properly. It is necesarry to load it from not calibrated file (MT_00323272_zada.txt). I tryed to load 14th column (YAW), but all values are zero.

2. How could I calculate and screen results of time?

t1=(x2-x1)/120

t2=(x3-x2)/120

t3=(x4-x3)/120

t4=(x5-x4)/120

t5=(x6-x5)/120

t6=(x7-x6)/120

 

3.I still don´t completely understand blocks,which are on the picture. Why there is subset array with Lenght (10), why mean and why mean is initial condition and also final condition

 

Download All
0 Kudos
Message 10 of 11
(4,886 Views)