LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

accelerometer Data acquisition

Hello!

I have a problem with my accelerometer data acquisition, I use an ADXL203EB 2 axis accelerometer, when connecting it to myDAQ, I used the one simple (on demand) acquisition mode, and I wonder how to control the acquisition rate with this method. I tried continuous samples with the sampling rate that I wanted 100Hz but the results comes too odd!

Thank you for your help in advance!

 

Ali

0 Kudos
Message 1 of 10
(2,780 Views)

Please share the VI in LV 2016 format.

 

A quick search revealed that ADXL203 is a 2-axis analog output accelerometer, this makes things quite simple in terms of interfacing with DAQ. You have not mentioned the DAQ you're using and how you've wired things up.

 

I would recommend connecting the Y and Z axis to Analog Input channels of DAQ and use either Voltage - Continuous Input or Finite Input example

santo_13_0-1632171749775.png

 

The important configuration is to specify both the analog input channels as comma-separated in "Physical Channel" control.

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 10
(2,753 Views)

Thank you very much for your help, the DAQ that I'm using is a NI myDAQ, about the connection, it's well connected to analogue input channel ai0, the interface that I have for Labview v2020 isn't quite similar for your interface, as a choice, I have 4 choices for acquisition mode: 1 sample(on demand), 1 sample(HW timed), N samples, and continuous samples. when using the 1 sample on demand, it gives me a good result but I want to increase the sampling, where it comes to my question above.

Please find attached the file in 2016 Labview version

Cordially

Ali

0 Kudos
Message 3 of 10
(2,746 Views)

I would advise against using DAQ assistant and go with DAQmx drivers instead

santo_13_1-1632178559688.png

 

Please use the example shown below from Help > Find Examples...

santo_13_2-1632178664372.png

 

DAQ Assistant is like training wheels on a bicycle, it allows you to ride the bicycle and not do high-performance manoeuvres. Whereas DAQmx driver is the bicycle itself, once you learn it, it is up to you to decide how you want to use the instrument.

 

DAQ Assistant is easy to get started but won't take you far enough if the requirement quickly escalates. This is a great article to understand DAQmx for beginners - https://www.ni.com/en-us/support/documentation/supplemental/06/learn-10-functions-in-ni-daqmx-and-ha...

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 4 of 10
(2,734 Views)

I hope you are not a student taking a class where you are exposed to (and expected to learn) LabVIEW.  However, you have access to a myDAQ, which I presume you purchased (for a course) or were provided by your school.

 

Here is the first Rule in learning how to acquire data from almost any device using LabVIEW -- plug it into your PC, start up MAX (the Measurement and Automation EXplorer).  In the left-hand pane, click on Devices and Interfaces, find your Device (your myDAQ), expand it, and find the sub-system you want to "explore" (such as A/D 0).  [I don't have a myDAQ currently connected, so I can't tell you exactly how the input is named].

 

Now look over at the right pane, and click on Test Panels.  This will let you set up the Input (or "reading") channel or Output (or "writing") channel you have chosen.

 

At this point, you need to know something about the system you are measuring.  In your case, you have a 2-axis Accelerometer that is designed to run off a 5V supply (which I believe the myDAQ can supply) and measure (relatively static) accelerations in the range of ±1g (it will actually go to 1.7g, but it is designed to record static tilt in a 1g gravitational field, similar to what you find in your classroom more or less at the Earth's surface.

 

In most (>95%) of the cases where you take measurements, you take multiple measurements, as you are (usually) interested in how whatever you are measuring changes as a function of time.  In the case of your 2-axis accelerometer, if you read the specification for the chip, you'll know that when it is flat on the table, the X and Y outputs will be near 0.  Now suppose you hold it in the palm of your hand, and tilt your hand right and left 10°.  Depending on how you have the X and Y axes oriented with respect to your arm, the X or Y voltage should show a "wiggle".  If you now raise and lower your arm (tilting the perpendicular axis), the other voltage should vary.

 

So what do you learn if you take a single sample?  You learn the position of the Accelerometer at an "isolated" instance in time.  What do you learn if, for example, you sample continuously (and display the data) at 50 Hz?  You not only see the position, but can see how it changes as a function of time.

 

To get this more "interesting" view, set your Sampling to 50 Hz, continuous samples, and take, say, 100 points at a time.  If you set MAX up to do this and start the Test Panel, you should see two (possibly time-varying) voltages displayed.  Pick up the sensor, put it in your palm, rotate your wrist, end your elbow, see the X and Y axes change.

 

Now do a Web Search for "Learn 10 Functions in N-DAQmx and Handle 80 Percent of your Data Acquisition Applications".  Ignore the early section that talks about the Dreaded DAQ Assistant -- Do Not Use the DAQ Assistant!  Learn how to use LabVIEW, instead.

 

Bob Schor

0 Kudos
Message 5 of 10
(2,716 Views)

Thank you very much for all the time that you took to help, it's very appreciated, and thanks for the advice I will take it and try if it will work!!

Best regards,

Ali

0 Kudos
Message 6 of 10
(2,710 Views)

Thanks for your time and all the explanation, in fact, yes I am a student, and I am not ashamed of asking questions, it's like that how we learn. As a resume, I know all the information that you told, thanks very much, and I had even got good results for my Y axis displacement,  the problem is that I am not satisfied with the result, I want more sampling with the used 1 sample (on demand) option of data acquisition of the myDAQ, because it gave me a good approximate result. And like I said before, I tried continuous sampling with a sampling frequency of 100 Hz but it didn't give me good results at all!

Thank you more time for your help!

Best regards,

Ali

 

0 Kudos
Message 7 of 10
(2,704 Views)

Hi Ali,

 


@awadaali wrote:

I want more sampling with the used 1 sample (on demand) option of data acquisition of the myDAQ, because it gave me a good approximate result. 

I tried continuous sampling with a sampling frequency of 100 Hz but it didn't give me good results at all!


Some thoughts on your sentences:

  • Please define "good approximate result" and "didn't give good results"! Why is an "approximate" result considered as "good result"?
  • Using "1 sample on demand" is only useful for requesting single samples at larger intervals. For anything "useful" at higher samplerates you should use DAQmxTiming to set a samplerate with the "continuous" sampling mode!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 10
(2,694 Views)

@santo_13 wrote:

 

DAQ Assistant is like training wheels on a bicycle, it allows you to ride the bicycle and not do high-performance manoeuvres. Whereas DAQmx driver is the bicycle itself, once you learn it, it is up to you to decide how you want to use the instrument.


++ for that

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 9 of 10
(2,668 Views)

These MEMS sensors output some sort of PWM and have a RC lowpass at the output IIRC...

 

I strongly recommend to sample with 10kSPS , look at it and do a FFT on the signal. You might find some 'funny' peaks.

Followed by the most important part in signal processing: apply a (software) low pass filter 😄 

(If one processing is superior to another, it's because of a higher time constant in the low pass filter 😉 )

 

If one channel behave wiered .. can you try another MEMS board?   And inspect the board with a lens ..  solder drops , cracks , broken cable ....

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 10 of 10
(2,642 Views)