Hi!
I have a APM 2.5.2 board with 3.2 Copter firmware and have a problem with my on-board compass. So.. i srart callibration in APM planner... and i got offsets like: 10000000, 10000, 5000... every time offsets different.
I try callibration in Mission Planner... And I cant get white dots... it looks like this(i rotate apm around all axes):
I have check 3.3V regulator... 3.311V on I2C port.
Can someone help me? I have bad HMC5883L onboard chip?
Replies
So... if someone want to know...
Next step is I tried to use external HMC5983 compass:
And i got next diagram and offsets:
And next i resoldered on-board HMC5883L compass:
And got:
Hope this will be helpful for someone.
I just cut external compass jumper at APM, take a CRIUS board...solder two wires to 3.3V I2C... and connect it to I2C APM port...
and:
One more fact about faulty compass.
But I want to hear from the competent person that my on-board compass is faulty.
I downgrade firmware to 2.9 and... see in terminal then APM starts:
"COMPASS INIT ERROR"
Also i litbit modified MissionPlanner...
In standard version: "
float minx = 0;
float maxx = 0;
float miny = 0;
float maxy = 0;
float minz = 0;
float maxz = 0;
"
and also:"
if (minx > 0 && maxx > 0 || minx < 0 && maxx < 0 || miny > 0 && maxy > 0 || miny < 0 && maxy < 0 || minz > 0 && maxz > 0 || minz < 0 && maxz < 0)
{
e.ErrorMessage = "Bad compass raw values. Check for magnetic interferance.";
ans = null;
ans2 = null;
return;
}
"
but if its initialisated by "0" value then algorithm finds minimum values by:
...
setMinorMax(rawmz, ref minz, ref maxz);
...
private static void setMinorMax(float value, ref float min, ref float max)
{
if (value > max)
max = value;
if (value < min)
min = value;
}
and maximum value maxz/maxy/maxx (if raw value -100 for example) never will be lower than "0"... (because raw = -100 < 0); and conditions "minz < 0 && maxz < 0" will never be satisfied.
so i modified code to:
float minx = 1000;
float maxx = -1000;
float miny = 1000;
float maxy = -1000;
float minz = 1000;
float maxz = -1000;
and also modified Calibration Window to show maxx, maxy, maxz, minx, miny, minz values.
and what i got:
And i check compass in CLI in test mode... i got same result: raw z axis value never go upper than around -190...
I guess my compass's z axis is faulty...
But i can't understand why nobody don't say about this problem here... :(
I tested compasses on two boards with arduino sketch...
Results:
"Bad board":
Raw: 40 -169 295 Scaled: 36.80 -155.48 271.40 Heading: 5.10 Radians 292.23 Degrees
maxX:980 maxY:575 maxZ:8623
minX:-558 minY:-517 minZ:56
"Good board":
Raw: 147 -39 -917 Scaled: 133.40 -35.88 -843.64 Heading: 6.18 Radians 353.86 Degrees
maxX:466 maxY:487 maxZ:8
minX:-627 minY:-625 minZ:-970
Z axis of "Bad board" is defective?
HMC5883L.rar
Arduino_HMC5883L_Universal_test.hex
I calibrated compass on another board through mission planner... and at that board is ok.
Maybe i can test on-board compass with some arduino sketch?