Jump to content
I2Cdevlib Forums

Recommended Posts

Hi!

I've got the MPU-9250 working but there seems to be some problem with the accelerometer. When the board is moving and then at rest, the values of the accelerometer don't go back to the "resting values" (ideally it would be (x, y, z) = (0,0,0)). To make this clear I attached the image "accelerometer.png".

For this image: between 1.5s to 3.2s I move the board, then leave it at rest for about 2 seconds and then I move it again for 1.7s and then I leave it at rest again.

After each time, the values at rest of the axes X Y Z are different. It is like the registers stop updating when the board doesn't move any more even if the values didn't come back to the origin. Maybe, there is some threshold. The gyroscope doesn't have that problem. At rest, the values come back nicely to the "rest values".

The module is initialized with the following command:

	I2CSend(MPU9250_ADDRESS, 2, PWR_MGMT_1, 0x00);  // Clear sleep mode
	Delay;
	I2CSend(MPU9250_ADDRESS, 2, PWR_MGMT_1, 0x01); // Clock Source
	Delay;
	I2CSend(MPU9250_ADDRESS, 2, CONFIG, 0x06); // Gyroscope Filter BW = 5Hz, delay = 33,48ms, Fs = 1kHz
	Delay;
	I2CSend(MPU9250_ADDRESS, 2, PWR_MGMT_2, 0x00); // Enable Accelerometer and gyroscope
	Delay;
	I2CSend(MPU9250_ADDRESS, 2, GYRO_CONFIG, 0x00); // +-250dps
	Delay;
	I2CSend(MPU9250_ADDRESS, 2, ACCEL_CONFIG, 0x00);// +-2G
	Delay;
	I2CSend(MPU9250_ADDRESS, 2, ACCEL_CONFIG_2, 0x05); // Accelerometer Filter BW = 10Hz, delay = 35,70ms, Fs = 1kHz
	Delay;
	I2CSend(MPU9250_ADDRESS, 2, INT_PIN_CFG, 0x02); //  Bypass for the magnetometer enable
	Delay;
	I2CSend(MPU9250_ADDRESS, 2, I2C_MST_CTRL, 0x00); // I2C speed at 358 kHz
	Delay;
	I2CSend(MAG_ADDRESS, 2, MAG_CNTL_1, 0x00);// Power down magnetometer
	Delay;
	I2CSend(MAG_ADDRESS, 2, MAG_CNTL_1, 0x16); // sampling rate 100Hz and word is 16-bit
	Delay;

I2CSend() writes values in the specified register.

I thought first that it could be tied to the Wake on Motion thing. But even if I set it to 0x00, it doesn't change anything. Basically, I would like to have the values read continuously without any sleep or standby mode.

Does anyone has an idea of what could be wrong? Thank you for your time!

 

accelerometer.png

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

Loading...

×
×
  • Create New...