fbpx

Interface Accelerometer with Arduino Uno

An accelerometer is a device that measures proper acceleration.

  • Accelerometers have multiple applications in industry and science.
  • Single- and multi-axis models of accelerometer are available to detect magnitude and direction of the proper acceleration.
  • Used to sense orientation, coordinate acceleration, vibration, shock, and falling in a resistive medium.
  • Accelerometer electronic devices and video game controllers,to detect the position of the device or provide for game input.
  • So that images on screens are always displayed upright.
  • Accelerometers are available that can measure acceleration in one, two, or three orthogonal axes.
  • They are typically used in one of three modes:
    1. As an intertial measurement of velocity and position;
    2.As a sensor of inclination, tilt, or orientation in 2 or 3 dimensions, as referenced from the acceleration of gravity (1 g = 9.8m/s2);
    3.As a vibration or impact (shock) sensor.

Application

  • SmartPhone

Hardware Required

  • AcceleroMeter.
  • Arduino.

Pinout

  • Vcc: +5v.
  • Gnd: Gnd.
  • x: x axis (analog).
  • y: y axis (analog).
  • z: z axis (analog).

Circuit

Code

 const int xpin = A3;
 const int ypin = A2;
 const int zpin = A1;
 void setup()
 {
 Serial.begin(9600);
 pinMode(A0,OUTPUT);
 pinMode(A1,OUTPUT);
 pinMode(A5,OUTPUT);
 digitalWrite(A0,HIGH);
 digitalWrite(A1,LOW);
 digitalWrite(A5,LOW);
 }
 void loop()
 {
 Serial.print("X-axis");
 Serial.print(analogRead(xpin));
 Serial.print("\t");
 Serial.print("Y-axis");
 Serial.print(analogRead(ypin));
 Serial.print("\t");
 Serial.print("Z-axis");
 Serial.print(analogRead(zpin));
 Serial.println();
 delay(100);
 } 

Leave a Reply

Your email address will not be published. Required fields are marked *