MMA7361L accelerometer - Problem with the z-axis

Hello,

Not sure this has been discussed before as I couldn't find anything, but I've been having a frustrating issue with the sensor's z-axis. I've tried everything but no success. I'm basically interested in the g values, so when the sensor is upside down instead of giving me -1 it gives me a value of around -1.34g, the corresponding value in volts is 0.58V. I think those value are not an acceptable? correct me if I'm wrong. Then when the sensor is facing up, the z-axis outputs 0.6g and 2.15V. Normally it would be 1g, 2.45V.

I guess this is a pretty straightforward calculation, it took me a while to actually make the decision to ask for help, it would be embarrassing to find this is all about a careless mistake.

The setup I'm using is simple, I'm using an Arduino Uno, the accelerometer is being powered by the 3.3V pin connected to Vin. I'm using the capacitors on the outputs as shown in the datasheet. Here's the code I wrote to get the values, again, pretty straightforward:

//void setup(){};
//void loop(){};

int myArray[]={A0,A1,A2};
float volts[3];
float g[] = {volts[0],volts[1],volts[2]};
int xVal, yVal, zVal;

void setup(){
  
  Serial.begin(9600);
  analogReference(EXTERNAL);
  
}
void loop(){
  xVal = analogRead(myArray[0]);
  yVal = analogRead(myArray[1]);
  zVal = analogRead(myArray[2]);

  volts[0] = xVal*3.3/1024;
  volts[1] = yVal*3.3/1024;
  volts[2] = zVal*3.3/1024;
  
  g[0]= (volts[0]-1.65)/0.8;
  g[1]= (volts[1]-1.65)/0.8;
  g[2]= (volts[2]-1.65)/0.8;
  
  Serial.print(volts[0]);
  Serial.print("\t");
  Serial.print(volts[1]);
  Serial.print("\t");
  Serial.print(volts[2]);
  Serial.print("\t");
  Serial.print(g[0]);
  Serial.print("\t");
  Serial.print(g[1]);
  Serial.print("\t");
  Serial.println(g[2]);
  
  delay(100);  
}

Any help on this issue will be much appreciated, thanks.

The datasheet will tell you the acceptable range of values for offset and sensitivity. From that you can calculate if your chip is out of spec and should be returned for replacement.

Thanks John, I'll see if I can find that range in the datasheet.

Hi krow,
I have the same accelerometer. I see that in your code you used the nominal values for the offset (1.65 Volt) and sensitivity (800 mV/g).
The datasheet reports as possible ranges (1.485 to 1.815 Volts) and (740 to 860) mV/g. After a calibration I found the following values for
my sensor, as you can see they are different for each axis:

// Readout offset (in ADC 10bit units)
const int MMA736_X_OFFSET = 491;
const int MMA736_Y_OFFSET = 520;
const int MMA736_Z_OFFSET = 473;
// Volt/G for sensitivity MMA736_1G 
const float MMA736_X_COEFF_1G = 0.766; 
const float MMA736_Y_COEFF_1G = 0.806;
const float MMA736_Z_COEFF_1G = 0.792;

ea123:
The datasheet reports as possible ranges (1.485 to 1.815 Volts) and (740 to 860) mV/g.

So that means the 1g reading can be from 2.225v to 2.675 (1.485+0.740 and 1.815+0.860).

The 2.15V the original poster was getting is out of spec IF the reading was done correctly. Perhaps the reading should be checked with a digital multimeter. It might also be good to check the voltage on the Aref pin.

What's the analog reference voltage - I presume the 3.3V rail (but just checking!)?