3

I would like to use my MPU6050 gyro/accelerometer in some projects but I can't find a good library. I would prefer it to be in python but can deal with C++. I want something where I can do a simple detection of the gyro. I don't want extreme precision. Is there a library out there that would suffice? I tried this CPP code using the demo_raw binary and it gave these results on a level surface with no movement or vibration:

MPU6050 connection successful
a/g:  32767   -424  16284     -335   -143     35

a/g:  32767   -320  16408     -351   -142     33

a/g:  32767   -380  16440     -357   -129     25

a/g:  32767   -328  16340     -370   -104     32

a/g:  32767   -336  16436     -341   -128     49

a/g:  32767   -332  16256     -320   -105     22

a/g:  32767   -252  16292     -358   -117     23

a/g:  32767   -328  16368     -360   -130     48

a/g:  32767   -416  16112     -357   -116     29

a/g:  32767   -432  16336     -354   -120     37

a/g:  32767   -356  16428     -349   -126     23

a/g:  32767   -292  16220     -357   -129     27

a/g:  32767   -376  16420     -357   -101     28

a/g:  32767   -384  16220     -360   -124     32

a/g:  32767   -384  16268     -371   -135     12

a/g:  32767   -328  16256     -350   -126     31

a/g:  32767   -276  16392     -383   -109     31

a/g:  32767   -476  16520     -341   -112     35

I am mainly concerned with the last three columns that are x, y, and z of the gyro. Why would there be such difference in the readings when I am not even touching it? If there is an explanation I can use this library. Any ideas appreciated!

1

This snippet will provide angle after manipulating the values from MPU-6050 MPU-6050-kalman-filter-python .

Reading gyroscope and accelerometer values from MPU-6050 is just reading the data from an address of the module. But to fetch some useful information from the same requires some noise filtering and data-fusion algorithm. The above module or snippet will help you achieve the same using a data-fusion algorithm called Kalman filter.

P.S - This algorithm was used in Apollo Guidance Computer that helped NASA put man on the moon :)

0

There is this library. https://github.com/Tijndagamer/mpu6050 I haven't tried it but it looks to be what you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.