Jump to content

Accelerometer output to labview, display as graph


frankcase

Recommended Posts

Hi,

I own a SerAccel v5 Enclosed is a 3 axis accelerometer. Its uses a rs232 communication protocol and I would like to graph the real time output of this sensor using labview. My project involves using the accelerometer to help rowing training on a rowing erogmeter.

http://www.sparkfun.com/datasheets/Acceler...SerAccel-v5.pdf

I can communicate with the device by hyperterminal but now I need to use labview to save the data and also graph the output of the sensor as a function of time.

http://www.sparkfun.com/cgi-bin/phpbb/view...t=accelerometer

I am attaching the accelerometer to a concept2 rowing ergometer seat to record the acceleration profile of 1 full rowing stroke. I then want to graph the acceleration output as a function of time

http://www.concept2.com/05/rower/flash_presentation.asp

Here is an example of the typical output of the accelerometer

X= 0.676 Y=-0.313 Z= 0.754

X= 0.679 Y=-0.326 Z= 0.744

X= 0.676 Y=-0.331 Z= 0.722

X= 0.686 Y=-0.336 Z= 0.725

X= 0.676 Y=-0.339 Z= 0.744

X= 0.691 Y=-0.328 Z= 0.744

X= 0.686 Y=-0.326 Z= 0.706

X= 0.686 Y=-0.339 Z= 0.744

X= 0.686 Y=-0.339 Z= 0.752

X= 0.684 Y=-0.336 Z= 0.744

X= 0.691 Y=-0.326 Z= 0.754

X= 0.691 Y=-0.342 Z= 0.752

X= 0.686 Y=-0.321 Z= 0.744

X= 0.686 Y=-0.318 Z= 0.765

X= 0.686 Y=-0.326 Z= 0.744

X= 0.691 Y=-0.318 Z= 0.722

X= 0.676 Y=-0.328 Z= 0.744

I am including some labview vis which kind of achieve my goals. Two parts of the vi can take the output of the accelerometer and display it in realtime. The graphing part of the VI is a problem for me and I need help with it.

I would also like to save all the real time out of the sensor so I could use it in excel for further analysis.

Any help/advice suggestions would be greatly appreciated.

Frank

Download File:post-4382-1141877665.vi

Link to post

I haven't done 3-axis accelerometer daq and graphing but I have done 2-axis. It was a custom circuit using an inexpensive AD ic which went into an A/D circuit which went into the computer through rs232.

Save that vi in v7.0 for me so I can see what you have so far.

Do you want to display all 3-axis in a 3D chart or just line chart each axis as a 2D line chart?

With my plotter/data logger I simply displayed the data in an XY plot and used some history to plot the a trail of points. If you ever saw the "G-meter" in a Nissan Skyline GTR it looked just like it. Only it was displayed on a much larger screen (16" laptop). In parallel there was a loop that would monitor the "log to disk" button and when "on" it would simply write to a file in spreadsheet format.

Link to post
I haven't done 3-axis accelerometer daq and graphing but I have done 2-axis. It was a custom circuit using an inexpensive AD ic which went into an A/D circuit which went into the computer through rs232.

Save that vi in v7.0 for me so I can see what you have so far.

Do you want to display all 3-axis in a 3D chart or just line chart each axis as a 2D line chart?

With my plotter/data logger I simply displayed the data in an XY plot and used some history to plot the a trail of points. If you ever saw the "G-meter" in a Nissan Skyline GTR it looked just like it. Only it was displayed on a much larger screen (16" laptop). In parallel there was a loop that would monitor the "log to disk" button and when "on" it would simply write to a file in spreadsheet format.

Hi,

I am a total newbie to labview and I am getting errors trying to save the file to version 7. I really only have some vi's that I obtained from different sources.

http://sthmac.magnet.fsu.edu/labview/vi_library.html has a file called serial terminal and this graphing VI.

http://forums.ni.com/attachments/ni/170/153176/1/test41.vi

I would like to have all the properties of hyperterminal so I could press ctrl+s to edit accelerometer parameters as well. A 2d chart for the x axis at the moment would be great and your vi seems to do the majority of what I need. The ability to select which axis to display (X, Y or Z) would be very useful as well but recording all the infromation at the same time.

Thanks for the help.

Noel

Link to post

Hi,

I can obtain the data in labview using labiew but I am not sure if the the sampling of the data is close to the sampling rate of the sensor. 200Hz. The event I am trying to measure is 4 seconds and I would like to have 10-50Hz sampling rate. I want to examine the acceleration over a short period of time.

hope you can with and my other question

Link to post

I have a serial terminal that reads my data in the following format.

X=-0.020 Y= 0.026 Z= 1.160

X=-0.007 Y= 0.015 Z= 1.144

X=-0.007 Y= 0.020 Z= 1.160

X=-0.010 Y= 0.015 Z= 1.160

X=-0.012 Y= 0.015 Z= 1.170

How do I get this to graph on X versus time plot? Please help I usually work with excel macros and I am not familar with labview

Download File:post-4382-1142130604.llb

Link to post
Try this to parse out the data from each line:

post-181-1142265379.jpg?width=400

Thanks for the info and I shall try working on what you gave me later. I just thought I let people know that NI have already developed VI for this type of sensor at the following link. I been searching long and hard trying to up my knowledge of labview

http://zone.ni.com/devzone/conceptd.nsf/we...625706d0061889e

So my goal of getting the real time output from the sensor and plotting it in realtime has already been achieved by other capable NI users! So hopefully I can sort this out soon.

Thanks again.

Frank

Link to post
Thanks for the info and I shall try working on what you gave me later. I just thought I let people know that NI have already developed VI for this type of sensor at the following link. I been searching long and hard trying to up my knowledge of labview

http://zone.ni.com/devzone/conceptd.nsf/we...625706d0061889e

So my goal of getting the real time output from the sensor and plotting it in realtime has already been achieved by other capable NI users! So hopefully I can sort this out soon.

Thanks again.

Frank

Thanks to crelf for putting the parsing one line of my data type vi on the forum. I have been trying to see how to integrate that part of the vi into my serial terminal vi and I keep getting errors.

The terminal will write data 25 point per second the parsing part needs to read the output of the terminal, parse it in the right format and plot it again no. of point (which represents time per point). The serial terminal is being constantly updated so how do i get the parsing vi to do that! After this project I am going to to get the labview for dummies book that must be out there and start off with a easier project. But I have to get this done for a volunteer rowing project so if anybody can help again, I would really appreciate it.

Frank.

Link to post

For an easy, general way to parse the numbers from each line, look in:

..\LabVIEW\examples\general\strings.llb\Extract Numbers.vi

Feed it a string and it will give you back an array with the numbers. So you can send it one line at a time. Easy.

Link to post
For an easy, general way to parse the numbers from each line, look in:

..\LabVIEW\examples\general\strings.llb\Extract Numbers.vi

Feed it a string and it will give you back an array with the numbers. So you can send it one line at a time. Easy.

Cool Michael,

Thanks for the direction to parsing file but how do I tried connect the string output of the extract vi to the graphing vi that Crelf put on the forum. I keep getting wiring errors when I try to link the two together. I also get wiring errors when I try to connect the serial terminal response box that supplies the real time data from the sensor to the extract vi.

How would i successfully wire these vis together?

Frank

post-4382-1142486955.jpg?width=400

Link to post

In brief, without reworking the whole thing, you need to replace all the stuff in the oval with the Extract Numbers.vi using it as a subVI, not cut-n-paste of it's diagram. Move the chart up into the loop. Feed the string from your latest line in the String Server read into Extract Numbers.vi, take the output array from Extract Numbers.vi and put it into an Array to Cluster conversion node and then into the Chart.

post-45-1142561036.jpg?width=400

The coffee was good this morning...

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.