10-24-2017 08:43 PM
I am trying to develop a vi for accelerometer to run. I want it to return 3 arrays. But, it returns only 1 value for each of the 3 axis. Can somebody please check my code?
10-24-2017
08:56 PM
- last edited on
10-09-2025
09:53 AM
by
Content Cleaner
There are many variations on the triaxial accelerometer (I'm working on some code for one, now, myself). Your accelerometer appears to be a Serial Device with some form of command structure (as you are using VISA). Mine, on the other hand, simply outputs three voltages -- the big issue with that is Calibration (how to transform Volts to g's).
NI has a Serial Instrument Control Tutorial that you can find on the Web. Look at the manual for your accelerometer (if you want more help from us, you'll need to tell us the make and model so we can also look up the manual). Note that one almost never uses "Bytes at Port" with VISA Reads -- the "preferred" way is to understand if (and how) the VISA message is "terminated" (configured when you open the VISA Port). You ask for, say, 1000 bytes, having set VISA to terminate the Read on the Termination Character (typically 0x0A, <LF>), so you get a single line of text. But check your manual ...
Bob Schor
10-24-2017 09:12 PM
Thank you for your reply. I am using ADXL335 accelerometer. When I run using the bulb on, I can see the error occuring in READ visa. I am trying to understand why?
10-24-2017 10:12 PM
@bufferlab wrote:
Thank you for your reply. I am using ADXL335 accelerometer. When I run using the bulb on, I can see the error occuring in READ visa. I am trying to understand why?
What error? Hard to help you solve an error without knowing what it is, such as an error number and a description.
10-24-2017 10:50 PM
Well, I think we might be using the same accelerometer! The ADXL335 generates analog voltages corresponding to the accelerations in the X, Y, and Z axes (defined with reference to the Accelerometer Chip), and requires 3v power, so needs 5 wires. Calibration is an issue! In a LabVIEW environment, I recommend something like the USB 6009 (or its successor, the USB 6002) which allows 3 channels of A/D sampling to give you X, Y, and Z voltages that you can convert to accelerations (did I mention you need to calibrate this beast?).
It is not at all clear why you are using VISA with this gadget.
Bob Schor
10-25-2017 09:51 AM - edited 10-25-2017 10:08 AM
I am trying to make driver for my accelerometer which is 6 wired ADXL335. Now my problem is when ever I am trying to say run the accelerometer by giving for example no of points N= 4, the it should show the out put in the array as follows.
x=206.9 y=2.06 z=1.633
x=150.6 y=1.57 z=1.54
x=180.9 y=3.03 z=1.34
or it should be
x=206.9 150.6 180.9
y=2.06 1.57 3.03
z=1.633 1.54 1.34
That means each time when my loop runs based on N, it should add x,y,z value to the array
I used "for loop" for it. But now my problem is the array is showing as follows
How can I append the array or how can I make it look I want it to be?
10-25-2017 10:04 AM - edited 10-25-2017 10:05 AM
10-26-2017 08:43 AM
I'm still confused how you are using the Analog Devices Triaxial Accelerometer chip, which outputs voltages, and yet are doing serial reads to get the data (maybe there is an Arduino in the circuit that you are not telling us about?).
However, it seems to me that your real question is "What is a good way of acquiring and managing data from a Triaxial Accelerometer?". Having done this myself, I have some suggestions:
Bob Schor