Accelerometer MPU6050 / Breakout board GY-521 - some basic questions

I have set up the test program given on this page:

for the MPU6050 accelerometer chip and indeed it is giving measurements that are similar to those shown here:

Can someone answer a couple of questions. I have scanned the forum and playground and haven't located the answers.

1) (*** problem solved - found info in the data sheets. )In terms of the code found on the above page, can someone offer the code to enable digital low pass filtering or DLPF as it is referenced in the code? In fact there is a comment within the loop to that effect:

// Read the raw values. // Read 14 bytes at once, // containing acceleration, temperature and gyro. // With the default settings of the MPU-6050, // there is no filter enabled, and the values // are not very stable.


  • I added this line right before the sleep mode is disabled

MPU6050_write_reg(0x1A, 0x06); //this puts the MPU in DLPF mode with a cutoff filter of 5 hz

Here is the data sheet for the MPU6050 but as complex as it is, they don't give the details of the config registers of which there are dozens, but here is the separate reference for the config registers, also a huge document.

I tested this by placing a vibrating pager motor on the breadboard containing the breakout board. With no DLPF, the z-axis varies randomly by +/- 4000 or so (on a scale of +/- 2**14 per G) while there is no variation with the 5 hz DLPF on! (except for the noise or vibration of the house that seems to give a variation of +/- 10 or so. Interesting that the filter does not reduce this low level variation. Either it is some sort of noise in the device or low frequency movement of my desk of around a "milli-G"

2) Note the data sent my the MPU on this page:

Note that the gyro sensors seem to have a baseline offset that varies a bit, but is nonetheless an offset that on my device. The x, y, z rotation numbers are 230, 55, 65 with some noise on a full scale of +/-16,234 representing an offset of around 1.4% with the 230 value. Maybe the user software must just find a way to take those values as a zero. BTW, just in case the earth's rotation represents a rotational offset even though it's too small, I tried re-orienting the board and the values stay the same. BTW all the numbers seem to move appropriately when I move or rotate the board.

Thanks for reading!

This is the page of the manufacturer: It has the documents (all 4 of them).

MEMS sensor are noisy and have an offset, that is normal. For practical use, a software filter is used.

The i2cdevlib is a full library for this sensor.

but what is the code to enable that DLPF all the people saying frequency but no one is writing ant code is there no one has knowledge about that on the earth ?