I2Cdevlib Forums

# MPU 6050 outputs both positive and negative values when moved in one direction

## Recommended Posts

Hello everyone!

I am experimenting with MPU6050. I am working with Jeff Rowberg's library using DMP (MotionApps v2.0)). I performed a simple test. For this test, I printed only y-axis OUTPUT_READABLE_WORLDACCEL values. As per my understanding, when mpu6050 is at rest, value should be zero. When movement starts, the values should increase. When stopped, values should decrease to zero but mpu6050 shows un-predictable values. These values are given below.

```0
0
0
169
389
637
957
1388
2472
3025
3519
3937
4297
4563
4683
4704
4775
4815
4818
4848
4887
4903
4897
4856
4614
4383
4167
3951
3666
3348
3038
2685
2203
992
340
0
0
-313
-1363
-2355
-3223
-4627
-5346
-6057
-6644
-7120
-7407
-7513
-7582
-6995
-6578
-6178
-5841
-5422
-4872
-4459
-4063
-3125
-2664
-2253
-1942
-1531
-1248
-1064
-809
-270
-38
0
0
0
0```

As I mentioned, I move the sensor from right to left. Above values show both positive and negative values which apparently seem to be two movements (i.e. from right to left and then from left to right). I am really unable to understand this pattern. Clearly I am missing/misunderstanding something. Please help me to resolve/understand this issue.

Thanks & regards.

##### Share on other sites

What you're seeing is actually expected because of what acceleration is, fundamentally. The positive values represent a change (increase) in velocity as you begin moving the IMU in one direction. Eventually, you stop accelerating the IMU, at which point it is moving at a relatively constant velocity--but still moving, nonetheless. At this moment, the readings return to zero. But then, you stop moving the IMU, which is when the negative values begin. These represent another change (decrease) in velocity as you slow it down to a stopped/rest state, at which point the acceleration returns to zero once again.

This page gives you an interesting 3-graph visualization of position, velocity, and acceleration over time, all linked together: https://ophysics.com/k4b.html

Hope this helps!

##### Share on other sites

Thanks for clarifying. I think, still, I am not getting it correctly so I need your help a little more. There are 2 sets of values, positive and negative. Both positive and negative values increase and decrease. Please explain the following.

1-Increasing positive value is definitely increase in velocity. What about decreasing positive values? Does it mean that velocity is still increasing but not as fast as it was increasing initially?

2-I thought that negative sign indicates opposite direction. You say, negative sign indicates deacceleration. If so, is there any way to detect motion in opposite direction?

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.