Tutorial.Memsic2125 History

Hide minor edits - Show changes to output

May 02, 2012, at 04:04 PM by Scott Fitzgerald -
Changed line 40 from:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/6.Sensors/Memsic2125/Memsic2125.ino lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/06.Sensors/Memsic2125/Memsic2125.ino lang=arduino tabwidth=4:)
November 16, 2011, at 04:19 AM by Scott Fitzgerald -
Changed line 40 from:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/6.Sensors/Memsic2125/Memsic2125.pde lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/6.Sensors/Memsic2125/Memsic2125.ino lang=arduino tabwidth=4:)
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:
(:div clas=BOM:)
Changed lines 14-15 from:
to:
(:divend:)
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 ([[http://www.parallax.com/dl/docs/prod/acc/memsickit.pdf | datasheet]]) is a two-axis [[ http://en.wikipedia.org/wiki/Accelerometer | '''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 [[Reference/PulseIn | '''pulseIn()''']] function, it is possible to determine the rate of acceleration and to use that data.

to:
The Memsic 2125 ([[http://www.parallax.com/dl/docs/prod/acc/memsickit.pdf | datasheet]]) is a two-axis [[ http://en.wikipedia.org/wiki/Accelerometer | '''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 [[Reference/PulseIn | '''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 ([[http://www.parallax.com/dl/docs/prod/acc/memsickit.pdf | datasheet]]) is a two-axis [[ http://en.wikipedia.org/wiki/Accelerometer | '''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 [[Reference/Pulsein | '''pulseIn()''']] function, it is possible to determine the rate of acceleration and to use that data.

to:
The Memsic 2125 ([[http://www.parallax.com/dl/docs/prod/acc/memsickit.pdf | datasheet]]) is a two-axis [[ http://en.wikipedia.org/wiki/Accelerometer | '''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 [[Reference/PulseIn | '''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 ([[http://www.parallax.com/dl/docs/prod/acc/memsickit.pdf | 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 ([[http://www.parallax.com/dl/docs/prod/acc/memsickit.pdf | datasheet]]) is a two-axis [[ http://en.wikipedia.org/wiki/Accelerometer | '''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 [[Reference/Pulsein | '''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:

* [[Reference/PinMode | @@pinMode()@@ ]]
* [[Reference/pulseIn()| @@pulseIn()@@]]
* [[Serial/Begin | @@serial.begin()@@]]
* [[Serial/Print | @@serial.print()@@]]

* [[Tutorial/ADXL3xx]] - read a ADXL3xx accelerometer.
* [[Tutorial/Ping]] - detect objects with an ultrasonic range finder.
* [[Tutorial/Knock]] - detect knocks/impacts with a piezo element
September 19, 2010, at 08:46 AM by Christian Cerrito -
Changed lines 15-16 from:
%width=200px%[[Attach:Mx2125_PINOUT.png | Attach:Mx2125_PINOUT.png]]
to:
%width=150px%[[Attach:Mx2125_PINOUT.png | Attach:Mx2125_PINOUT.png]]
September 19, 2010, at 08:45 AM by Christian Cerrito -
Changed lines 15-16 from:
%width=300px%[[Attach:Mx2125_PINOUT.png | Attach:Mx2125_PINOUT.png]]
to:
%width=200px%[[Attach:Mx2125_PINOUT.png | Attach:Mx2125_PINOUT.png]]
September 19, 2010, at 08:44 AM by Christian Cerrito -
Added lines 15-16:
%width=300px%[[Attach:Mx2125_PINOUT.png | Attach:Mx2125_PINOUT.png]]
September 19, 2010, at 08:26 AM by Christian Cerrito -
Added lines 19-20:
[-image developed using [[http://www.fritzing.org |Fritzing]]. For more circuit examples, see the [[http://fritzing.org/projects/|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:
%width=400px%[[Attach:Mx2125_BB.png | Attach:Mx2125_BB.png]]
to:
%width=400px%[[Attach:Mx2125_BB_2.png | Attach:Mx2125_BB_2.png]]
September 18, 2010, at 09:12 AM by Christian Cerrito -
Changed lines 7-8 from:
Attach:memsic2125.jpg
to:
%width=400px%[[Attach:Mx2125_BB.png | Attach:Mx2125_BB.png]]
September 18, 2010, at 08:30 AM by Christian Cerrito -
Changed lines 13-16 from:
%width=400px%[[Attach:memsic_schem.png | Attach:memsic_schem.png]]


to:
%width=400px%[[Attach:Mx2125_schem.png | Attach:Mx2125_schem.png]]


September 16, 2010, at 10:19 PM by Tom Igoe -
Changed line 23 from:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/Sensors/Memsic2125/Memsic2125.pde language=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/6.Sensors/Memsic2125/Memsic2125.pde lang=arduino tabwidth=4:)
February 24, 2010, at 04:29 AM by Tom Igoe -
Changed lines 23-42 from:
%color=#7e7e7e%/*
%color=#7e7e7e% Memsic2125
%color=#7e7e7e%
%color=#7e7e7e% Read the Memsic 2125 two-axis accelerometer. Converts the
%color=#7e7e7e% pulses output by the 2125 into milli-g's (1/1000 of earth's
%color=#7e7e7e% gravity) and prints them over the serial connection to the
%color=#7e7e7e% computer.
%color=#7e7e7e%
%color=#7e7e7e% The circuit:
%color=#7e7e7e% * X output of accelerometer to digital pin 2
%color=#7e7e7e% * Y output of accelerometer to digital pin 3
%color=#7e7e7e% * +V of accelerometer to +5V
%color=#7e7e7e% * GND of accelerometer to ground
%color=#7e7e7e%
%color=#7e7e7e% http://www.arduino.cc/en/Tutorial/Memsic2125
%color=#7e7e7e%
%color=#7e7e7e% created 6 Nov 2008
%color=#7e7e7e% by David A. Mellis
%color=#7e7e7e% modified 30 Jun 2009
%color=#7e7e7e% by Tom Igoe
to:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/Sensors/Memsic2125/Memsic2125.pde language=arduino tabwidth=4:)
Changed lines 25-66 from:
%color=#7e7e7e% */

%color=#7e7e7e%// these constants won't change:
const %color=#cc6600%int%% xPin = 2; %color=#7e7e7e%// X output of the accelerometer
const %color=#cc6600%int%% yPin = 3; %color=#7e7e7e%// Y output of the accelerometer

%color=#cc6600%void%% %color=#cc6600%'''setup'''%%() {
%color=#7e7e7e%// initialize serial communications:
%color=#cc6600%Serial%%.%color=#cc6600%begin%%(9600);
%color=#7e7e7e%// initialize the pins connected to the accelerometer
%color=#7e7e7e%// as inputs:
%color=#cc6600%pinMode%%(xPin, %color=#006699%INPUT%%);
%color=#cc6600%pinMode%%(yPin, %color=#006699%INPUT%%);
}

%color=#cc6600%void%% %color=#cc6600%'''loop'''%%() {
%color=#7e7e7e%// variables to read the pulse widths:
%color=#cc6600%int%% pulseX, pulseY;
%color=#7e7e7e%// variables to contain the resulting accelerations
%color=#cc6600%int%% accelerationX, accelerationY;

%color=#7e7e7e%// read pulse from x- and y-axes:
pulseX = %color=#cc6600%pulseIn%%(xPin,%color=#006699%HIGH%%);
pulseY = %color=#cc6600%pulseIn%%(yPin,%color=#006699%HIGH%%);

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

%color=#7e7e7e%// print the acceleration
%color=#cc6600%Serial%%.%color=#cc6600%print%%(accelerationX);
%color=#7e7e7e%// print a tab character:
%color=#cc6600%Serial%%.%color=#cc6600%print%%(%color=#006699%"\t"%%);
%color=#cc6600%Serial%%.%color=#cc6600%print%%(accelerationY);
%color=#cc6600%Serial%%.%color=#cc6600%println%%();

%color=#cc6600%delay%%(100);
}

(:divend:)
to:
(:divend:)
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:
(:div class=code :)
Changed lines 23-63 from:
http://www.arduino.cc/en/Tutorial/Memsic2125
to:
%color=#7e7e7e%/*
%color=#7e7e7e% Memsic2125
%color=#7e7e7e%
%color=#7e7e7e% Read the Memsic 2125 two-axis accelerometer. Converts the
%color=#7e7e7e% pulses output by the 2125 into milli-g's (1/1000 of earth's
%color=#7e7e7e% gravity) and prints them over the serial connection to the
%color=#7e7e7e% computer.
%color=#7e7e7e%
%color=#7e7e7e% The circuit:
%color=#7e7e7e% * X output of accelerometer to digital pin 2
%color=#7e7e7e% * Y output of accelerometer to digital pin 3
%color=#7e7e7e% * +V of accelerometer to +5V
%color=#7e7e7e% * GND of accelerometer to ground
%color=#7e7e7e%
%color=#7e7e7e% http://www.arduino.cc/en/Tutorial/Memsic2125
%color=#7e7e7e%
%color=#7e7e7e% created 6 Nov 2008
%color=#7e7e7e% by David A. Mellis
%color=#7e7e7e% modified 30 Jun 2009
%color=#7e7e7e% by Tom Igoe

%color=#7e7e7e% */

%color=#7e7e7e%// these constants won't change:
const %color=#cc6600%int%% xPin = 2; %color=#7e7e7e%// X output of the accelerometer
const %color=#cc6600%int%% yPin = 3; %color=#7e7e7e%// Y output of the accelerometer

%color=#cc6600%void%% %color=#cc6600%'''setup'''%%() {
%color=#7e7e7e%// initialize serial communications:
%color=#cc6600%Serial%%.%color=#cc6600%begin%%(9600);
%color=#7e7e7e%// initialize the pins connected to the accelerometer
%color=#7e7e7e%// as inputs:
%color=#cc6600%pinMode%%(xPin, %color=#006699%INPUT%%);
%color=#cc6600%pinMode%%(yPin, %color=#006699%INPUT%%);
}

%color=#cc6600%void%% %color=#cc6600%'''loop'''%%() {
%color=#7e7e7e%// variables to read the pulse widths:
%color=#cc6600%int%% pulseX, pulseY;
%color=#7e7e7e%// variables to contain the resulting accelerations
%color=#cc6600%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:
%color=#7e7e7e%// read pulse from x- and y-axes:
pulseX = %color=#cc6600%pulseIn%%(xPin,%color=#006699%HIGH%%);
pulseY = %color=#cc6600%pulseIn%%(yPin,%color=#006699%HIGH%%);

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

%color=#7e7e7e%// print the acceleration
%color=#cc6600%Serial%%.%color=#cc6600%print%%(accelerationX);
%color=#7e7e7e%// print a tab character:
%color=#cc6600%Serial%%.%color=#cc6600%print%%(%color=#006699%"\t"%%);
%color=#cc6600%Serial%%.%color=#cc6600%print%%(accelerationY);
%color=#cc6600%Serial%%.%color=#cc6600%println%%();

%color=#cc6600%delay%%(100);
}

(:divend:)
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 ([[http://www.parallax.com/dl/docs/prod/acc/memsickit.pdf | 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 ([[http://www.parallax.com/dl/docs/prod/acc/memsickit.pdf | 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-]

%width=400px%[[Attach:memsic_schem.png | Attach:memsic_schem.png]]


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 ([[http://www.parallax.com/dl/docs/prod/acc/memsickit.pdf | 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

Attach:memsic2125.jpg

Share