Home › Forums › Forums › Technical Support for BerryIMU › Heading errors
Tagged: Berrygpsimuv4
- This topic has 19 replies, 7 voices, and was last updated 1 year, 9 months ago by ateator.
- AuthorPosts
- March 3, 2020 at 9:33 am #15196BenParticipant
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
March 3, 2020 at 10:19 am #15197jimbParticipantDid you try the calibration described in section 3 for the compass? I found that this made a pretty big impact.
March 3, 2020 at 3:22 pm #15203Mark WilliamsKeymastercan 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 rotatedMark --OzzMaker.com --
March 3, 2020 at 9:45 pm #15217BenParticipantI 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:
March 4, 2020 at 12:05 am #15220Mark WilliamsKeymasterFor you calibration values. magZmax doesnt look correct.
#define magXmax 463
#define magYmax 702
#define magZmax -868
#define magXmin 409
#define magYmin 654
#define magZmin -963I 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 10Try 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 --
March 4, 2020 at 4:33 am #15225BenParticipantI 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 1226However 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.
March 4, 2020 at 3:27 pm #15234Mark WilliamsKeymasterthat 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 --
March 5, 2020 at 2:32 am #15246BenParticipantI 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:
March 6, 2020 at 7:07 pm #15281Mark WilliamsKeymastercan you please try it without the declination
Mark --OzzMaker.com --
June 13, 2020 at 12:59 am #15885steveParticipantHello,
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 = 1023And 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.
June 15, 2020 at 1:50 pm #15905Mark WilliamsKeymasterthat 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 --
June 16, 2020 at 6:53 am #15908steveParticipantWhen 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.
June 16, 2020 at 11:53 am #15909Mark WilliamsKeymasterWe 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 --
June 17, 2020 at 3:12 am #15910steveParticipantAfter 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.
June 17, 2020 at 11:51 am #15913Mark WilliamsKeymasterplease contact sales @ ozzmaker.com
Mark --OzzMaker.com --
- AuthorPosts
- You must be logged in to reply to this topic.