Go Down

Topic: Accelerometer Problems - MMA7361L not getting any real data from the device. (Read 1 time) previous topic - next topic


May 09, 2012, 03:23 pm Last Edit: May 09, 2012, 03:25 pm by joachimpetersen Reason: 1
Hello, I am in bit of a pickle, I need to finish a school project in a few days.

I have bought a Triple Axis Accelerometer Breakout - MMA7361

I am using an Arduino Uno.

Here is one of the ways I have tried to connect it to the arduino:
zOut to A3
yOut to A4
xOut to A5
VCC to 3.3V

Code: [Select]
int XPin = 5; // X
int YPin = 4; // Y
int ZPin = 3; // Z
int valX = 0;
int valY = 0;
int valZ = 0;
void setup() {
void loop() {
valX = analogRead(XPin);
valY = analogRead(YPin);
valZ = analogRead(ZPin);
Serial.print(" Y-");
Serial.print(" Z-");

Code: [Select]
X-774 Y-118 Z-70
X-367 Y-117 Z-69
X-52 Y-113 Z-67
X-114 Y-114 Z-68
X-495 Y-120 Z-72
X-634 Y-125 Z-73
X-289 Y-122 Z-72
X-22 Y-119 Z-70
X-171 Y-121 Z-72
X-544 Y-127 Z-75
X-612 Y-131 Z-76
X-221 Y-127 Z-74
X-7 Y-124 Z-73
X-343 Y-129 Z-76
X-635 Y-136 Z-80
X-455 Y-136 Z-78
X-99 Y-132 Z-76
X-46 Y-131 Z-76
X-520 Y-138 Z-80
X-637 Y-143 Z-82
X-262 Y-140 Z-80
X-14 Y-136 Z-78
X-191 Y-138 Z-80
X-565 Y-145 Z-84
X-607 Y-148 Z-85
X-215 Y-145 Z-82
X-10 Y-142 Z-81
X-257 Y-145 Z-84
X-615 Y-151 Z-88
X-568 Y-154 Z-88
X-164 Y-149 Z-85
X-10 Y-146 Z-84
X-285 Y-151 Z-88
X-638 Y-158 Z-91
X-556 Y-158 Z-90
X-121 Y-153 Z-87
X-8 Y-151 Z-87
X-489 Y-159 Z-93
X-645 Y-164 Z-94
X-403 Y-161 Z-91
X-18 Y-155 Z-88
X-4 Y-157 Z-91
X-873 Y-141 Z-401
X-648 Y-140 Z-74
X-235 Y-132 Z-67
X-0 Y-129 Z-66
X-292 Y-139 Z-75
X-640 Y-145 Z-77
X-645 Y-143 Z-72
X-37 Y-135 Z-68
X-0 Y-136 Z-70
X-639 Y-150 Z-79
X-649 Y-148 Z-75
X-151 Y-140 Z-69
X-0 Y-138 Z-69
X-412 Y-150 Z-78
X-647 Y-155 Z-80
X-584 Y-149 Z-73
X-324 Y-145 Z-69
X-349 Y-149 Z-71
X-360 Y-156 Z-78
X-358 Y-158 Z-79
X-339 Y-153 Z-74
X-328 Y-149 Z-70
X-332 Y-152 Z-72
X-343 Y-159 Z-79
X-829 Y-167 Z-359
X-765 Y-167 Z-285
X-252 Y-160 Z-132
X-0 Y-156 Z-44
X-177 Y-164 Z-244
X-809 Y-175 Z-381
X-838 Y-178 Z-377
X-738 Y-176 Z-255
X-155 Y-170 Z-112
X-0 Y-166 Z-46
X-300 Y-177 Z-224
X-860 Y-187 Z-400
X-507 Y-189 Z-381
X-406 Y-186 Z-234
X-327 Y-182 Z-164
X-100 Y-180 Z-163
X-67 Y-184 Z-166
X-270 Y-193 Z-173
X-506 Y-198 Z-219
X-633 Y-199 Z-340
X-387 Y-194 Z-194
X-57 Y-190 Z-191
X-47 Y-191 Z-193
X-250 Y-199 Z-198
X-507 Y-203 Z-199
X-489 Y-201 Z-195
X-680 Y-199 Z-189
X-292 Y-194 Z-184
X-633 Y-198 Z-184
X-639 Y-206 Z-189
X-644 Y-214 Z-193
X-641 Y-218 Z-194
X-625 Y-217 Z-190
X-607 Y-212 Z-183
X-595 Y-212 Z-180
X-595 Y-215 Z-180
X-600 Y-222 Z-134
X-607 Y-230 Z-190
X-603 Y-234 Z-191
X-587 Y-231 Z-186
X-569 Y-226 Z-210
X-559 Y-225 Z-177
X-560 Y-229 Z-178
X-567 Y-236 Z-183
X-573 Y-243 Z-178
X-567 Y-245 Z-188
X-554 Y-243 Z-330
X-285 Y-213 Z-168
X-41 Y-209 Z-166
X-37 Y-211 Z-168
X-658 Y-222 Z-377
X-682 Y-226 Z-180
X-779 Y-226 Z-326
X-376 Y-219 Z-176
X-491 Y-218 Z-173
X-492 Y-220 Z-172
X-499 Y-226 Z-177
X-506 Y-233 Z-180
X-506 Y-236 Z-465
X-490 Y-231 Z-175
X-473 Y-226 Z-172
X-465 Y-224 Z-169
X-469 Y-228 Z-129
X-478 Y-235 Z-282
X-483 Y-240 Z-189
X-478 Y-241 Z-191
X-464 Y-237 Z-186
X-449 Y-233 Z-164
X-442 Y-232 Z-104
X-445 Y-235 Z-203
X-456 Y-241 Z-343
X-465 Y-247 Z-440
X-462 Y-247 Z-437
X-448 Y-242 Z-296
X-433 Y-236 Z-144
X-427 Y-236 Z-121
X-431 Y-239 Z-231
X-443 Y-246 Z-364
X-452 Y-251 Z-471
X-448 Y-250 Z-446
X-433 Y-244 Z-286
X-418 Y-240 Z-140
X-415 Y-240 Z-139
X-419 Y-243 Z-237
X-433 Y-250 Z-404
X-440 Y-254 Z-476
X-434 Y-252 Z-420
X-419 Y-247 Z-259
X-406 Y-242 Z-125
X-402 Y-243 Z-145
X-410 Y-248 Z-271
X-423 Y-254 Z-404
X-424 Y-256 Z-262
X-414 Y-253 Z-176
X-397 Y-248 Z-236
X-36 Y-241 Z-131
X-45 Y-241 Z-193
X-447 Y-249 Z-392
X-893 Y-258 Z-471
X-849 Y-259 Z-428
X-636 Y-255 Z-269
X-69 Y-247 Z-136
X-32 Y-245 Z-181
X-310 Y-252 Z-376
X-873 Y-262 Z-470
X-870 Y-264 Z-457
X-400 Y-257 Z-301
X-388 Y-253 Z-173
X-384 Y-252 Z-155
X-398 Y-255 Z-244
X-446 Y-262 Z-388
X-900 Y-270 Z-486
X-858 Y-272 Z-440
X-689 Y-267 Z-276
X-64 Y-259 Z-130
X-2 Y-256 Z-148
X-610 Y-269 Z-439
X-880 Y-276 Z-496
X-484 Y-272 Z-413
X-467 Y-266 Z-242
X-13 Y-259 Z-133
X-62 Y-260 Z-219
X-532 Y-270 Z-436
X-910 Y-277 Z-505
X-846 Y-278 Z-438
X-483 Y-271 Z-266
X-471 Y-267 Z-162
X-36 Y-264 Z-161
X-35 Y-267 Z-167
X-673 Y-276 Z-172
X-685 Y-277 Z-170
X-644 Y-273 Z-166
X-132 Y-267 Z-161
X-37 Y-263 Z-161
X-34 Y-267 Z-166
X-648 Y-275 Z-171
X-485 Y-274 Z-170
X-785 Y-273 Z-356
X-468 Y-268 Z-159
X-464 Y-268 Z-159
X-468 Y-272 Z-161
X-477 Y-278 Z-166
X-479 Y-282 Z-169
X-470 Y-280 Z-167
X-452 Y-274 Z-162
X-440 Y-270 Z-158
X-437 Y-270 Z-157
X-444 Y-275 Z-161
X-452 Y-280 Z-165

I have also tried this:
zOut to A3
yOut to A4
xOut to A5
VCC to nothing, but 3.3V is connected to AREF on the arduino

Code: [Select]
#define X_PIN 5 // X Axis input (analog pin #)
#define Y_PIN 4 // Y Axis input (analog pin #)
#define Z_PIN 3 // Z Axis input (analog pin #)

void setup(){

 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) ;

Code: [Select]

Test started!
1, x=150, y=75, z=96
503, x=157, y=77, z=99
1005, x=158, y=76, z=99
1508, x=152, y=73, z=97
2011, x=145, y=70, z=95
2513, x=143, y=68, z=94
3016, x=146, y=69, z=96
3519, x=154, y=72, z=99
4022, x=160, y=74, z=102
4525, x=159, y=73, z=102
5027, x=152, y=69, z=99
5530, x=147, y=66, z=97
6033, x=146, y=66, z=97
6536, x=152, y=68, z=100
7038, x=160, y=71, z=103
7541, x=164, y=72, z=105
8044, x=159, y=69, z=102
8547, x=152, y=66, z=100
9050, x=148, y=64, z=98
9552, x=151, y=65, z=100
10055, x=160, y=69, z=104
10558, x=176, y=75, z=110
11061, x=172, y=73, z=109
11565, x=154, y=63, z=99
12067, x=138, y=56, z=92
12570, x=140, y=58, z=95
13073, x=159, y=65, z=103
13576, x=176, y=72, z=109
14078, x=175, y=72, z=109
14582, x=155, y=63, z=100
15085, x=141, y=57, z=95

I noticed it did not respond or change the values when I shaked it so I disconnect everything but the 3.3V that was connect to the AREF and got thses similar results, so it guess this method is not the right one:
results from this was:
Code: [Select]
71438, x=1023, y=1023, z=1023
71942, x=1023, y=1023, z=1023
72445, x=983, y=928, z=822
72948, x=676, y=573, z=551
73451, x=447, y=385, z=402
73955, x=350, y=333, z=361
74458, x=457, y=454, z=454
74961, x=682, y=631, z=584
75464, x=729, y=631, z=577
75967, x=581, y=480, z=460
76471, x=386, y=338, z=355
76974, x=390, y=374, z=387
77477, x=559, y=537, z=515
77980, x=746, y=664, z=603
78483, x=666, y=562, z=523
78987, x=496, y=414, z=410
79490, x=365, y=336, z=356
79992, x=450, y=435, z=434
80496, x=652, y=609, z=567
80999, x=748, y=651, z=592
81503, x=596, y=499, z=477
82006, x=424, y=363, z=373
82508, x=374, y=357, z=373
83012, x=541, y=519, z=499
83515, x=724, y=658, z=602
84019, x=701, y=595, z=549
84521, x=510, y=427, z=422
85024, x=379, y=342, z=359
85528, x=428, y=416, z=420
86031, x=641, y=601, z=560
86534, x=744, y=654, z=596
87037, x=622, y=522, z=494
87540, x=440, y=375, z=383
88044, x=378, y=358, z=374
88547, x=531, y=508, z=490

Can any body tell me what I am doing wrong? Thank you very much.
Best regards:
Joachim Petersen


Have you tried a HIGH signal on the SLeeP pin to make sure the device is out of SLEEP mode?
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e


I actually have, but here is when I try it.

Code: [Select]
int x_avg[10];
int y_avg[10];
int z_avg[10];

int x_axis = 0;
int y_axis = 0;
int z_axis = 0;

int slp_pin = 5;
int i;

void setup()

void loop()
   digitalWrite(slp_pin, HIGH);
   for (i=0; i<10; i=i+1)
     x_avg[i] = analogRead(5);
     y_avg[i] = analogRead(4);
     z_avg[i] = analogRead(3);
   for (i=0; i<10; i=i+1)
     if (i == 0)
       x_axis = x_avg[i];
       y_axis = y_avg[i];
       z_axis = z_avg[i];
       x_axis = x_axis + x_avg[i];
       y_axis = y_axis + y_avg[i];
       z_axis = z_axis + z_avg[i];



Code: [Select]
x-axis 47
y-axis 32
z-axis 100

x-axis 46
y-axis 33
z-axis 99

x-axis 43
y-axis 31
z-axis 84

x-axis 43
y-axis 31
z-axis 70

x-axis 40
y-axis 30
z-axis 55

x-axis 39
y-axis 30
z-axis 44

x-axis 32
y-axis 27
z-axis 18

x-axis 35
y-axis 29
z-axis 32

x-axis 38
y-axis 44
z-axis 37

x-axis 44
y-axis 48
z-axis 47

x-axis 56
y-axis 48
z-axis 83

x-axis 65
y-axis 48
z-axis 101

x-axis 63
y-axis 46
z-axis 96

x-axis 54
y-axis 23
z-axis 81

x-axis 72
y-axis 40
z-axis 111

x-axis 74
y-axis 43
z-axis 141

x-axis 73
y-axis 47
z-axis 143

x-axis 71
y-axis 56
z-axis 53

x-axis 86
y-axis 62
z-axis 150

x-axis 382
y-axis 509
z-axis 94

x-axis 443
y-axis 89
z-axis 70

x-axis 59
y-axis 55
z-axis 64

x-axis 53
y-axis 51
z-axis 62

x-axis 48
y-axis 48
z-axis 59

x-axis 45
y-axis 46
z-axis 57

x-axis 42
y-axis 44
z-axis 55

x-axis 41
y-axis 43
z-axis 54

when I move the accelerometer it does not give any big change in the output.


You MUST connect Arduino ground to device ground.
You MUST connect Arduino 3.3V to device Vcc
You MUST connect 3.3V to the Sleep input to prevent sleep-mode
You MUST connect ST (self test) to ground ( I think ) to prevent self-test mode
You MUST connect GSEL to either ground or 3.3V to select the range you want.

Always connect a suitable logic value to all unused inputs unless the datasheet says they have internal pull-ups or pull-downs - this is a rule of using CMOS logic - no floating control inputs.

If you connect 3.3V to Arduino's AREF pin you MUST call "analogReference (EXTERNAL);" in your setup before any calls to
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


hello friends
i have just bought mma7455 sensor but i am basicaly a mechanical engg so dont know about the pins of accelerometer.
could any one please help me for the program of this sensor.???

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131