DEV Community

Lapnito Development studio
Lapnito Development studio

Posted on • Originally published at lapnito.cz

I Built an Offline Compass App That Tells You When Not to Trust It

We built NorthPin — a free, offline compass app for Android and iOS that points to true north, flags magnetic interference, and lets you lock a bearing while you walk. No ads, no tracking, no internet required.

If you've ever watched a compass needle jitter wildly next to a car or near a doorframe and wondered whether you can actually trust it, that's the problem we wanted to solve.

What Does It Do?

NorthPin turns the magnetometer in your phone into a reliable navigation instrument. You open it, it shows your heading in 0–360°, and it tells you when the reading is trustworthy and when it isn't.

Core features:

  • True North with declination — corrects the raw magnetic reading to geographic north
  • Smooth, stable heading — filtered readings so the needle doesn't shake at standstill
  • Magnetic interference detection — warns you when nearby metal, electronics, or magnets are distorting the field
  • Microtesla (µT) meter — shows field strength so you can see why the reading is off
  • Guided figure-eight calibration — walks you through the sensor calibration motion
  • Pin Direction — lock a bearing and track your deviation from it while walking
  • Shareable diagnostic reports — copy the current state for troubleshooting or sharing

No ads, no in-app purchases, no data collected, no network access.

How It Works Under the Hood

Every modern phone has a 3-axis magnetometer — a tiny sensor chip (usually a Hall-effect or magnetoresistive element) that measures the magnetic field along the X, Y, and Z axes. Combined with the accelerometer (for gravity direction) and optionally the gyroscope (for angular velocity), it can compute which way the phone is pointing in the world.

The heading is the angle between the horizontal component of the magnetic field and magnetic north:

heading = atan2(Y_horizontal, X_horizontal)
Enter fullscreen mode Exit fullscreen mode

But that gives you magnetic north, not true north. The Earth's magnetic field doesn't align perfectly with the geographic poles — it drifts and varies by location. The difference between them is called magnetic declination.

Magnetic Declination

Declination can be anywhere from −20° to +20° depending on where you are on the planet. In central Europe it's around +4° to +6°. In the western United States it can be +10° to +15°. Ignoring declination means your "north" could be a full 15 degrees off — enough to miss a trailhead by hundreds of meters on a long hike.

NorthPin uses the World Magnetic Model (WMM) to compute declination for a given latitude and longitude, then adjusts the heading:

true_heading = magnetic_heading + declination
Enter fullscreen mode Exit fullscreen mode

The Interference Problem

The magnetometer is sensitive to any nearby ferrous metal, electric current, or permanent magnet. Car dashboards, metal desks, laptop speakers, even the magnet in a phone case — all distort the field.

The trick to detecting interference is checking the total field magnitude:

|B| = sqrt(Bx² + By² + Bz²)
Enter fullscreen mode Exit fullscreen mode

Earth's magnetic field at the surface is remarkably consistent: roughly 25–65 µT depending on latitude. If your phone suddenly reads 120 µT, you're not in a magnetic anomaly — you're next to a speaker.

NorthPin continuously monitors |B| and flags readings that fall outside the expected envelope. When interference is detected, the app tells you why the reading is unreliable instead of silently giving you a wrong direction.

Smoothing Without Lagging

Raw magnetometer output is noisy. Naive approaches — "just average the last 10 readings" — work but make the needle feel sluggish. We use a low-pass filter with a dynamic time constant:

heading_smoothed = α × heading_raw + (1 - α) × heading_previous
Enter fullscreen mode Exit fullscreen mode

α (alpha) changes based on how much the heading is actually moving. When you're standing still, α is small (heavy smoothing, stable needle). When you rotate the phone, α increases (less smoothing, responsive needle). The result feels instant when you move and rock-steady when you don't.

Figure-Eight Calibration

Magnetometers accumulate bias over time. Re-magnetization from nearby magnets, temperature drift, and factory variation all shift the zero point. The fix is to move the phone through multiple orientations so the sensor sees the full 3D sphere of possible readings. The classic motion for this is a figure-eight in the air — it rotates the phone through enough attitudes that the calibration algorithm can re-center the zero.

NorthPin has a guided calibration flow that tells you when you need to re-calibrate (based on field magnitude drift) and walks you through the motion.

Pin Direction

The feature we use most often is Pin Direction. You point the phone at a landmark, tap to pin the bearing, and then while walking, the app shows you how far off that bearing you are in real time.

Practical use cases:

  • Hiking off-trail and wanting to maintain a consistent direction toward a distant peak
  • Returning to camp after a day hike when the landmark is no longer visible
  • Cross-country skiing in flat terrain where everything looks the same
  • Emergency navigation when a GPS has drained and you still need to get down the mountain

Because NorthPin is fully offline, Pin Direction works on airplane mode, in the backcountry with no signal, and in caves or basements where GPS is useless.

Why We Built This

We're a small Czech studio (lapnito.cz) and we hike. A lot. We also noticed that almost every "compass" app on the stores does one of three things: shows ads over your map, demands location permissions it doesn't need, or gives you a single number with no indication of how much to trust it.

We wanted a tool that behaves like a proper instrument — shows you the reading, shows you the confidence, and gets out of the way. That's NorthPin.

Try It Out

NorthPin is free on both platforms:

We'd love to hear your feedback — drop a comment or reach us at tom@lapnito.cz.


Built by Lapnito Development Studio — lightweight tools & utility apps from Czech Republic.

Top comments (0)