Measuring Acceleration, Tilt, Rotation and Vibration with Arduino

           Acceloremeter MEMSIC 2125 is used to review the measure acceleration, tilt, rotation and combined quantity BY Jatropha + - 3 g. 2125 MEMSIC accelerometer is electrically compatible WITH Another popular. MEMSIC SUPPLY I / O to review Connection To breadboard prototype through holes WITH Easy.

Schematic WITH THE Arduino can Judging the image below:

Schematic with arduino

Schematic with arduino






Coding :

// Free Tutorial Arduino
// www.ioisalman.com
/*
   Memsic2125
 * Pin-pin Address
    * X output of accelerometer to digital pin 2
    * Y output of accelerometer to digital pin 3
    * +V of accelerometer to +5V
    * GND of accelerometer to ground
 */
 
const int xPin = 2;     // X output of the accelerometer
const int yPin = 3;     // Y output of the accelerometer

void setup() {
  Serial.begin(9600);
  pinMode(xPin, INPUT);
  pinMode(yPin, INPUT);
}

void loop() {
  int pulseX, pulseY;
  int accelerationX, accelerationY;

  pulseX = pulseIn(xPin, HIGH);
  pulseY = pulseIn(yPin, HIGH);

  accelerationX = ((pulseX / 10) - 500) * 8;
  accelerationY = ((pulseY / 10) - 500) * 8;

  Serial.print(accelerationX);
  Serial.print("\t");
  Serial.print(accelerationY);
  Serial.println();

  delay(100);
}

Subscribe to receive free email updates:

0 Response to "Measuring Acceleration, Tilt, Rotation and Vibration with Arduino"

Post a Comment