Heading errors

Forums Technical Support for BerryIMU Heading errors

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #15196
    Ben
    Participant

    I bought the berryIMU v2, followed all the guides to create a compass with my rPi 3b including tilt compensation and calibration, and have tried both the python and C code, however I get the same result with both - heading readings that barely change when the device is rotated, and even when it does change it appears to do so in a completely random manner. I am now at a loss trying to fix it, as having tried every suggestion in the forums that i've seen hasnt improved my results. Any help would be very much appreciated. Thank you

    #15197
    jimb
    Participant

    Did you try the calibration described in section 3 for the compass? I found that this made a pretty big impact.

    #15203
    Mark Williams
    Keymaster

    can you show us what your calibration values look like?
    can you also show us the output of about 50 lines when the IMU is being rotated

    Mark --OzzMaker.com --

    #15217
    Ben
    Participant

    I have attached a file with the calibration values, and the output I was getting from the compass_tutorial03 c program with the calibration values added to the code. I rotated the IMU a full 360 degrees but as you can see the heading doesn't vary that much. Thank you  very much for the quick reply.

    Attachments:
    1. output.txt
    #15220
    Mark Williams
    Keymaster

    For you calibration values. magZmax doesnt look correct.
    #define magXmax 463
    #define magYmax 702
    #define magZmax -868
    #define magXmin 409
    #define magYmin 654
    #define magZmin -963

    I have never seen this value in a negative.  It does definitely go above 0. Below is a random line from your output and the value is 10
    heading 289.427 magRaw X 458 magRaw Y 520 MagRaw Z 10

    Try manually changing it to 850 and see if it makes a difference.

    When you do the calibration, are you rotating the IMU in all directions for about 30 seconds?

    Mark --OzzMaker.com --

    #15225
    Ben
    Participant

    I have calibrated it rotating in all directions as you said, and obtained these values:

    #define magXmin -272
    #define magYmin -505
    #define magZmin -983
    #define magXmax 1930
    #define magYmax 1731
    #define magZmax 1226

    However I still do not get the correct heading, as it only varies between 170-250 degrees.

    Thanks again for your ongoing help, it is much appreciated.

    #15234
    Mark Williams
    Keymaster

    that looks better.

    Question, do you have any strong magnets near you where you are doing this testing?

    I assume you are using compass_tutorial03.c?
    And the only modifications you have made is to add the calibration values?

    Right after this line in the above code
    readMAG(magRaw);

    Can you add;
    printf("beforeCal magRaw X %i\tmagRaw Y %i \tMagRaw Z %i ---- ", magRaw[0],magRaw[1],magRaw[2]);
    And then do the same test as before were you showed us the first 100 lines or so while rotating it.

    Mark --OzzMaker.com --

    #15246
    Ben
    Participant

    I dont have any strong magnets where I am doing this testing, and have got the same results in multiple different rooms in my house.

    I am using compass_tutorial03.c and have only modified the calibration and declination values.

    I have attached the a text file that shows the output with the added line requested. Thank you again

    Attachments:
    1. 2ndoutput.txt
    #15281
    Mark Williams
    Keymaster

    can you please try it without the declination

    Mark --OzzMaker.com --

    #15885
    steve
    Participant

    Hello,

    I'm experiencing the same problem. The heading only gives random values.

    Here are my calibration results:

    magXmin = -684
    magYmin = 1081
    magZmin = 512
    magXmax = -617
    magYmax = 1131
    magZmax = 1023

    And in this image you can see the values I get when I try to get the HEADING and TILT COMPENSATION (I've named yawHeading and yawCompensation, but the logic of the code has not been changed):

    Since I'm not an expert on hardware (I'm a software developer) and this is my first time I've soldered some circuits, is it possible that the magnetometer is broken? Is there any way to check if it's working?

    Any help would be greatly appreciated. Thanks.

    #15905
    Mark Williams
    Keymaster

    that is jumping around a lot.

    Your calibration values do no look correct

    magXmin = -684
    magYmin = 1081
    magZmin = 512
    magXmax = -617
    magYmax = 1131
    magZmax = 1023

     

     
    Here is an example, notice that the 'min' values are all negative.

    magXmin = -957
    magYmin = -1073
    magZmin = -1346
    magXmax = 1569
    magYmax = 1086
    magZmax = 783

    When you perform your calibration, are you moving the IMU around in all directions... for about 60 seconds?

    Mark --OzzMaker.com --

    #15908
    steve
    Participant

    When you perform your calibration, are you moving the IMU around in all directions... for about 60 seconds?

    No, after doing that I still get the same values.

    Is it possible that the soldering has damaged something? How can I know that is broken?

    Also, I'm working with Raspeberry PI 4.

     

     

    #15909
    Mark Williams
    Keymaster

    We can check the raw values of the compass to see if there are issues.
    Rename your current IMU.py
    mv IMU.py IMU.py.back

    download an updated versions which will print out the raw values
    wget ozzmaker.com/downloads/IMU.py

    Run calibrateBerryIMU.py, start with the IMU sitting flat, the right way up (skull logo facing down) and quickly tilt the IMU 90 degrees in any direction. Show us the output.

    BTW: is calibrateBerryIMU.py unmodified?

    Mark --OzzMaker.com --

    #15910
    steve
    Participant

    After working all day, I think that I've broken the whole thing. It's no longer recognized by sudo i2cdetect -y 1

     

    By any chance do you send the whole thing soldered? I need to get the orientation with the sensor attached like this.

    #15913
    Mark Williams
    Keymaster

    please contact sales @ ozzmaker.com

    Mark --OzzMaker.com --

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.

Blip, blop, bloop...