Tutorial.Memsic2125 History

Show minor edits - Show changes to markup

May 02, 2012, at 04:04 PM by Scott Fitzgerald -
Changed line 40 from:
to:
November 16, 2011, at 04:19 AM by Scott Fitzgerald -
Changed line 40 from:
to:
September 23, 2010, at 10:42 PM by Christian Cerrito -
Changed lines 3-4 from:

Memsic 2125 Accelerometer

to:

Memsic 2125 Accelerometer

September 21, 2010, at 08:25 AM by Christian Cerrito -
Changed line 7 from:
to:
Changed lines 14-15 from:
to:
September 19, 2010, at 10:08 PM by Christian Cerrito -
Changed lines 1-2 from:

"Examples > Sensors"

to:

Examples > Sensors

September 19, 2010, at 10:08 PM by Christian Cerrito -
Added lines 1-2:

"Examples > Sensors"

September 19, 2010, at 07:06 PM by Christian Cerrito -
Deleted lines 14-15:

click the image to enlarge

Added lines 21-22:

click the image to enlarge

September 19, 2010, at 07:04 PM by Christian Cerrito -
Added lines 15-16:

click the image to enlarge

September 19, 2010, at 07:03 PM by Christian Cerrito -
Changed lines 3-5 from:

The Memsic 2125 (datasheet) is a two-axis accelerometer capable of measuring acceleration up to plus or minus 2g. It has a simple digital interface: two pins (one for each axis) emit pulses whose duration corresponds to the acceleration of that axis. By measuring the length of that pulse, in microseconds, using the Arduino's pulseIn() function, it is possible to determine the rate of acceleration and to use that data.

to:

The Memsic 2125 (datasheet) is a two-axis accelerometer capable of measuring acceleration up to plus or minus 2g. It has a simple digital interface: two pins (one for each axis) emit pulses whose duration corresponds to the acceleration of that axis. By measuring the length of that pulse, in microseconds, using the Arduino's pulseIn() function, it is possible to determine the rate of acceleration and to use that data for your purposes.

September 19, 2010, at 07:02 PM by Christian Cerrito -
Changed lines 3-5 from:

The Memsic 2125 (datasheet) is a two-axis accelerometer capable of measuring acceleration up to plus or minus 2g. It has a simple digital interface: two pins (one for each axis) emit pulses whose duration corresponds to the acceleration of that axis. By measuring the length of that pulse, in microseconds, using the Arduino's pulseIn()? function, it is possible to determine the rate of acceleration and to use that data.

to:

The Memsic 2125 (datasheet) is a two-axis accelerometer capable of measuring acceleration up to plus or minus 2g. It has a simple digital interface: two pins (one for each axis) emit pulses whose duration corresponds to the acceleration of that axis. By measuring the length of that pulse, in microseconds, using the Arduino's pulseIn() function, it is possible to determine the rate of acceleration and to use that data.

September 19, 2010, at 07:01 PM by Christian Cerrito -
Changed lines 17-18 from:

Connect the 5V and GND pins of the Memsic 2125 to the power and ground ports on the Arduino. Connect digital pin 2 of the Arduino to the X out pin of the Memsic, and digital pin 3 to the Y out pin.

to:

Use the small triangle on the Memsic to properly orient the sensor on your breadboard. Connect the 5V and GND pins of the Memsic 2125 to the power and ground ports on the Arduino. Connect digital pin 2 of the Arduino to the X out pin of the accelerometer, and digital pin 3 to the Y out pin.

Your Arduino must be connected to your computer in order for it to transmit serial data.

September 19, 2010, at 06:58 PM by Christian Cerrito -
Changed lines 3-5 from:

The Memsic 2125 (datasheet) is a two-axis accelerometer capable of measuring acceleration up to plus or minus 2g. It has a simple digital interface: two pins (one for each axis) emit pulses whose duration corresponds to the acceleration of that axis.

to:

The Memsic 2125 (datasheet) is a two-axis accelerometer capable of measuring acceleration up to plus or minus 2g. It has a simple digital interface: two pins (one for each axis) emit pulses whose duration corresponds to the acceleration of that axis. By measuring the length of that pulse, in microseconds, using the Arduino's pulseIn()? function, it is possible to determine the rate of acceleration and to use that data.

Changed lines 17-18 from:

The 5V pin and GND pins on the Arduino are connected to the 5V and GND pins of the Memsic 2125; digital pin 2 of the Arduino is connected to the X out pin of the Memsic, and digital pin 3 is connected to the Y out pin.''

to:

Connect the 5V and GND pins of the Memsic 2125 to the power and ground ports on the Arduino. Connect digital pin 2 of the Arduino to the X out pin of the Memsic, and digital pin 3 to the Y out pin.

September 19, 2010, at 06:50 PM by Christian Cerrito -
Added lines 36-47:

See Also:

September 19, 2010, at 08:46 AM by Christian Cerrito -
Changed lines 15-16 from:
to:
September 19, 2010, at 08:45 AM by Christian Cerrito -
Changed lines 15-16 from:
to:
September 19, 2010, at 08:44 AM by Christian Cerrito -
Added lines 15-16:
September 19, 2010, at 08:26 AM by Christian Cerrito -
Added lines 19-20:

image developed using Fritzing. For more circuit examples, see the Fritzing project page

September 19, 2010, at 08:19 AM by Christian Cerrito -
Added lines 15-16:

The 5V pin and GND pins on the Arduino are connected to the 5V and GND pins of the Memsic 2125; digital pin 2 of the Arduino is connected to the X out pin of the Memsic, and digital pin 3 is connected to the Y out pin.''

Deleted lines 24-27:

The 5V pin and GND pins on the Arduino are connected to the 5V and GND pins of the Memsic 2125; digital pin 2 of the Arduino is connected to the X out pin of the Memsic, and digital pin 3 is connected to the Y out pin.

September 19, 2010, at 08:16 AM by Christian Cerrito -
Added lines 5-12:

Hardware Required

  • Arduino Board
  • (1) Memsic 2125 Accelerometer
  • bread board
  • hook-up wire

September 19, 2010, at 07:04 AM by Christian Cerrito -
Changed lines 7-8 from:
to:
September 18, 2010, at 09:12 AM by Christian Cerrito -
Changed lines 7-8 from:
to:
September 18, 2010, at 08:30 AM by Christian Cerrito -
Changed lines 13-16 from:

to:

September 16, 2010, at 10:19 PM by Tom Igoe -
Changed line 23 from:
to:
February 24, 2010, at 04:29 AM by Tom Igoe -
Changed lines 23-42 from:
 /*
    Memsic2125
    
    Read the Memsic 2125 two-axis accelerometer.  Converts the
    pulses output by the 2125 into milli-g's (1/1000 of earth's
    gravity) and prints them over the serial connection to the
    computer.
    
    The circuit:
 	* 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
   
    http://www.arduino.cc/en/Tutorial/Memsic2125
    
    created 6 Nov 2008
    by David A. Mellis
    modified 30 Jun 2009
    by Tom Igoe
to:
Changed lines 25-66 from:
to:
July 05, 2009, at 07:47 PM by Tom Igoe -
Changed lines 21-34 from:

[@ /*

   Memsic2125

   Read the Memsic 2125 two-axis accelerometer.  Converts the
   pulses output by the 2125 into milli-g's (1/1000 of earth's
   gravity) and prints them over the serial connection to the
   computer.

   The circuit:
	* 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
to:
Changed lines 23-63 from:
   http://www.arduino.cc/en/Tutorial/Memsic2125
to:
 /*
    Memsic2125
    
    Read the Memsic 2125 two-axis accelerometer.  Converts the
    pulses output by the 2125 into milli-g's (1/1000 of earth's
    gravity) and prints them over the serial connection to the
    computer.
    
    The circuit:
 	* 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
   
    http://www.arduino.cc/en/Tutorial/Memsic2125
    
    created 6 Nov 2008
    by David A. Mellis
    modified 30 Jun 2009
    by Tom Igoe

  */

 // these constants won't change:
 const int xPin = 2;		// X output of the accelerometer
 const int yPin = 3;		// Y output of the accelerometer

 void setup() {
   // initialize serial communications:
   Serial.begin(9600);
   // initialize the pins connected to the accelerometer
   // as inputs:
   pinMode(xPin, INPUT);
   pinMode(yPin, INPUT);
 }

 void loop() {
   // variables to read the pulse widths:
   int pulseX, pulseY;
   // variables to contain the resulting accelerations
   int accelerationX, accelerationY;
Changed lines 65-110 from:
   created 6 Nov 2008
   by David A. Mellis
   modified 30 Jun 2009
   by Tom Igoe

 */

// these constants won't change: const int xPin = 2; // X output of the accelerometer const int yPin = 3; // Y output of the accelerometer

void setup() {

  // initialize serial communications:
  Serial.begin(9600);
  // initialize the pins connected to the accelerometer
  // as inputs:
  pinMode(xPin, INPUT);
  pinMode(yPin, INPUT);

}

void loop() {

  // variables to read the pulse widths:
  int pulseX, pulseY;
  // variables to contain the resulting accelerations
  int accelerationX, accelerationY;

  // read pulse from x- and y-axes:
  pulseX = pulseIn(xPin,HIGH);  
  pulseY = pulseIn(yPin,HIGH);

  // convert the pulse width into acceleration
  // accelerationX and accelerationY are in milli-g's: 
  // earth's gravity is 1000 milli-g's, or 1g.
  accelerationX = ((pulseX / 10) - 500) * 8;
  accelerationY = ((pulseY / 10) - 500) * 8;

  // print the acceleration
  Serial.print(accelerationX);
  // print a tab character:
  Serial.print("\t");
  Serial.print(accelerationY);
  Serial.println();

  delay(100);

} @]

to:
June 30, 2009, at 11:52 PM by Tom Igoe -
Changed lines 22-35 from:

int xpin = 2; int ypin = 3;

void setup() {

  Serial.begin(9600);
  pinMode(xpin, INPUT);
  pinMode(ypin, INPUT);

}

void loop() {

  int pulseX, pulseY;
  int accX, accY;
to:

/*

   Memsic2125

   Read the Memsic 2125 two-axis accelerometer.  Converts the
   pulses output by the 2125 into milli-g's (1/1000 of earth's
   gravity) and prints them over the serial connection to the
   computer.

   The circuit:
	* 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
Changed lines 36-38 from:
  // read pulse from x- and y-axes
  pulseX = pulseIn(xpin,HIGH);  
  pulseY = pulseIn(ypin,HIGH);
to:
   http://www.arduino.cc/en/Tutorial/Memsic2125

   created 6 Nov 2008
   by David A. Mellis
   modified 30 Jun 2009
   by Tom Igoe

 */

// these constants won't change: const int xPin = 2; // X output of the accelerometer const int yPin = 3; // Y output of the accelerometer

void setup() {

  // initialize serial communications:
  Serial.begin(9600);
  // initialize the pins connected to the accelerometer
  // as inputs:
  pinMode(xPin, INPUT);
  pinMode(yPin, INPUT);

}

void loop() {

  // variables to read the pulse widths:
  int pulseX, pulseY;
  // variables to contain the resulting accelerations
  int accelerationX, accelerationY;
Added lines 64-67:
  // read pulse from x- and y-axes:
  pulseX = pulseIn(xPin,HIGH);  
  pulseY = pulseIn(yPin,HIGH);
Changed lines 69-72 from:
  // accX and accY are in milli-g's: earth's gravity is 1000.
  accX = ((pulseX / 10) - 500) * 8;
  accY = ((pulseY / 10) - 500) * 8;
to:
  // accelerationX and accelerationY are in milli-g's: 
  // earth's gravity is 1000 milli-g's, or 1g.
  accelerationX = ((pulseX / 10) - 500) * 8;
  accelerationY = ((pulseY / 10) - 500) * 8;
Changed lines 75-77 from:
  Serial.print(accX);
  Serial.print(" ");
  Serial.print(accY);
to:
  Serial.print(accelerationX);
  // print a tab character:
  Serial.print("\t");
  Serial.print(accelerationY);
June 30, 2009, at 11:47 PM by Tom Igoe -
Changed lines 3-4 from:

The Memsic 2125 (datasheet) is a two-axis accelerometer capable of measuring up to plus or minus 2g. It has a simple digital interface: two pins (one for each axis) emit pulses whose duration corresponds to the acceleration of that axis.

to:

The Memsic 2125 (datasheet) is a two-axis accelerometer capable of measuring acceleration up to plus or minus 2g. It has a simple digital interface: two pins (one for each axis) emit pulses whose duration corresponds to the acceleration of that axis.

Added lines 9-16:

Schematic:

click the image to enlarge

November 07, 2008, at 10:20 AM by David A. Mellis -
Changed lines 3-4 from:

The Memsic 2125 is a two-axis accelerometer capable of measuring up to plus or minus 2g. It has a simple digital interface: two pins (one for each axis) emit pulses whose duration corresponds to the acceleration of that axis.

to:

The Memsic 2125 (datasheet) is a two-axis accelerometer capable of measuring up to plus or minus 2g. It has a simple digital interface: two pins (one for each axis) emit pulses whose duration corresponds to the acceleration of that axis.

Changed lines 9-46 from:
to:

The 5V pin and GND pins on the Arduino are connected to the 5V and GND pins of the Memsic 2125; digital pin 2 of the Arduino is connected to the X out pin of the Memsic, and digital pin 3 is connected to the Y out pin.

Code

int xpin = 2;
int ypin = 3;

void setup()
{
  Serial.begin(9600);
  pinMode(xpin, INPUT);
  pinMode(ypin, INPUT);
}

void loop()
{
  int pulseX, pulseY;
  int accX, accY;

  // read pulse from x- and y-axes
  pulseX = pulseIn(xpin,HIGH);  
  pulseY = pulseIn(ypin,HIGH);

  // convert the pulse width into acceleration
  // accX and accY are in milli-g's: earth's gravity is 1000.
  accX = ((pulseX / 10) - 500) * 8;
  accY = ((pulseY / 10) - 500) * 8;

  // print the acceleration
  Serial.print(accX);
  Serial.print(" ");
  Serial.print(accY);
  Serial.println();

  delay(100);
}

November 06, 2008, at 06:27 PM by David A. Mellis -
Added lines 1-9:

Memsic 2125 Accelerometer

The Memsic 2125 is a two-axis accelerometer capable of measuring up to plus or minus 2g. It has a simple digital interface: two pins (one for each axis) emit pulses whose duration corresponds to the acceleration of that axis.

Circuit

Share