minIMU-9 v3 port to LPC13xx

I am using a LPC port for the sensor firmware I found here:

The IMU sensor is not moved but the values are all over the place.


I expected some noise but this data is not usable. Is there a chance that the sensor is damaged?

I found some indication of a problem when I print out the raw data. The Y value of the accelerometer and Z value of the magnetometer are always 0 even if I move the sensor around. I think this causes the problem in the fused sensor data. How can this happen?

I double-checked the register addresses a couple of times, the v3 board uses the DLHC variant, right?

A: -976,0,2063 M: 768,16640,0 G: -13368,15692,-25023
A: -976,0,-198 M: 768,16640,0 G: 14024,15753,11153
A: -976,0,2063 M: 768,16640,0 G: -13368,15692,-25023
A: -976,0,2063 M: 768,16640,0 G: -13368,15692,-25023
A: -976,0,851 M: 768,16640,0 G: 10952,15751,-5624
A: -976,0,2063 M: 768,3848,0 G: -13368,15692,-25023
A: -976,0,2063 M: 768,3848,0 G: -13368,15692,-25023
A: -976,0,2063 M: 768,3848,0 G: -13368,15692,-25023

I ordered the v3 version because I thought it would be a good idea to get improvements. Now I realize that there are many changes. I noticed that enableDefault sets more registers and I added that but it did not impact the quality of the data.
Is there a list of changes v2 => v3 that I could use to update the firmware port?

I attached the source in case you want to take a look. (23.4 KB)


The new MinIMU-9 v3 uses newer MEMS sensors than the MinIMU-9 v2. The accelerometer and magnetometer is the LSM303D, which compared to its predecessors, has a number of improvements, such as the accelerometer and magnetometer are now a single unified I2C device.

From your code, it looks like you do not have the accelerometer and magnetometer’s I2C address declared correctly. You use the old magnetometer’s address, and the accelerometer address is the one for when the SA0 pin is driven low. You can find the correct I2C address in the “I2C Communication” section of the MinIMU-9 v3’s product page. Could you see if fixing the addresses solves your problem?

- Jeremy

The hint about the addresses is very helpful. I ported Gyro_autoDetectAddress from L3G but it could not detect the address so far :frowning: But I am convinced I am on the right track.

with the fixed addresses the IMU firmware port delivered much better values. To resolve the remaining issues I had to exchange the i2c lib. Now I use the version I found here: … c/core/i2c

You can find the current version of my IMU firmware here: … amples/imu

I am glad you got it working. Thanks for sharing your code.

- Jeremy