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

Pin Purpose Details
5V 5 Volt Line Use this on a 5 Volt Device
3V3 3.3 Volt Line Use this on a 3.3 Volt Device
GND Common ground
GS Precision Select High for 1.5G and Low for 6G
ST Self Test
X The X Axis Analog value representing the force on the X Axis
Y The Y Axis Analog value representing the force on the Y Axis
Z The Z Axis Analog value representing the force on the Z Axis
SL Sleep Must be high for part to work
0G Free Fall Detection


Measurements are in inches.


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()

  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);


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


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

Converting Analog readings to G-Forces & Meters Per Second-Squared This 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()

 //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

void loop()
for readability
 the values of your accelerometer;
 Serial.println("The Accelerometer reads X, Y, Z");
Serial.print(" Gs, ");
 Serial.print(" Gs, and ");
 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
  • 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.


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