Sunday, March 4, 2012

Using the MMA7361 Accelerometer with the Arduino UNO 3: (Part II)

I left off with a good start on reading and interpreting the accelerometer values. This was not working as well as I had hoped, so I did a little more searching the web and came across a few sources:

  1. http://www.starlino.com/imu_guide.html
  2. http://code.google.com/p/mma7361-library/
  3. http://www.freescale.com/files/sensors/doc/data_sheet/MMA7361L.pdf
These three links provided lots of insightful information. I used that to update my code. I still am not positive everything is working right. I wrote a little visualization routine that will hook up the serial output of the accelerometer and visualize the data coming back plus the orientation. An example is shown below.


This shows that the values are close to one when the dominant axis is pointed down (or -1 if oriented in the other direction). However, the values are not quite zero when sitting still. Clearly a better calibration routine is needed to correct for these slight errors. In these plots, red is the x axis, green is the y access and blue is the z axis. The noise in the output can also been seen in the values along the bottom. However, at least I am convinced that the numbers are in the right ballpark. However, until I have formulated a dynamics model the scaling and calibration is not as high a priority.

I will next switch and repeat the process for a magnetometer. Hopefully this will be fairly easy as most of the work in dealing with accelerometer was setting up infrastructure. I also ordered a small robot kit. When that arrives I will start playing around with wheel encoders and simple navigation using dead reckoning.

No comments:

Post a Comment