LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Program 3-axis accelerometer to measure tilt

Hi there,

 

I'm currently looking for a bit of an idea as to how to start my mini-project. I have limited experience with LabVIEW - I've only done a few tutorials (i.e. bear with me!)

 

I need to program using DAQ assistant, a 3-axis accelerometer for the following use:

 

1. Calibrate at horizontal (ideal scenario x, y, z all equal 0)

2. To input a maximum tilt angle (approx 12 to 28 degrees) using a keypad and display the inputted value on an LCD screen (like calculator).

3. Get LEDs to light at this angle.

4. Reset. Calibrate [restart].

 

Sorry this is quite specific, any ideas as to how to start my programming would be really appreciated.

I can specify parts if needed.

 

Thanks

0 Kudos
Message 1 of 2
(4,365 Views)

First, you won't calibrate the accelerometer to 0,0,0.  This can only be done in space...  Here we have gravity, so the vertical axis will be 1 g.  If your accelerometer doesn't measure gravity, you won't be able to do this.  Some accelerometers ignore steady state values and only give AC values.  You can verify that your accelerometer measures gravity by flipping it over.  The signal should change signs with about the same magnitude.  You can also tip the accelerometer onto different sides.  The side that is down will alway measure gravity.

 

If Z is the vertical axis, you can measure the angle of rotation using geometry.  Or is it trigonometry?  If theta is the angle of rotation around the X axis,  Z measurement = G cos(theta), Y measurement = G sin(theta).  G is gravity.  Take the ratio and you get Y/Z = tan(theta).  You can calculate theta using inv tangent.

 

If you can tip it in any direction, the math gets a little more complicated.  The simplest way to do it is calculate a new value, R = sqrt(X^2 + Y^2), then use R in place of the Y measurement in the previous equation.  X and Y are measurements, of course.

 

This should allow you to calculate the tip angle.  I will leave the details to you.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 2
(4,341 Views)