Computers, Development Boards & Shields
Educational & Robotics Kits
Electronic Sensors
Motors & Controllers
Communication & Display
Electronic Components
Soldering & Lab Tools

Virtuabotix 3 Axis Accelerometer Pinout and coding guide

Pin-out & Circuit Integration

PinPurposeDetails
5V5 Volt LineUse this on a 5 Volt Device
3V33.3 Volt LineUse this on a 3.3 Volt Device
GNDCommon ground
GSPrecision SelectHigh for 1.5G and Low for 6G
STSelf Test
XThe X AxisAnalog value representing the force on the X Axis
YThe Y AxisAnalog value representing the force on the Y Axis
ZThe Z AxisAnalog value representing the force on the Z Axis
SLSleepMust be high for part to work
0GFree Fall Detection

MMA7361_pin-out[1]

Measurements are in inches.

MMA7361_spacing[1]

Versalino™ Libraries & Projects

Simplest Possible Code

If you are not a fan of Arduino Libraries, and you don’t need all the features you can just use this simple code to read out analog values from your 3 Axis Accelerometer. (the full project can be downloaded from here) If you however would like to actually get calibrated values you should use the library, or follow the deatailed guide found here GForce conversion guide

int sleepPin= 4; //Turning sleep high turns on the Accelerometer
int xpin= A0;
int ypin = A1;
int zpin = A2;

void setup()
{
  Serial.begin(9600);
  
  pinMode(sleepPin,OUTPUT);
  digitalWrite(sleepPin, HIGH);//turns off sleep mode and activates device
  
  pinMode(xpin, INPUT);//input mode
  digitalWrite(xpin, HIGH);//turn on pull up resistor
  
  pinMode(ypin, INPUT);//input mode
  digitalWrite(ypin, HIGH);//turn on pull up resistor
  
  pinMode(zpin, INPUT);//input mode
  digitalWrite(zpin, HIGH);//turn on pull up resistor
}

void loop()
{
delay(2000); //Delay for readability
Serial.print("X Reading: "); 
Serial.println(analogRead(xpin), DEC);
Serial.print("Y Reading: "); 
Serial.println(analogRead(ypin), DEC);
Serial.print("Z Reading: "); 
Serial.println(analogRead(zpin), DEC);
}

Libraries

Library icon.pngAccelerometer Sensor Library A library that provides general Accelerometer calibration and measurement to force translations.

Guides

Basic starting code is available, and is a great starting point for working with Accelerometer readouts. Getting Started Code

package-image-prepped-small-for-wp-100x75.jpg
Converting Analog readings to G-Forces & Meters Per Second-SquaredThis guide is a walkthrough of the process that was used to calculate the values required for our Auto-Calibration feature in the Accelerometer Library. Great guide for anyone who is curious about what is really going on with their Accelerometer’s raw readings.

The Library In Action

User Experience

An example of Accelerometer Calibration and display using this library

#include "Accelerometer.h"

Accelerometer myAccelerometer = Accelerometer();

void setup()
{
  Serial.begin(9600);

  //Connect up the following pins and your power rail
  //                    SL GS 0G   X  Y  Z
  myAccelerometer.begin(3, 4, 5, A0, A1, A2);

//calibration performed below
Serial.println("Please place the Accelerometer on a flatnLevel surface");
delay(2000);//Give user 2 seconds to comply
myAccelerometer.calibrate();
}

void loop()
{
  delay(2000);//delay for readability
  //reads the values of your accelerometer
  myAccelerometer.read();
  Serial.println("The Accelerometer reads X, Y, Z");
  Serial.print(myAccelerometer._Xgs);
  Serial.print(" Gs, ");
  Serial.print(myAccelerometer._Ygs);
  Serial.print(" Gs, and ");
  Serial.print(myAccelerometer._Zgs);
  Serial.println(" Gs respectively.");
}

Hardware Compatibility

Hardware Compatibility

  • Versalino Uno VERIFIED
  • Versalino Nano VERIFIED
  • Arduino Uno/Duemilanove VERIFIED
  • Arduino Mega 1280/2560 VERIFIED
  • Arduino Leonardo VERIFIED
  • MMA7361 VERIFIED
  • Virtuabotix Three Axis Accelerometer VERIFIED

Compatibility Issues

If you are aware of a platform that this library does not work with please add it to the list with as much detail as possible.

Features

Current Features

  • Automatic calibration function
  • unit conversion from GForce to Meters per Second
  • built in power up sequence
  • Arduino IDE 1.0 compatible

Suggested Features

Feel free to add any feature suggestions, or concerns.

Library Version History

Joseph Dattilo (Virtuabotix LLC) − Version 1S0B (09/20/12)
−Fixed bug in autoCalibration.ino where Serial.begin was not called.
Joseph Dattilo (Virtuabotix LLC) − Version 1S0A (07/30/12)
−Wrote entire library from ground up
No comments yet.

Leave a Reply