Tutorial.AccelerometerMemsic2125 History

Hide minor edits - Show changes to markup

November 07, 2008, at 10:24 AM by David A. Mellis -
Added lines 3-4:
December 01, 2006, at 11:58 AM by David Cuartielles -
Changed lines 11-12 from:

Protoboard with an Accelerometer, picture by Anders Gran

to:

Protoboard with an Accelerometer, picture by Anders Gran

November 21, 2005, at 05:26 PM by 195.178.229.112 -
Changed lines 3-4 from:

The Memsic 2125 is a dual axis accelerometer sensor from Parallax able of measuring up to acceleration in the range of 2g. When making very accurate measurements, the sensor counts with a temperature pin that can be used to compensate possible errors.

to:

The Memsic 2125 is a dual axis accelerometer sensor from Parallax able of measuring up to a 2g acceleration. When making very accurate measurements, the sensor counts with a temperature pin that can be used to compensate possible errors.

November 21, 2005, at 04:57 PM by 195.178.229.112 -
Deleted lines 12-13:

The following example is an adaptation of the previous one. Marcos Yarza added two 220Ohm resistors to the pins coming out of the accelerometer. The board chosen for this small circuit is just a piece of prototyping board.

November 21, 2005, at 04:52 PM by 195.178.229.112 -
Changed line 115 from:

Here the code is exactly the same as before, but the installation on the board allows to embed the whole circutry in a much smaller housing.

to:

Here the code is exactly the same as before (changing the input pins to be 2 and 3), but the installation on the board allows to embed the whole circutry in a much smaller housing.

November 21, 2005, at 04:52 PM by 195.178.229.112 -
Added line 115:

Here the code is exactly the same as before, but the installation on the board allows to embed the whole circutry in a much smaller housing.

November 21, 2005, at 04:50 PM by 195.178.229.112 -
Added lines 13-14:

The following example is an adaptation of the previous one. Marcos Yarza added two 220Ohm resistors to the pins coming out of the accelerometer. The board chosen for this small circuit is just a piece of prototyping board.

Changed lines 108-114 from:

=]

to:

=]

http://static.flickr.com/28/65531406_d7150f954a.jpg

Accelerometer mounted on prototyping board, by M. Yarza

The following example is an adaptation of the previous one. Marcos Yarza added two 220Ohm resistors to the pins coming out of the accelerometer. The board chosen for this small circuit is just a piece of prototyping board.

November 21, 2005, at 02:32 PM by 195.178.229.112 -
Changed lines 7-8 from:

The example shown here was mounted by Anders Grant, while the software was created by Marcos Yarza, who is Arduino's accelerometer technology researcher, at the University of Zaragoza, Spain. The board is connected minimally, only the two axis pins are plugged to the board, leaving the temperature pin open.

to:

The example shown here was mounted by Anders Gran, while the software was created by Marcos Yarza, who is Arduino's accelerometer technology researcher, at the University of Zaragoza, Spain. The board is connected minimally, only the two axis pins are plugged to the board, leaving the temperature pin open.

Changed lines 11-12 from:

Protoboard with an Accelerometer, picture by Anders Grant

to:

Protoboard with an Accelerometer, picture by Anders Gran

November 21, 2005, at 02:31 PM by 195.178.229.112 -
Changed lines 7-8 from:

The example shown here was mounted by Anders Grant, while the software was created by Marcos Yarza, who is Arduino's accelerometer technology researcher, at the University of Zaragoza, Spain. The board is connected minimally, only the two axis are plugged to the board, leaving the temperature pin open.

to:

The example shown here was mounted by Anders Grant, while the software was created by Marcos Yarza, who is Arduino's accelerometer technology researcher, at the University of Zaragoza, Spain. The board is connected minimally, only the two axis pins are plugged to the board, leaving the temperature pin open.

November 21, 2005, at 02:30 PM by 195.178.229.112 -
Changed line 89 from:

serialWrite('X');

to:

printByte('X');

Changed line 92 from:

serialWrite('Y');

to:

printByte('Y');

Changed line 94 from:

serialWrite(sign);

to:

printByte(sign);

Changed lines 96-97 from:

serialWrite(' ');

to:

printByte(' ');

November 21, 2005, at 02:29 PM by 195.178.229.112 -
Added lines 1-106:

Memsic 2125 Accelerometer

The Memsic 2125 is a dual axis accelerometer sensor from Parallax able of measuring up to acceleration in the range of 2g. When making very accurate measurements, the sensor counts with a temperature pin that can be used to compensate possible errors.

The pins dedicated to measure acceleration can be connected directly to digital inputs to the Arduino board, while the the temperature should be taken as an analog input. The acceleration pins send the signals back to the computer in the form of pulses which width represents the acceleration.

The example shown here was mounted by Anders Grant, while the software was created by Marcos Yarza, who is Arduino's accelerometer technology researcher, at the University of Zaragoza, Spain. The board is connected minimally, only the two axis are plugged to the board, leaving the temperature pin open.

http://static.flickr.com/30/65458902_f4f2898ed9.jpg

Protoboard with an Accelerometer, picture by Anders Grant

 
 /* Accelerometer Sensor
* --------------------
*
* Reads an 2-D accelerometer
* attached to a couple of digital inputs and
* sends their values over the serial port; makes
* the monitor LED blink once sent
*
*
* http://www.0j0.org
* copyleft 2005 K3 - Malmo University - Sweden
* @author: Marcos Yarza
* @hardware: Marcos Yarza
* @project: SMEE - Experiential Vehicles
* @sponsor: Experiments in Art and Technology Sweden, 1:1 Scale
*/

int ledPin = 13;
int xaccPin = 7;
int yaccPin = 6;
int value = 0;
int accel = 0;
char sign = ' ';

int timer = 0;
int count = 0;

void setup() {
beginSerial(9600); // Sets the baud rate to 9600
pinMode(ledPin, OUTPUT);
pinMode(xaccPin, INPUT);
pinMode(yaccPin, INPUT);
}

/* (int) Operate Acceleration
* function to calculate acceleration
* returns an integer
*/
int operateAcceleration(int time1) {
return abs(8 * (time1 / 10 - 500));
}

/* (void) readAccelerometer
* procedure to read the sensor, calculate
* acceleration and represent the value
*/
void readAcceleration(int axe){
timer = 0;
count = 0;
value = digitalRead(axe);
while(value == HIGH) { // Loop until pin reads a low
value = digitalRead(axe);
}
while(value == LOW) { // Loop until pin reads a high
value = digitalRead(axe);
}
while(value == HIGH) { // Loop until pin reads a low and count
value = digitalRead(axe);
count = count + 1;
}
timer = count * 18; //calculate the teme in miliseconds

//operate sign
if (timer > 5000){
sign = '+';
}
if (timer < 5000){
sign = '-';
}

//determine the value
accel = operateAcceleration(timer);

//Represent acceleration over serial port
if (axe == 7){
serialWrite('X');
}
else {
serialWrite('Y');
}
serialWrite(sign);
printInteger(accel);
serialWrite(' ');

}
void loop() {
readAcceleration(xaccPin); //reads and represents acceleration X
readAcceleration(yaccPin); //reads and represents acceleration Y
digitalWrite(ledPin, HIGH);
delay(300);
digitalWrite(ledPin, LOW);
} 

Share