Calibration of the compass on Xiaomi: why the smartphone incorrectly shows the cardinal directions and how to fix it

The compass in Xiaomi smartphones is not just an extra feature for tourists or for orientation, it is critical for work. AR-applications, navigation in Google Maps or Yandex.Maps, as well as for the correct operation of certain games (for example, PokΓ©mon GO). However, many users have a problem when the compass needle jumps, shows the wrong direction or refuses to work at all, and 80% of the time the fault is a demagnetized sensor or software failure that can be fixed on its own.

In this article, we'll look at all the ways that compasses can be calibrated on Xiaomi, Redmi and POCO smartphones, from standard MIUI tools to hidden engineering menus, how to test the sensor's performance, why the calibration is reset after rebooting, and what to do if nothing works, and a unique method of recovering the magnetic sensor without resetting, which is not even written about in official forums.

Why Xiaomi Compass Lies: 5 Reasons Why It Is Lie

Before you start calibrating, it's important to understand what caused the failure, and most of the time, it's not hardware failure, it's software or external factors that are the most common causes.

  • 🧲 Exposure to magnetic fields: Even a brief exposure to speakers, speakers, induction plates or magnets can knock down the sensor.
  • πŸ“± Programming errors MIUI: after updating the firmware or resetting the settings, the calibration may fly.
  • πŸ”‹ Battery discharge below 15%: at critically low charge, the system turns off the precise operation of sensors to save energy.
  • πŸ› οΈ Physical damage: falls or impacts can displace the magnetic sensor (especially in models with metal body).
  • 🌍 Geomagnetic anomalies: In some regions (for example, the Kursk magnetic anomaly), the compass may behave unstablely.

Fun fact: Xiaomi smartphones are designed to run the compass with an AK09918 chip (or similar one), which combines a magnetometer and an accelerometer. If the sensor is physically damaged, calibration won't help, you'll need a replacement board, but 95% of the time, the problem is solved by software.

πŸ“Š Your Xiaomi smartphone has ever shown the wrong direction in a compass?
Yeah, often.
Yeah, but rarely.
No, it always works.
I didn't use a compass.

How to check if a compass needs calibration

Before you set up the sensor, make sure it's the one that's the problem. Here are 3 ways to diagnose:

  1. Standard Compass: Open the built-in Compass app (if not available, download from Google Play). If the arrow twitches chaotically or shows a clearly wrong direction (for example, north where south should be) - the sensor requires calibration.
  2. Engineering menu: Enter ##6484## in the phone dialer (newer models may not work). In the Sensor Test menu, select Magnetic Field and look at the charts. If the lines are chaotic or X/Y/Z values are close to zero, the sensor is not calibrated.
  3. GPS Status & Toolbox: Download it from the Play Market and go to the Compass tab. The app will show not only the direction, but also the level of interference (if it is above 30% - the sensor requires adjustment).

⚠️ Note: if the sensor does not respond at all (X values) during the test in the engineering menu=0, Y=0, Z=0), this may indicate a hardware breakdown, in which case the calibration is useless - contact the service center.

πŸ’‘

Before calibration, turn off magnet covers (for example, to attach to the holder in the car) - they can distort the sensor readings.

Method 1: Standard calibration through MIUI settings

The simplest method that works on most Xiaomi, Redmi and POCO models (including Redmi Note 12, POCO X5, Xiaomi 13).

  1. Open the Compass app (if not, download it from Google Play).
  2. Hold the phone horizontally and rotate it on all axes (as if drawing an eight in the air).
  3. The screen will show a hint β€œCalibration of the compass” with the progress bar. Wait for completion (usually takes 10-20 seconds).
  4. If the calibration does not start automatically, tap the screen – sometimes confirmation is required.

Once you've successfully calibrated, the shooter should stabilize, and if you don't, move on to the next method.

Make sure there are no magnets or electronic devices nearby.|

Charge your phone to at least 30% |

Enable In-Air mode (to avoid network interference)|

Remove the cover (especially with metal elements)-->

Method 2: Calibration through the engineering menu (for advanced)

If the standard method didn’t work, try manually adjusting through a hidden menu, which is suitable for most MIUI 12-14 models, but may vary depending on the firmware version.

Instructions:

  1. Open the Phone app and enter the code ##6484## (some models may run ##4636## β†’ Sensor Test).
  2. Select Sensor Test β†’ Magnetic Field.
  3. Look at the charts X, Y, Z. If they are chaotic, press Calibrate (if there is such a button).
  4. If there is no button, manually rotate the phone on all axes (as in method 1), then press Save or Apply.
  5. Reboot your smartphone.
Xiaomi modelDoes the code ##6484## work?Alternative code
Redmi Note 10/11/12Yes.##4636##
POCO X3/X4/X5Yes (sometimes required) SIM-map)##36446337##
Xiaomi 12/13/14No (locked)Use the Sensor Test app from the Play Market
Redmi 9/9A/9CYes.##64663##

⚠️ Warning: Do not change other settings in the engineering menu unless you are sure of their purpose! Incorrect settings can lead to network loss or camera failure.

Method 3: Reset sensor settings (if nothing helps)

If the compass is still lying, try resetting all the sensors, and it won't delete your data, but it will return the factory parameters of the gyroscope, accelerometer and magnetometer.

Instructions:

  1. Go to Settings β†’ About the phone β†’ All the characteristics.
  2. Find the MIUI version and tap it 7-10 times until you see the caption β€œYou’ve become a developer!”
  3. Back to Settings β†’ Additionally. β†’ For developers.
  4. Find the Sensor Calibration Reset option and confirm the action.
  5. Reboot the phone and recalibrate (method 1 or 2).

After resetting, you may need to reset the gyroscope (for example, for games), open any gyro-enabled game (for example, PUBG Mobile) and perform a training calibration.

What to do if the item "Reset sensor settings" is not?
Alternatively, 1. Install QuickShortcutMaker from Play Market. 2. Find the action com.android.settings.SensorReset. 3. Run it and confirm the reset. After that, restart the phone.

Method 4: Calibration through ADB (for power users)

If standard methods don’t work, you can try calibrating the sensor via Android Debug Bridge (ADB), which requires a computer and basic command line knowledge.

Instructions:

  1. Download and install ADB Tools on your computer.
  2. Turn on the phone debugging over USB (Settings β†’ For developers).
  3. Connect your phone to your PC and type in the command line: adb shell su echo"1" > /sys/class/sensors/magneticfield_sensor/calibration (If you request root rights, grant them).
  4. Reboot the phone.

⚠️ Warning: This method requires an unlocked bootloader and root rights. Wrong commands can result in a loss of warranty or device blink!

πŸ’‘

If the compass is knocked down again after a few days, the problem may be a hardware malfunction, in which case only replacing the magnetic sensor in the service center will help.

Frequent calibration errors and how to avoid them

Many users make the same mistakes that make the calibration fail.

  • πŸ“΅ Calibrate near metal objects: keys, coins, knives, or even metal furniture distort the magnetic field.
  • πŸ”„ Interrupt the process: if you interrupt the calibration on the half, the sensor can β€œhang” in an incorrect state.
  • πŸ“² Use magnet covers: even after calibration, they will knock down readings.
  • πŸ”‹ Calibrate at low charge: At a battery level below 15%, the system can ignore sensor settings.
  • 🌐 Staying in the weak signal zone GPS: For accurate calibration, a stable signal from satellites is required.

If you make one of these errors, recalibrate the calibration, and in most cases, this is enough to restore the compass.

FAQ: Answers to Frequent Questions About Xiaomi Compass Calibration

The compass works right after calibration, but it gets lost again a day later.
This is a typical problem for Xiaomi smartphones with a metal body (such as the Xiaomi 11T or Redmi K50).The reason is induced currents in the metal, which over time demagnetize the sensor. Solutions: Use a case of non-magnetic materials (such as silicone); Calibrate the compass every 2-3 days (this is the norm for such models); Turn off automatic location determination in Google settings (sometimes it knocks down sensors).
My Xiaomi doesn't have a built-in Compass app. What do I do?
Some regional MIUI firmware doesn't have this app. Alternatives: Download Google Compass from Play Market. Install Compass Galaxy or Digital Compass. Use Google Maps: tap twice on the blue dot of your location and a mini compass will appear. To calibrate through third-party apps, select Calibrate or Reset in your settings.
Can I calibrate a compass without an engineering menu?
Yes, there are several ways: Use the Sensor Test app from the Play Market, which has a built-in calibration function. Turn on Google Maps, click on the blue dot and select Compass Calibration. Set up GPS Status & Toolbox and use Manage Aiding Data β†’ Reset.
After calibration, the compass shows a 20-30 degree error. Is that normal?
No, the normal error for a smartphone is up to 5-10 degrees. If the error is larger, it means: Calibration was incorrect (repeat the process). The sensor is partially damaged (check in the engineering menu). The phone has an external magnetic field (check next to other devices). If the problem persists, try resetting the sensors (see Method 3).
Do I need to calibrate the compass after replacing the battery?
Yes, if the battery was replaced with a sensor plume (which happens in 70% of cases). Even if the compass works, its accuracy may deteriorate. After the battery is replaced: Perform standard calibration (mode 1). Check the sensor's performance in Sensor Test. If the error is high, reset the sensor settings (mode 3).