MMA7341LC 3-Axis Accelerometer ±3/9g with Voltage Regulator

I have been using this chip with an arduino board. It works pretty well. I have been using the example code given by arduino for accelerometers. The chip has two modes. I have been using the default mode but I want to try using the other mode. According to the data sheet if a pin on the chip reads 0 then it will go to default but if it reads the logical argument =1 then it will switch to the other mode. Can anyone help me code this?

connect the "g-select"-pin to 3.3V or GND to switch between modes

I connected the g select to the 3v3 pin using two wires and a beard board. The outputs definitely changed but something is wrong with conversions. this is data for basically flat accelerometer.
350 355 325
350 354 326
351 355 325
351 354 325
350 354 325
when i convert it using 5v = 1024 arduino unit, the center of the data being 1.65 V and the 9g conversion of 118 mv/g, it converts to in g,
0.499867584745762 0.706766419491525 -0.534626588983052
0.499867584745762 0.665386652542372 -0.493246822033899
0.541247351694915 0.706766419491525 -0.534626588983052
0.541247351694915 0.665386652542372 -0.534626588983052

any ideas what is wrong.

1st. Use 3.3V reference (external ref to 3V3)
then post your code

I tried using a different 3.3V output and the numbers were the same. here is code.


Reads an Analog Devices ADXL3xx accelerometer and communicates the
acceleration to the computer. The pins used are designed to be easily
compatible with the breakout boards from Sparkfun, available from:

The circuit:
analog 0: accelerometer self test
analog 1: z-axis
analog 2: y-axis
analog 3: x-axis
analog 4: ground
analog 5: vcc

created 2 Jul 2008
by David A. Mellis
modified 30 Aug 2011
by Tom Igoe

This example code is in the public domain.


// these constants describe the pins. They won't change:
const int groundpin = 18; // analog input pin 4 -- ground
const int powerpin = 19; // analog input pin 5 -- voltage
const int xpin = A3; // x-axis of the accelerometer
const int ypin = A2; // y-axis
const int zpin = A1; // z-axis (only on 3-axis models)

void setup()
// initialize the serial communications:

// Provide ground and power by using the analog inputs as normal
// digital pins. This makes it possible to directly connect the
// breakout board to the Arduino. If you use the normal 5V and
// GND pins on the Arduino, you can remove these lines.
pinMode(groundpin, OUTPUT);
pinMode(powerpin, OUTPUT);
digitalWrite(groundpin, LOW);
digitalWrite(powerpin, HIGH);

void loop()
// print the sensor values:
// print a tab between values:
// print a tab between values:
// delay before next reading:

Here is the quote from data sheet,
The g-Select feature allows for the selection between two
sensitivities. Depending on the logic input placed on pin 10,
the device internal gain will be changed allowing it to function
with a 3g or 9g sensitivity (Table 3). This feature is ideal when
a product has applications requiring two different sensitivities
for optimum performance. The sensitivity can be changed at
anytime during the operation of the product. The g-Select pin
can be left unconnected for applications requiring only a 3g
sensitivity as the device has an internal pull-down to keep it
at that sensitivity (440 mV/g).

g-Select g-Range Sensitivity
0 3g 440 mV/g
1 9g 117.8 mV/g

This is what I can see:

  • reference voltage 5V
  • expected reading for 0g : 1.65/5*1023 = 337
  • your reading… close !

Power the module from 5V and GND - not from digital I/O-pins
Conneext 3v3 line to Aref-pin
in your setup-code : analogReference(EXTERNAL);

now write raw values. They should be close to 512 (1.65/3.3*1023)

I will try your way other way soon and post but this is just something i noticed. I connect the gself test to a 5v output instead of 3.3V.

here is the data for the chip being flat on the table which should read 0,0,-1
348 354 326
349 354 326
here is the data for the chip being upside down on the table which should read 0,0,1
346 350 373
344 351 376
for some reason the center is around 354 and 20 units = 1g
I cant figure out why this is?

leave "self test" open