Skip navigation

Community

Currently Being Moderated

myDaq two axis accelerometer and attitude measurement with adi from UTSI.zip

VERSION 4 
Created on: Aug 26, 2010 12:13 PM by jmurator - Last Modified:  Feb 11, 2013 11:50 AM by Tommy_G

Overview

The attached example code uses a NI myDAQ and a multi-axis accelerometer to determine pitch and roll attitudes.

 

 

Description

The MX2125 accelerometer uses a simple design premise to perform static acceleration measurements that can be converted to a pitch or roll angle.  The accelerometer "has a chamber of gas with a heating element in the center and four temperature sensors around its edge.  Just as hot air rises and cooler air sinks, the same applies to hot and cool gasses.  If you hold the accelerometer still, all it senses is gravity, and tilting it gives us an example of how it senses static acceleration.  When you hold the accelerometer level, the hot gas pocket...rises to the top-center of the accelerometer's chamber, and all the temperature sensors measure the same temperature.  Depending on how you tilt the accelerometer, the hot gas will collect closer to one or maybe two of the temperature sensors."  This sensed acceleration can then be converted to a pitch or roll angle via basic trigonometric functions, using known gravitational acceleration. The accelerometer works by generating a pulse train where the duty cycle of the pulse is proportional to the acceleration.

 

 

Steps to Implement or Execute Code

  1. Install the accelerometer on the protoboard and wire per the diagram in the pdf file within the Zip folder. Be especially careful to place the accelerometer so that the x-axis is pointing down the long axis of the protoboard
  2. Build a VI to acquire multiple channels at multiple samples a second using the DAQ clock. Start by creating a channel and entering in timing controls
  3. Then create a while loop with the read in it. Extract data from the array into the two channels using the index array function from the array palette. Plot both on a waveform graph and configure the VI parameters per the attached front panel which is included in the Zip folder.
  4. Run the VI. You should see two data streams with pulse width modulated data streams. The pulse width should increase as you pitch the protoboard up or roll the right. It should also change size as you slide the protoboard along the lab desk in the directions of the y-axis and x-axis. You may have to adjust the number of points displayed on the waveform graph to be able to see the size change. You can do this by clicking on the x-scale and right-clicking. Then on the x-scale submenu, disable autoscaling. Use the number of samples/channel and sample rate as in the front panel
  5. Now we need to turn the pulse widths into readings of g and angle. The ADI SubVI.vi implements this conversion
  6. Enter the necessary inputs into the front panel of the VI, be sure to set the proper Physical Channels for your NI myDAQ device. 
  7. Run the code and observed the measured Pitch Angle as you tilt the mounted accelerometer in various directions

 

 

Requirements to Run

Software

LabVIEW 9.0 or Later

 

Hardware

NI myDAQ

Memsic 2125 Accelerometer

Protoboard

10 µF Capacitor

7805 +5V Fixed-Voltage Regulator

Comments (0)

Bookmarked By (0)

More Like This

  • Retrieving data ...