Close
0%
0%

Magnetic Field Scanner

The MFS is a magnetic field mapping instrument used to locate ferrous objects, like property pins. ESP32-S3 and RM3100 based.

Public Chat
Similar projects worth following
A professional-grade, open-source spatial magnetic gradiometer designed to detect buried ferromagnetic anomalies (property pins, pipes, and other magnetic field distortions caused by magnetic field generating objects) by isolating highly localized magnetic gradients from the Earth's background magnetic field. Powered by an Waveshare ESP32-S3-Touch-LCD-3.49 and utilizing dual PNI RM3100 magneto-inductive sensors, this device achieves nanotesla-level sensitivity, executing 9-parameter ellipsoidal matrix calibrations and real-time Madgwick AHRS sensor fusion to provide an intuitive, HUD-style interface and audio feedback on a high-speed LCD. Current state of affairs is a working and assembled MFS which has been fully characterized in it's current form. Looking at possibility of adding third PNI RM3100, GPS, and further refining it's detection ability. Further field testing to locate unknown property pins is also expected to continue the real-world analysis.

Problem Description

I was inspired to create this project when a new development started on an adjacent property and I wanted to be assured that this development would not infringe on my property lines. 

I started with the basics, and began researching my deed and the deeds of the adjacent properties and this was an interesting journey in and of itself. Suffice to say that locating property pins from a deed description, even with the help of AI to translate the bearings and strange worded descriptions into GPS coordinates, and the given accuracy of GPS coordinates, didn't work as easily as one would think.

Next I tried a metal detector I borrowed from a friend. Even with a few known property pins I could see that using a metal detector wasn't going to make it any easier.

With more research and I found out about magnetic property pin locators (e.g. Schonstedt - Magnetic Locator) that surveyors use. These professional level instruments run $600 to $1,000 or more. But the premise is they detect the magnetic field distortions and acquired magnetic properties of property pins that have been being pounded into the earth and sitting there for years.

To my current understanding, these instruments detect the magnetic field line differences and distortions in a localized area. In my case I installed two RM3100 Tri-Axis Magnetometer Sensors 24" apart inside a fiberglass tube and connected these to a ESP32-S3 based touch display from Waveshare.    

Let me know what you think.

Core Components

  • Base Platform: Waveshare ESP32-S3-Touch-LCD-3.49 v3 (PCBA v1.1 silkscreen). This highly integrated device provides the MCU, display, audio, and power management core.
  • MCU: ESP32-S3 (16MB Flash, OPI PSRAM) embedded on the Waveshare board.
  • Magnetometers: 2x RM3100 (TIP (at 0") and REF (at 24") sensors), with hardware reserved for a 3rd (NEAR at 8").
  • IMU: QMI8658 (6-axis Accelerometer & Gyroscope) offset mechanically by 60° relative to the wand axis.
  • Display: 172x640 QSPI LCD with capacitive touch.
  • Audio Codec: ES8311 / ES7210 via I2S for audio feedback.
  • Storage: External SPI SD Card + Internal FFat (Flash).
  • Wiring: See the MFS Wiring Diagram.
  • RTC: PCF85063 for precise timestamping.
  • I/O Expander: TCA9554 to offload static control pins (Backlight, Resets) and free up high-speed GPIO.

Pin Allocations & Rationale

To support this many peripherals on a single ESP32-S3, strict pin management and an I2C I/O expander are utilized.

FeatureGPIO / PinProtocol / TypeRationale
I2C BusSDA: 47, SCL: 48I2CShared bus for RM3100s, IMU, RTC, and TCA9554 IO Expander (capped at 200kHz for cable capacitance).
I2S AudioMCLK: 7, BCLK: 15, WS: 46, DIN: 6, DOUT: 45I2SFull duplex audio codec interface.
SD CardCS: 38, MOSI: 39, MISO: 40, SCLK: 41SPIDedicated high-speed SPI bus for high-bandwidth data logging.
LCD DisplayCS: 9, PCLK: 10, D0-D3: 11, 12, 13, 14, TE: 21QSPI / 8080High-speed bus dedicated to driving the 172x640 LVGL display.
Battery ADC4Analog (ADC1)Dedicated for battery voltage monitoring.
RM3100 DRDYTIP: 3, REF: 2, NEAR: 5InterruptDirect hardware interrupts for DRDY synchronization.
Future GPSTX: 43, RX: 44UARTReserved. Freed up by migrating static control pins to the IO Expander.

TCA9554 I/O Expander (Address 0x20)

Used to handle low-speed/static signals to conserve MCU pins:

  • P0: Touch Interrupt
  • P1: LCD Backlight Enable
  • P2 / P3: IMU Interrupts 1 & 2
  • P4: RTC Interrupt
  • P5: LCD Reset
  • P6: System Power Enable (Keep-alive)
  • P7: Night/Sleep Mode

Software Architecture (v5.x.x)

The software is built on the Arduino ESP32 Core but heavily utilizes ESP-IDF native features and FreeRTOS for professional-grade isolation and performance.

1. Synchronized POLL Architecture & FreeRTOS

The v5.x.x architecture completely eliminates I2C collisions and phase-drift by orchestrating synchronized measurements:

  • POLL Mode: The ESP32 broadcasts a simultaneous REG_POLL command to both RM3100 sensors across the I2C bus.
  • Event Groups (Core 0): The Sensor Task sleeps...
Read more »

  • 1 × Waveshare ESP32-S3-Touch-LCD-3.49 v2 High-performance, highly integrated microcontroller development board designed by Waveshare. It is equipped with a 3.49inch capacitive HD IPS screen, a highly integrated power management chip, a 6-axis IMU (3-axis accelerometer and 3-axis gyroscope), an RTC, a low-power audio codec chip, and echo cancellation circuitry, facilitating development and integration into end products.
  • 2 × RM3100 Tri-Axis Magnetometer Sensor

  • Discovering the "Dipole Halo" & The Polargraphic UI

    Roland • 10/06/2026 at 18:05 • 0 comments

    When building a high-sensitivity magnetic gradiometer to hunt for buried property pins, you eventually have to confront the fact that magnetic fields are three-dimensional, twisting, invisible shapes. Just displaying the absolute magnitude (sqrt(X^2 + Y^2 + Z^2)) is great for telling you something is there, but it doesn't tell you what it is or exactly where the edges are.

    I wanted the wand to be able to instantly distinguish between a vertical property pin and a horizontal iron pipe.

    The Physics: Vertical Pins vs. Horizontal Pipes

    A vertical iron property pin driven into the earth acts as a magnetic dipole (magnetized by the Earth's field). In the Northern Hemisphere, the top of the pin acts as a South pole. The magnetic field lines exit the deep North pole, travel upwards through the surrounding dirt, and curve to dive straight downwards into the top of the pin.

    Conversely, a pipe laying flat on the ground is a horizontal dipole. Its magnetic field lines run purely horizontally along the length of the pipe.

    If I could isolate just the pure vertical component of the magnetic gradient, I could theoretically see the difference! A horizontal pipe would show zero vertical gradient. But a vertical pin would show a massive downward field right on top of it, surrounded by a ring (a "halo") of upward-traveling return field lines.

    The Math: Gravity Vector Projection

    Because this wand is meant to be swung back and forth, the physical sensors are constantly tilting. Simply reading the Z-axis of the magnetometers wouldn't work, because the wand's Z-axis isn't always pointing straight down at the ground.

    To solve this, we took the live quaternion from our 6-DOF IMU (which acts as an AHRS tracking Earth's gravity) and extracted the true "Down" vector in the sensor's local coordinate frame. We then took the dot product of our 3D magnetic gradient against this Down vector.

    This successfully isolated "trueZ" —the pure vertical component of the magnetic field, completely independent of how the wand is tilted or swept.

    Validating the Dipole Halo!

    To test the math, we logged data while sweeping over a real vertical property pin. The results were absolutely beautiful. When hovering dead-center over the pin, "trueZ" registered a massive +60,000 nT (field lines pointing straight down). But the moment the wand shifted a few inches off-center,  "trueZ" plummeted across zero and hit -21,000 nT!

    The sensor was physically detecting the invisible "halo" of return field lines traveling upwards out of the dirt!

    The Polargraphic Display & Log10 Scaling

    To give the user a way to instantly "feel" this physics phenomenon, we completely revamped the LVGL UI on our 3.49" (172x640) Waveshare Bar LCD.

    1. The Polargraphic Arc: The sweeping visual indicator is now split down the middle. A negative vertical gradient (the halo) pulls the arc to the Left in bright Blue. A positive vertical gradient (dead-center over the pin) pulls the arc to the Right in bright Red.
    2. Log10 Scaling: A property pin can blast the gradient to nearly 200,000 nT at close range, which was constantly "pegging" our visual UI. We implemented a log10 scaling curve: log10((nT/100)+1). Now, 0-1,000 nT covers the first 25% of the sweep (providing extreme visual sensitivity for distant signals), but the arc smoothly scales all the way up to 1,000,000 nT without ever hitting a hard ceiling.

    The wand can now instantly identify a vertical property pin simply by sweeping across it—you watch the arc swing hard Blue (entering the halo), snap hard Red (dead center), and swing back Blue (exiting the halo).

    It's one thing to know the physics exist, but watching a microcontroller mathematically unfold invisible magnetic field lines in real-time is incredibly satisfying.

View project log

  • 1
    Step 1

    How to Build & Deploy

    Prerequisites

    • Environment: Arduino IDE v2+ or VSCode/Arduino.
    • Core: ESP32 Board Package v3.3.x (ESP-IDF v5 based).

    Arduino Board Settings (ESP32-S3 Dev Module)

    • USB Mode: Hardware CDC and JTAG
    • PSRAM: OPI PSRAM
    • Flash Mode: QIO 80MHz
    • Flash Size: 16MB (128Mb)
    • Partition Scheme: app3M_fat9M_16MB 
    • Core Debug Level: None (for performance)

View all instructions

Enjoy this project?

Share

Discussions

Kritish wrote 10/07/2026 at 07:00 • point

Two RM3100s at 24" is a solid setup. The thing that usually limits a homemade gradiometer is mismatch between the two sensors, since any difference in gain or axis alignment shows up as fake gradient when you tilt the tube. Rotating it slowly in an open area away from metal and solving for one sensor relative to the other cleans that up a lot. Also keep the battery, display, and any steel screws far from the sensors, or at least fixed in place.

  Are you sure? yes | no

Roland wrote 10/07/2026 at 12:42 • point

Thanks @Kritish for your comments. Both sensors have a Kabsch Rotational matrix fit using a 9-parameter Least-Squares Ellipsoid Fit to correct each sensor for Hard and Soft Iron magnetic distortions. The result allows for correction of the small axis alignment. And I attempted to minimize the axis misalignment mechanically with the PLA printed parts I secured the boards to. It's not perfect, but close enough for the concept testing. I may rethink some of the mechanical aspects in the future. I use no metal at both sensor locations. Even avoided aluminum bar stock (my original plan for securing the sensors) as the possibility of eddy current being introduced as the wand moved through the earths magnetic field. The display and battery are mounted about 18" diagonally from the reference sensor, also to reduce the interference.

I am interested in any experience you have regarding improving the sensitivity. My field tests show I can detect the a property pin around 3 to 4' away. I recently changed the display to be polargraphic like the commercial versions. I have yet to characterize that. It determines the trueZ vector of the magnetic field, independent of the wand angle. 

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates