AltIMU-10 V5.Sensors, Github linbarary: minimu-9-ahrs-arduino-master Library using Arduino Due Board and

Hi Team,
I am using AltIMU-10 V5 IMU and Altimeter sensor with Arduino Due. I tried to compile and flash the library link provided on Git hub, but I am running into below error. I was of the idea that if I can just compile and flash the code it should atleast give me some values and later I can make the changes if necessary but I have no idea why this below error. Would be thankful if you could please direct me.

sketch\MinIMU9AHRS.ino.cpp.o: In function `Gyro_Init()':
C:\Users\veenakeeranagi\Documents\Arduino\minimu-9-ahrs-arduino-master\MinIMU9AHRS/I2C.ino:59: undefined reference to `LSM6::writeReg(unsigned char, unsigned char)'
sketch\MinIMU9AHRS.ino.cpp.o: In function `Read_Gyro()':
C:\Users\veenakeeranagi\Documents\Arduino\minimu-9-ahrs-arduino-master\MinIMU9AHRS/I2C.ino:71: undefined reference to `LSM6::readGyro()'
sketch\MinIMU9AHRS.ino.cpp.o: In function `Accel_Init()':
C:\Users\veenakeeranagi\Documents\Arduino\minimu-9-ahrs-arduino-master\MinIMU9AHRS/I2C.ino:92: undefined reference to `LSM6::init(LSM6::deviceType, LSM6::sa0State)'
C:\Users\veenakeeranagi\Documents\Arduino\minimu-9-ahrs-arduino-master\MinIMU9AHRS/I2C.ino:93: undefined reference to `LSM6::enableDefault()'
C:\Users\veenakeeranagi\Documents\Arduino\minimu-9-ahrs-arduino-master\MinIMU9AHRS/I2C.ino:94: undefined reference to `LSM6::writeReg(unsigned char, unsigned char)'
sketch\MinIMU9AHRS.ino.cpp.o: In function `Read_Accel()':
C:\Users\veenakeeranagi\Documents\Arduino\minimu-9-ahrs-arduino-master\MinIMU9AHRS/I2C.ino:116: undefined reference to `LSM6::readAcc()'
sketch\MinIMU9AHRS.ino.cpp.o: In function `Compass_Init()':
C:\Users\veenakeeranagi\Documents\Arduino\minimu-9-ahrs-arduino-master\MinIMU9AHRS/I2C.ino:136: undefined reference to `LIS3MDL::init(LIS3MDL::deviceType, LIS3MDL::sa1State)'
C:\Users\veenakeeranagi\Documents\Arduino\minimu-9-ahrs-arduino-master\MinIMU9AHRS/I2C.ino:137: undefined reference to `LIS3MDL::enableDefault()'
sketch\MinIMU9AHRS.ino.cpp.o: In function `Read_Compass()':
C:\Users\veenakeeranagi\Documents\Arduino\minimu-9-ahrs-arduino-master\MinIMU9AHRS/I2C.ino:146: undefined reference to `LIS3MDL::read()'
sketch\MinIMU9AHRS.ino.cpp.o: In function `__static_initialization_and_destruction_0':
C:\Users\veenakeeranagi\Documents\Arduino\minimu-9-ahrs-arduino-master\MinIMU9AHRS/I2C.ino:36: undefined reference to `LSM6::LSM6()'
C:\Users\veenakeeranagi\Documents\Arduino\minimu-9-ahrs-arduino-master\MinIMU9AHRS/I2C.ino:37: undefined reference to `LIS3MDL::LIS3MDL()'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Due (Programming Port).

Hello.

There are software prerequisites to use the Pololu MinIMU-9 + Arduino AHRS (Attitude and Heading Reference System) program and sketch. Your error messages indicate that the LSM6 and LIS3MDL libraries do not exist. Please download and install the relevant additional mentioned in the “Getting Started” section of the README.

Brandon

Hi Brandon,

Greetings! Thanks for the response. I already have these libraries in Arduino library folder. Below is the library file structure which has the necessary header and .cpp files

and the all the other .ino sketches are outside the library folder.

C:\Users\veenakeeranagi\Documents\Arduino\minimu-9-ahrs-arduino-master\MinIMU9AHRS

However, at first would like to know the right way to compile the program.

Also just wanted to know if this code is compatible with Arduino DUE board as per the link on GitHub - pololu/minimu-9-ahrs-arduino: Arduino program for building an AHRS with a Pololu MinIMU-9 in the “Including Arduino Due board” It does say it is compatible.

Thank you for the updated information.

The program is compatible with the Arudino Due, but the Arduino IDE requires a specific file structure and your Arduino libraries do not look like they are properly installed. The sketch will not compile unless the libraries are properly installed.

I recommend deleting the files you have now and restarting from scratch. Specifically, I suggest using the Arduino Library Manager to install the required libraries. You can find instructions for doing that under the “Software” heading on each library’s respective GitHub page. Here are the links to the two required libraries for convenience:

Brandon

Hi BrandonM,

Thank you for responding so quick. Yea it was issue with the software installation.
I reinstalled and it worked.

Thanks again for helping.

Best Regards,
Veena

1 Like

Hi BrandoM,

Greetings! I see the drift in Yaw measurement happening in seconds. I did refer to the calibration file related to this sensor. However I didn’t quite understand what was happening. Is there any related article to eliminate Yaw measurement Drift issue.

I also was able to get the altimeter readings but the readings are not consistent throughout.

Regards,
Veena

If you are getting drift in the yaw axis, you probably need to calibrate the magnetometer. To do this, you can run the Calibrate.ino example sketch in the LIS3MDL library. During the calibration, you should move the board in every possible orientation (i.e. like you are trying to paint the inside of a sphere). Then, you can copy the outputs from that example and update the min and max calibration constants (e.g. M_X_MIN, M_Z_MAX, M_Y_MIN, etc.) defined inside the MinIMU9AHRS.ino sketch

As far as the altimeter readings, can you be more specific about what you have tried and what results you had?

Brandon

Hi BrandonM,

I found this link related to the Altimeter sensor. So I did get the altimeter readings on serial com, however it was not consistent throughout. I ran the SerialUS.ino sketch. Is there a way to calibrate this sensor too?

GitHub - pololu/lps-arduino: Arduino library for Pololu LPS25H and LPS331AP boards

Regards,
Veena

I get values something like these.

: 29.66 inHg a: 245.51 ft t: 71.72 deg F
p: 29.66 inHg a: 243.72 ft t: 71.72 deg F
p: 29.66 inHg a: 245.34 ft t: 71.72 deg F
p: 29.66 inHg a: 244.12 ft t: 71.72 deg F
p: 29.66 inHg a: 244.13 ft t: 71.72 deg F
p: 29.66 inHg a: 242.99 ft t: 71.72 deg F
p: 29.66 inHg a: 243.22 ft t: 71.73 deg F
p: 29.66 inHg a: 244.65 ft t: 71.71 deg F
p: 29.66 inHg a: 243.46 ft t: 71.71 deg F
p: 29.66 inHg a: 243.24 ft t: 71.72 deg F
p: 29.66 inHg a: 246.29 ft t: 71.72 deg F
p: 29.66 inHg a: 244.87 ft t: 71.71 deg F
p: 29.66 inHg a: 244.65 ft t: 71.71 deg F
p: 29.66 inHg a: 246.26 ft t: 71.71 deg F
p: 29.66 inHg a: 243.78 ft t: 71.72 deg F
p: 29.66 inHg a: 245.20 ft t: 71.71 deg F
p: 29.66 inHg a: 243.46 ft t: 71.71 deg F
p: 29.66 inHg a: 245.92 ft t: 71.71 deg F
p: 29.66 inHg a: 243.94 ft t: 71.71 deg F
p: 29.66 inHg a: 243.75 ft t: 71.70 deg F
p: 29.66 inHg a: 244.41 ft t: 71.71 deg F
p: 29.66 inHg a: 245.06 ft t: 71.71 deg F
p: 29.66 inHg a: 245.65 ft t: 71.71 deg F

so the pressure and temperature values are pretty constant however the altitude values are off.

When you say it was not consistent, are you referring to the variation from reading to reading? That variation looks reasonable to me, and in the range I would expect for this sensor. If you want it to be more steady, you might try taking an average of multiple readings.

By the way, that example sketch by default is only printing the pressure values to 2 decimal places; you can see a more precise pressure reading by changing Serial.print(pressure); to Serial.print(pressure, 3); or Serial.print(pressure, 4);.

Brandon

Hi BrandonM,

Yes, the readings below are like 2 ft apart. 2 decimal precision is ok at the moment. Can I please know why is this difference expected, shouldn’t it give same reading with decimal precision, if the pressure is constant and sensor is stationary?

a: 243.75 ft
a: 244.41 ft
a: 245.06 ft

Regards,
Veena

The measured pressure values are not the same for each of those height calculations; the pressure reading is much more precise than 2 decimal places, but Serial.print()is rounding it when it is printed out (to 2 decimal places by default).

For reference, if you are running our unmodified example program, the height difference from a pressure reading of 29.660 inHG and 29.6649 inHG (which both round to 29.66) is over 4.5 ft.

Brandon

Hi BrandonM,

I don’t need the decimal precision at the moment. I need the readings to be same throughout if I am keeping the sensor stationary.
Can you please let me know if there is any other way of achieving it. 1 to 2 feet of difference when the sensor is placed at a same position seems a lot of difference.

Request to please let me know.

Best Regards,
Veena

You are limited by the noise and resolution of the sensor. The pressure difference in a change of only 1 foot of altitude difference is a very small fraction of the sensor’s range. As I mentioned before, you will likely get more stable results by taking an average of many readings. You can do this in your program, or you can configure the sensor to provide a moving average, although you would have to do that by setting the appropriate registers yourself since our library does not provide any functions to help you do that.

Brandon

Hi BrandonM,

Alright! Thank you !

Regards,
veena

1 Like

Hi Brandon,

Greetings! does the Altimeter sensor in Altimu-10 capable of measuring the height difference in inches?

It says in the specification that the altitude sensor is capable of measuring height/altitude difference in 1 Ft resolution. Which seems a lot for the application I want to use. It is not detecting height change in cm’s or inches.
Can you please let me know if there is any other sensor, if not this one which is capable of measuring small change in the height measurement cm or inches as resolution.

Best Regards,
Veena

It is not practical to get that kind of precision with a pressure sensor like the LPS25H on the AltIMU-10. As I mentioned in my previous post, the pressure difference in a change of only 1 foot of altitude difference is a very small. For reference, you can probably get the pressure to change enough for the measurement to vary a few centimeters by blowing on it, and other environmental factors (such as a window opening or nearby air conditioner turning on) are likely to have a similar, or larger, effect.

Ultimately, if you need to measure height differences that small, you will probably need to use a different kind of sensor. If your application involves measuring the height near the ground or another reference surface, you might consider using a distance sensor. For example, drones often use LiDAR or ultrasonic sensors for measuring altitude for landing (where the greatest precision is required) or holding a steady altitude.

Brandon

Hi BrandonM,

Thank you so much for the response. I had one question related to the pitch, yaw and roll measurements. Can you please let me know what is the unit of measurement for the pitch, yaw and roll measurements.

Are they in degrees or radians? Can you please help me with the formula which is used for conversion of yaw measurements mapping to N, S, E, W direction heading in terms of degrees.

Regards,
Veena

As mentioned in the README of our MinIMU-9 + Arduino AHRS example, it prints the roll, pitch, and yaw angles in degrees:

You can find the code used to calculate the magnetometer heading in Compass.ino. The angle returned from the Compass_Heading() function is in radians, and gets converted to degrees for printing (which you can see in Output.ino). The angle is relative to the north (i.e. an angle of 0° is due north).

Brandon