March 3, 2020 at 9:33 am #15196
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 youMarch 3, 2020 at 10:19 am #15197jimbParticipant
Did 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 #15203
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 rotatedMarch 3, 2020 at 9:45 pm #15217
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:March 4, 2020 at 12:05 am #15220
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?March 4, 2020 at 4:33 am #15225
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.March 4, 2020 at 3:27 pm #15234
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
Can you add;
printf("beforeCal magRaw X %i\tmagRaw Y %i \tMagRaw Z %i ---- ", magRaw,magRaw,magRaw);
And then do the same test as before were you showed us the first 100 lines or so while rotating it.March 5, 2020 at 2:32 am #15246
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:March 6, 2020 at 7:07 pm #15281June 13, 2020 at 12:59 am #15885
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.June 15, 2020 at 1:50 pm #15905
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?June 16, 2020 at 6:53 am #15908
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.June 16, 2020 at 11:53 am #15909
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
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?June 17, 2020 at 3:12 am #15910
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.June 17, 2020 at 11:51 am #15913
- You must be logged in to reply to this topic.