Strange problem with the compass

577 views
Skip to first unread message

Clemens Jensen

unread,
Jun 24, 2022, 9:48:08 AM6/24/22
to OsmAnd
Hi! I have a problem with the compass that I don't understand.

On my new moto g40 in Osmand+ the compass acts wrong, it directs always more or less to the bottom of the smartphone instead to North. When I move the phone, the compass moves also, but within half a second it again points to the bottom of the phone. Calibration with sereral compass apps is not possible. So one could think, the compass in my phone ist broken.

But in Google maps the compass works perfectly, it can be calibrated within Google maps, and Google maps displays a high reliability of the compass. This shows that the compass is working correct, at least under special condtions which I don't know ...

What can be the reason that the compass doesn't work in Osmand+, but works perfectly in Google maps? Is there anything I can adjust? (I tried also changing the settings for Kalman filter and magnetical sensor in Osmand+, but that didn't change anything.)

Does anyone have an explanation for this strange behaviour or an idea how to solve this problem?

Greg Troxel

unread,
Jun 24, 2022, 9:57:24 AM6/24/22
to Clemens Jensen, OsmAnd

Clemens Jensen <clemens...@gmail.com> writes:

> But in Google maps the compass works perfectly, it can be calibrated within
> Google maps, and Google maps displays a high reliability of the compass.
> This shows that the compass is working correct, at least under special
> condtions which I don't know ...

Google everything has lots of extra opaque proprietary software. So
that only shows that it works with the extra proprietary software not
that the normal API works.

I would try SatStat and look at the compass data, and also try Trail
Sense. I would also suggest searching for other compass issues with
your phone model.
signature.asc

Clemens Jensen

unread,
Jun 24, 2022, 10:40:59 AM6/24/22
to OsmAnd
Thank you, Greg! I tried SatStat and Trail Sense. The azimuth always still is between 180 and 190 °. Strange to say that Trail Sense states a good reliability though the compass doesn't work correctly.
Screenshot_20220624-162253.pngScreenshot_20220624-162305.pngScreenshot_20220624-162505.png

Greg Troxel

unread,
Jun 24, 2022, 11:49:32 AM6/24/22
to Clemens Jensen, OsmAnd

It looks then like the compass is reporting bad data via the normal
api. perhaps compare with those programs and other phones in the same
place, outside, at the same orientations, and see if you can figure
anything out?
signature.asc

David Lymn

unread,
Jun 24, 2022, 6:12:38 PM6/24/22
to osm...@googlegroups.com
Maybe Google is using wifi towers to create a compass bearing. This software might only work when the phone is moving. You need to look at your phone specifications to see if it has compass hardware.

--
You received this message because you are subscribed to the Google Groups "OsmAnd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osmand+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osmand/rmi4k0amaf6.fsf%40s1.lexort.com.

lodrog...@gmail.com

unread,
Jun 25, 2022, 12:37:59 AM6/25/22
to OsmAnd
according to gsmarena spec pages, there only one Motorola Moto G40 model, this one
https://www.gsmarena.com/motorola_moto_g40_fusion-10862.php

and this model does not have compass

Clemens Jensen

unread,
Jun 25, 2022, 6:15:38 AM6/25/22
to OsmAnd
@lodrog, @davi: Sorry, my mistake. It's a g41, not a g40, and it indeed has a compass.

@Greg: I already tried all your suggestions: the old phone also in other environments. The old worked perfect, my g41 compass always shows the same wrong behaviour.

What I still don't understand: Why does it work with Google maps, even if they may have special software? Google maps also can use only this one compass and can read it correctly.

Greg Troxel

unread,
Jun 25, 2022, 7:26:50 AM6/25/22
to Clemens Jensen, OsmAnd

Clemens Jensen <clemens...@gmail.com> writes:

> @Greg: I already tried all your suggestions: the old phone also in other
> environments. The old worked perfect, my g41 compass always shows the same
> wrong behaviour.

Did you run satstat on them, and look at Bx By Bz values?

> What I still don't understand: Why does it work with Google maps, even if
> they may have special software? Google maps also can use only this one
> compass and can read it correctly.

That's a question for Motorola or Google; the problem with proprietary
software is that only they can answer the question.
signature.asc

Clemens Jensen

unread,
Jun 25, 2022, 7:47:26 AM6/25/22
to OsmAnd
Thank you Greg!

I can't interpret the Bx By Bz values. SatStat shows this (pic 1 phone directed to North, pic 2 to East, pic 3 to South, pic 4 to West):

Screenshot_20220625-133416.pngScreenshot_20220625-133436.pngScreenshot_20220625-133443.pngScreenshot_20220625-133451.png

Greg Troxel

unread,
Jun 25, 2022, 9:10:12 AM6/25/22
to Clemens Jensen, OsmAnd

Clemens Jensen <clemens...@gmail.com> writes:

> I can't interpret the Bx By Bz values. SatStat shows this (pic 1 phone
> directed to North, pic 2 to East, pic 3 to South, pic 4 to West):

They are the three components of the magnetic field. That's what the
phone actually measures and from that computes an orientation. I have
no idea where you are, and don't even know the values around me. My
point is that with two phones, I think you should be seeing similar
values. By taking two of them outside away from metal, and orienting
them the same, and seeing the values, and then repeating, you should be
able to gain some insight into whether the problem is the raw
measurements, or something later in the processing chain.

In your case, with the suspect phone, it looks like all 4 positions have
similar Bx/By/Bz values. Mine change as I rotate, but not in a way
that's easy to understand.
signature.asc

Clemens Jensen

unread,
Jun 25, 2022, 9:41:23 AM6/25/22
to OsmAnd
Hi Greg, thank you! I installed SatStat on my old phone, and the Bx By Bz values vary when I change the orientation of the phone, and they are completely different to the values on my new one.

I give up. Nevertheless many thanks!

Peter B - pebogufi

unread,
Jun 25, 2022, 12:28:30 PM6/25/22
to OsmAnd
Two more tools to read hardware info:
 + Droid Hardware Info / InkWired
 + phyphox / RWTH Aachen University

Ken Evans

unread,
Jun 27, 2022, 7:44:00 AM6/27/22
to osm...@googlegroups.com
Hello guys. I am quite familiar with magnetic measurements, compasses in general. There is a glaring elephant in the room when it comes to using these sensors on a phone. 

If a phone case or pouch has a magnetic clasp, which many do, the magnets used will nearly always put the sensors well out of calibration. This can render them incapable of indicating North and get stuck in the wrong direction. 

They can easily be recalibrated, by moving the phone at arms length in a wide figure of right pattern. However simply closing a case or replacing into a pouch can loose cal again. Currently my phone, a Pixel 2 indicates North in any direction !

For reference earth's magnetic field in the UK is about 45μT. It varies around the world getting as high as 60 in certain places. Currently my phone has a total field measurement of 168μT, hugely too high, caused mainly by one sensor, the Bz. The earth's field is given by 
H = square root(Bx^2+By^2+Bz^2)

Not sure what Maps does regarding calibration, although it's possible it could handle the sensor data as is and make sense of it.

Bottom line remove suspect cases and recalibrate

Hope this is useful.

Ken

--
You received this message because you are subscribed to the Google Groups "OsmAnd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osmand+un...@googlegroups.com.

Clemens Jensen

unread,
Jun 27, 2022, 8:50:27 AM6/27/22
to OsmAnd
Thanks a lot for your support! The two tools "Droid Hardware Info" and "phyphox" unfortunately haven't given any new information.

I use a silicon case without any metal on it, but the first thing I tried some days ago was to remove the case nevertheless and take my measures again. But the problem was the same, the sensor always showed around 180 °, independent from the orientation of the smartphone. Also trying to recalibrate without the case doesn't work.

My By value seems to be too high, it varies between -240 and -290 µT. Together with the Bx and Bz value this leads to an H value of around 280 - much too high, isn't it?

lodrog...@gmail.com

unread,
Jun 27, 2022, 10:32:00 AM6/27/22
to OsmAnd
what i would do if this was happening to me, from the first day of problem appaers

easy way
- hard reset and immediately on first boot, not even connected to internet, i will had to check the issue

hard way
- i must found a same device model to check the issue
- i must visit the repair center (if the device has warranty)

with those conclusions, i will able to decide. It seems very possible to must buy a new device. NOT the same model and company of course.

Ken Evans

unread,
Jun 27, 2022, 10:54:36 AM6/27/22
to osm...@googlegroups.com
280 is definitely way too high. Curious that it appears to be going through zero during movement. I'm guessing the other 2 axes have much less output ? If so the By, along phone, would seem to be faulty, although working with too much sensitivity. It's behaving as though a piece of iron/steel is attached to the phone !

I'm sure you've got this, but just in case, a calibration description is the bottom of this webpage, https://stonekick.com/blog/magnometers-accelerometers-and-calibrating-your-android-device.html
I'm sure this can be found elsewhere too.

On Mon, 27 Jun 2022, 15:32 lodrog...@gmail.com, <lodrog...@gmail.com> wrote:
what i would do if this was happening to me, from the first day of problem appaers

easy way
- hard reset and immediately on first boot, not even connected to internet, i will had to check the issue


Clemens Jensen

unread,
Jun 28, 2022, 5:23:31 AM6/28/22
to OsmAnd
The problem seems to be solved at the moment, though I don't really understand, why.

I also had the thought there must be a piece of metal inside the phone attached to the sonsor, and I already gave up any hope to solve the problem without replacing the new phone, what I don't want.

But as a last chance I tried the app "Accurate Compass" mentioned in the webpage Ken quoted. And, unbelievable, here the calibration immediately was functional, and the compass now works perfectly. The Bx By Bz values now are much lower (in the normal range) than before with values up to 240.

I don't know the reason why the calibration now worked as I tried many different apps to calibrate the phone with the 8-movements without any success. Either this app does something better when calibrating, or there really was a metal peace inside the phone that fell off randomly - I don't know.

Thank you all for your support, that helped at the end, though we still don't know what exactly happened.
Reply all
Reply to author
Forward
0 new messages