Acceleromter MMA7361, problems reading correct values

Hi

I have the Triple Axis Accelerometer Breakout - MMA7361:

Using it with the etherten which is essentially an UNO clone with the ethershield:

I have connected the AREF up to 3.3V on the aduino and set analogReference(EXTERNAL).

Now as I understand it the MMA7361 is calibrated in the factory so it should output x=512 y=512
and z should read the equivalent of 1g depending on the which mode is selected (+-1.5g or +-6g)
if it is lying on a flat surface.

If I set the +-1.5g mode I get x=521 y=532 z=663. x and y are reasonable close but z is about 0.4g out.
If I turn the sensor on the side I get x=775 y=539 and z=417, x is getting the 1g now and but z is still by about 0.4g out.

The x, y and z values are averages from many samples (more than 1000).

So to me it seems that the z channel has a large offset.
Is that normal for this type of sensor?
How good does the MMA7361 normally perform?
Could there be a problem with my layout, wiring, soldering or such?

I have written small test program that shows this behavior:

#define X_PIN	 0			 // X Axis input (analog pin #)
#define Y_PIN	 1			 // Y Axis input (analog pin #)
#define Z_PIN	 2			 // Z Axis input (analog pin #)

void setup(){
  Serial.begin(115200);

  analogReference(EXTERNAL);		// set if Aref pin wired to 3.3V source

  pinMode(X_PIN, INPUT);
  pinMode(Y_PIN, INPUT);
  pinMode(Z_PIN, INPUT); 

  Serial.println("Test started!");
}


void loop(){
  int x,y,z;
  x =analogRead(X_PIN);
  y =analogRead(Y_PIN);
  z =analogRead(Z_PIN);
  Serial.print(millis()) ;
  Serial.print(", x=");
  Serial.print(x) ;
  Serial.print(", y=");
  Serial.print(y) ;
  Serial.print(", z=");
  Serial.println(z) ;
  delay(5);
}

This program will produce output like this:

Test started!
1, x=521, y=533, z=665
8, x=520, y=534, z=666
16, x=515, y=532, z=665
23, x=523, y=532, z=665
31, x=519, y=531, z=666
38, x=518, y=533, z=663
47, x=519, y=532, z=663
54, x=517, y=535, z=666
62, x=518, y=536, z=666
69, x=522, y=533, z=663
77, x=518, y=533, z=662
84, x=519, y=532, z=665
93, x=522, y=534, z=666
101, x=520, y=533, z=662
108, x=521, y=530, z=664
116, x=524, y=532, z=663
124, x=516, y=535, z=661
132, x=518, y=536, z=661
140, x=521, y=529, z=667
148, x=521, y=532, z=665
155, x=519, y=533, z=660
163, x=523, y=532, z=666
172, x=518, y=532, z=661
179, x=517, y=531, z=659
187, x=515, y=531, z=662
195, x=521, y=531, z=666
202, x=520, y=534, z=665
210, x=519, y=533, z=664
219, x=519, y=532, z=664
226, x=518, y=535, z=663
234, x=517, y=534, z=665
242, x=520, y=533, z=667
249, x=521, y=534, z=664
258, x=519, y=530, z=667
266, x=520, y=531, z=664
273, x=519, y=533, z=664
281, x=520, y=531, z=663
289, x=517, y=531, z=662
296, x=518, y=533, z=658
305, x=525, y=533, z=664
313, x=516, y=532, z=667
320, x=517, y=534, z=663
328, x=523, y=535, z=663
336, x=518, y=531, z=665
344, x=517, y=535, z=663
352, x=520, y=533, z=663
360, x=521, y=533, z=664
367, x=524, y=532, z=663
375, x=522, y=530, z=667
384, x=519, y=532, z=662
391, x=522, y=531, z=665
399, x=518, y=532, z=665
407, x=519, y=532, z=660
414, x=522, y=532, z=661
422, x=518, y=534, z=664
431, x=522, y=533, z=661
438, x=521, y=532, z=661
446, x=520, y=533, z=661
454, x=521, y=534, z=662
461, x=521, y=535, z=667
470, x=521, y=534, z=661
478, x=522, y=534, z=663
485, x=522, y=532, z=665
493, x=516, y=531, z=664
501, x=518, y=532, z=665

Any help would be appreciated.

Cheers

The spec sheet says the Voff (Voltage offset) at 0g can be from 1.485 to 1.815 (A/D output of 460 to 563)

The sensitivity on the 1.5g scale can be 740 to 860 millivolts per G. 1g should read between 690 and 830.

Looks like you either have something wrong with your wiring or your accelerometer is out of spec.

You should try connecting X, Y and Z to different pins to see if the problem is in the input pin.

@Johnwasser

Thanks for pointing out the Voff in the data sheet. I didn't recognised them for what they are when I look at it trying to find out if the device is calibrated. So it makes sense to calibrate the MMA7361 myself by calculating the individual offsets.

Yes according to the data sheet my MMA7361 is outside the range of what should be normal.

For another test I swapped the z and y connectors on the MMA7361 to find out if the error is somewhere further downstream.
The results from test with that just confirm that the z direction has very large offset.

I am trying to build a seismograph using the MMA7361. So I have it setup to start recording values to file when the acceleration goes above a noise threshold. By some good luck I managed to record a shallow 3.6 magnitude earthquake just a few kilometers away.

Here the official link to that quake:
http://geonet.org.nz/earthquake/quakes/3522574g.html

At the moment the setup is still on my desk so that the kids jumping around will set it off, but I am planing to screw it onto the concrete pad in the basement for better results.

Thanks for the advice