1. Introduction
The mapping of magnetic field distribution is in high demand across various technological fields, including geological characterization [
1], non-destructive testing of metal surfaces [
2] or complex (porous) and superconducting surfaces [
3], electromagnetic systems [
4,
5], biomagnetic measurements [
6], and many others. Using mobile magnetic field sensors, it is possible to construct a three-dimensional map of the distribution of scattered magnetic fields generated by magnetic domains or magnetic particles used in magnetic functional devices [
7,
8], which gives valuable information for further developments. The topography of magnetic or superconducting surfaces also creates scattered fields, the distribution of which can be used to monitor the condition of the material. In modern technology, numerous radio devices contain magnetic elements that must operate synchronously without violating electromagnetic compatibility standards. For many applications, such as embedded sensors with remote interrogation, the systems of permanent magnets or electromagnets are required to create a specified magnetic field distribution. The development of new devices and laboratory research typically requires experimental validation of the theoretical calculations and the experimental data obtained. Thus, there are numerous tasks that require the measurement of magnetic field distribution in space.
A wide range of different types of sensors exists for measuring magnetic fields of varying intensities, from extremely weak biomagnetic signals (~pT) to geomagnetic fields (~10 µT) and magnetic fields generated by permanent magnets or superconductors (~T). The most commonly used sensors for mid-range magnetic fields (from µT to mT) are based on the Hall effect. The advantages of Hall sensors include their low cost, compact size, and ability to perform measurements of a vector magnetic field. Although magnetic field sensors are widely available on the market, systems for mapping the spatial distribution of magnetic fields can be quite sophisticated and expensive. Despite the availability of numerous systems for magnetic field mapping, custom-made tools are often necessary for specific tasks, which can allow for simplification and cost reduction.
To achieve this objective, this paper presents a laboratory-developed 3D magnetic field scanner based on Hall sensors (Honeywell HMC5883). The sensor’s sensitive element consists of three sensors arranged perpendicularly, enabling measurements of the magnetic field along three axes. The system’s automation significantly speeds up the measurement process. The scanner is made from plastic parts produced by 3D printing to avoid interference. Scanning is performed at a resolution of up to 0.5 mm, which is limited by the positioning system used. If increased sensitivity and resolution are needed, the base sensor (HMC5883) can be replaced with a more miniature sensing element with higher sensitivity, for example, a magnetoimpedance sensor [
9,
10]. However, in this case only one component of a magnetic field is measured.
Various scanner designs are used in scientific research and industry, each with its own limitations and advantages. The choice of scanning method depends on the specific goals and conditions of the study. For example, magnetic force microscopy enables visualization of local magnetic fields with spatial resolution down to several micrometers; however, it can only produce qualitative images of these fields [
11,
12]. Magneto-optical imaging techniques can provide high spatial resolution and sensitivity; however, they may require special surface preparation. Quantitative measurements of local magnetic fields can be achieved using epitaxially grown rare-earth iron garnet magneto-optical indicator films (MOIFs) [
13]. These sensors, combined with analytical and imaging optics, are suitable for precise measurements such as reconstructing critical currents in superconductors [
14]. MOIFs have also been utilized for current imaging in integrated circuits and for observing domain structures in magnetic materials [
15]. The SQUID magnetometry method offers a record sensitivity of about 1 nT; however, it has low spatial resolution when measuring room-temperature objects due to the significant scanning height—around 10 mm or more—required to cool the sensors to cryogenic temperatures [
16,
17].
Hall effect-based microscopes are widely used and cost-effective, provided that a sensitivity of about 1 µT is adequate [
1,
18,
19,
20,
21]. However, the design can become complex if a fine resolution and higher sensitivity are needed. In [
1], a precision scanner equipped with a gradient-sensitive element was utilized to determine the intricate structures of minerals in thin sections. In [
18], a scanner with permanent magnets and a small scanning area was designed for studying rock samples. The scanner described in [
20] was specifically developed to assess the quality of hybrid foam samples, featuring a larger scanning area of approximately 600 mm × 600 mm. The scanners discussed in [
1,
18,
19] are precision instruments with scanning areas of only a few millimeters, while the scanner in [
20] is more versatile but has a more complex design. An intriguing concept was proposed in [
21], which involved using a 3D printer as a positional controller for the Hall probe. However, the presence of ferromagnetic components (for example, Fe and Ni in guides, bearings, and frame parts), which represent additional field sources, limits the sensitivity to 1 G. During the scanning process, some of them move along the guides, changing the overall distribution of the magnetic field, which cannot be simply subtracted. In [
21], one of the purposes was to map the magnetic fields of assemblies of permanent magnet arrays for cell manipulation. In this case, high magnetic fields and their gradients were needed; therefore, the sensitivity limit was not a problem.
The scanner presented in this paper is designed for low-budget laboratory use, with all plastic components produced through precision 3D printing. Its versatility is highlighted by a scanning area of 100 mm × 100 mm, which is adequate for many scientific tasks. Additionally, its compact size makes it suitable for use in any laboratory setting, including shielded environments when necessary.
2. Design
Developing approaches to creating a customized device/setup for experiments or automatizing the experimental process is essential for any research laboratory. Our objective was to develop a positioning system for the sequential movement of a magnetic field sensor from point to point within the scanning area, which transmits measurement data via a USB interface to a computer in the form of a PLX macro file in Excel.
The use of the ready-made PLX macro for Excel eliminates the need for specialized software on the PC, significantly simplifying the system’s development.
Figure 1 shows a block diagram of the setup of measurement equipment for automated measurements.
A computer model of the 3D scanner was created using OpenSCAD, a design environment for the parametric creation of solid objects. The initial codes for all the components are given in SCAD format and STL files in
Supplementary S1. The 3D model of the scanner is shown in
Figure 2.
With the help of stepper motors, the two Y guides move the X guide across the scanning area in the XY plane. A sensor is mounted on the X guide, which moves along its axis. The rotation of the screws is also driven by stepper motors.
Figure 3 schematically shows the arrangement of the guides, sensor, and other components of the scanner.
3. Build Instructions
The structure, as seen in the computer model shown in
Figure 2, is based on a frame made of plastic and aluminum profiles, with external dimensions of 160 × 170 × 135 mm. The scanner consists of two similar frames, each made up of four metal beams and connecting brackets with cylindrical cutouts for stepper motors. Each level has compartments for the control unit. The housing parts, axial screw guides, and gears are made from ABS plastic components that were precisely manufactured using 3D printing.
The control unit is based on a PIC16F877 microcontroller (Microchip Inc. USA) and module L298N stepper motor drivers (STMicroelectronics, France). Data from the magnetic field sensor are transmitted to the microcontroller via the I2C interface. The sensor chosen as the sensitive element is the Honeywell HMC5883 (Honeywell Inc. USA) [
22], which is based on three Hall effect sensors, amplifiers, a microcontroller, and a 12-bit ADC. All electronic components were purchased at Ali-Express.
This multifunctional miniature sensor measures weak magnetic fields with a full scale of up to 1 mT, has a digital interface, and can be used in mobile devices, electronic compasses, magnetic induction meters, and navigation systems. The I2C serial interface makes it easy to control the sensor and retrieve data from it. The sensor dimensions are 3.0 × 3.0 × 0.9 mm, and it is manufactured in a surface-mount package. The sensor’s sensitive element is based on anisotropic magnetoresistive technology (the planar Hall effect), which provides several advantages, allowing for the measurement of weak magnetic fields with high accuracy, down to 1–10 μT. In this project, a ready-made module (GY-273, China) based on the aforementioned sensor was used, as shown in
Figure 4. This module already includes all the necessary components recommended by the sensor manufacturer for its proper operation.
The stepper motors are located outside the scanning area, have minimal dimensions (7 mm in diameter and 10 mm in height), and are equipped with two control windings.
The step-by-step assembly of the 3D scanner is shown in
Figure 5.
The plastic components of the model are fabricated using a 3D printer, and the aluminum parts of the installation profile are cut to size.
The aluminum beams are connected using corner brackets, following the computer model.
One pair of corner brackets features cutouts for stepper motors, while the other has small cylindrical cutouts for mounting guide screws.
On one side of the scanner, components intended for the control unit installation are attached.
The parts for the movable section of the scanner, which houses the Hall sensor, are shown.
Inside the aluminum housing, elements are affixed on both sides to enable movement along one axis. A guide screw is mounted internally, allowing the sensitive element of the sensor to move along the other axis.
The construction of the movable section is secured to the scanner profile using two guide screws.
The assembly of the scanner, designed to capture components of the magnetic field that are symmetrical relative to one of the measurement axes, is now complete.
A photograph of the assembled scanner is shown in
Figure 6.
4. Operating Instructions
When the device is powered on, the control unit moves the sensor to its initial position, determined by position sensors and an experiment algorithm describing the control unit. Next, if scanning a single plane, the control unit moves the sensor to the right along the
X-axis with a specified step size (see
Figure 2 and
Figure 4) while taking magnetic field measurements. After completing the required number of measurements, the control unit moves the sensor along the
Y-axis, then continues taking measurements by moving the sensor to the left along the
X-axis, and so on, until the entire plane has been scanned.
In the case of full 3D scanning, after completing measurements in one plane, the control unit moves the scanning plane by a specified step along the Z-axis. This process sets the necessary number of measurement planes and the step size between them to analyze the magnetic field distribution at different heights above the sample.
For example, when scanning a single plane with a step of 2 mm, 2350 measurements are taken (47 × 50 matrix), with the scanning taking about 20 min. Full space scanning (50 planes) requires nearly 17 h of measurements. All measurements are transmitted to a PC via a standard USB-COM (TTL) cable and recorded in an Excel file using the PLX-DAQ macro. Detailed information is given on the developer’s website [
24], which is available for free. The macro collects data from the port and organizes them into a data table. By using ready-made macros, the need to develop custom PC software is eliminated.
Since the power electronics (the control unit and stepper motors) generate strong electromagnetic fields, they are temporarily turned off during measurements to avoid interference.
The control timing diagram for the motor is shown in
Figure 7. The motor supply voltage is 5 V, and the pulse current does not exceed 400 mA. Above the timing diagram are the step-by-step sensor measurements (step input). The current phases shown below correspond to the operation of the two pairs of stepper motor stators (phase 1 current, phase 2 current). The first measurement is taken when current is applied to both pairs of stators in antiphase, determining the initial position of the permanent magnet in the stepper motor. Subsequently, the phase of the second stator pair changes. This causes the permanent magnet to rotate 90 degrees from its initial position. By changing the polarity of the current supplied to the stators, the permanent magnet in the stepper motors rotates, moving the magnetic field sensor.
The measured data from the device are transmitted to the PLX-DAQ macros in an Excel file as ASCII codes. The macro is written in Visual Basic [
24], and the source code can be modified by the user (see
Supplementary S2). The macro does not allow for changes to the structure and format of the data; however, it specifies how users should prepare their data for submission. Using the provided service commands, a table is formed. These commands are embedded in the microcontroller program, which determines the format and size of the table, as well as the order of the transmitted data. More details can be found on the developer’s website [
24].
To connect the macro to the PC port, users need to select the appropriate port number, which can be found in the Device Manager under the COM and LPT ports tab, set the baud rate to 9600, and then click Connect.
The control unit is based on a PIC16F877A microcontroller and stepper motor drivers. The calibration of the carriage position is determined by optical sensors. Before the main microcontroller cycle begins, the microcontroller sets the carriage with the sensor in its initial position (point 0; 0; 0) by monitoring the optical sensors. After this, the main program cycle starts, where the sensor moves and the intensity of three components of the magnetic field is measured. During the measurement process, as the carriage moves, a statistical positioning error accumulates, which is countered at the beginning of each measurement by aligning the carriage with the magnetic field sensor to the ‘start’ position according to the signal from the optical sensors. The program’s flowchart is provided in
Supplementary S3. The microcontroller program project and the PCB project are detailed in
Supplementary S4. The PCB layout was created using the Sprint-Layout 6 program. It features a single layer with dimensions of 21 × 64 mm and a copper thickness of 18 microns. Details regarding the placement of components, their types, and the files needed for PCB manufacturing, along with step-by-step instructions, can be found in
Supplementary S4. The technical specifications of the scanner, which come from the Hall probe characteristics and positioning accuracy, are given in
Table 1.
5. Validation
5.1. Test System—A Flat Coil Carrying Current to Generate a Magnetic Field
The scanner’s operation was tested on a sample that consists of a system of flat coils with a large number of turns, manufactured according to the 3rd class criteria of printed circuit board (PCB) technology. The advantages of making coils on PCBs include high precision in their positioning relative to each other. To create a magnetic field of a certain magnitude, a current of up to 0.6 A was passed through the coils from a laboratory power supply.
The system of flat coils consists of two pairs of series-connected coils positioned on the top and bottom of the PCB (overall dimensions of the PCB: 100 × 100 × 2 mm), appearing as shown in
Figure 8. This test system was chosen since its magnetic field distribution is of practical importance. It is used for remote interrogation with embedded magnetic sensing elements. The outer pair of coils is used to magnetize a sensor element with an alternating magnetic field while the inner pair of coils detects the induced electromotive force (emf). The magnetizing coils are connected in the same direction, while the detecting coils are connected in opposition to each other. This coil system was previously used in [
4] with a sensing element made of ferromagnetic microwire. The change in microwire magnetization induces a voltage pulse, which is detected by the inner pairs of coils. The wire elements can be embedded into composite material, where the variations in stress distribution between materials or the local temperature will affect the frequency spectrum of the generated voltage pulse.
In the current work, the precision of flat coil fabrication only affects the comparison of modelled and measured results. Owing to the precision of the turns’ geometry, it was possible to accurately calculate the field distribution, and so make reliable comparisons. In cases where such coils are used in the sensing system, the precision of their fabrication would affect the accuracy of generated voltage measurement, since the coils must be balanced to reduce noise due to the excitation currents.
Characteristics of the magnetizing coil: 17 turns, with the diameter of the outermost turn being 97.2 mm and the diameter of the innermost turn being 58.5 mm. The conductor width is 1 mm, and the turn spacing is 1.2 mm. Characteristics of the detecting coil: 21 turns, with the diameter of the outermost turn being 53 mm and the diameter of the innermost turn being 33.5 mm. The conductor width is 0.15 mm, and the turn spacing is 0.32 mm. For this study, the detecting coil can be used to create a more complex magnetic field configuration.
5.2. Magnetic Field Distribution Induced by Flat Coil
A magnetic field at a distance
induced by a current segment
is calculated using the Biot–Savart law:
For a current-carrying circular loop, the integration of (1) is performed in cylindrical coordinates (
), which gives an analytical form for
at any space point. Due to symmetry, the field distribution is the same in any plane crossing the current loop through the axis. For example, in the
x-
z plane, there are two non-zero components:
and
. Considering
N coaxial loops with the radius
, when carrying a current of
the expressions of the field components at a point with the coordinates
are as follows:
The numerical integration of (2) and (3) was performed in the MathCAD environment. The model itself consisted of 17 closed current loops. The current in each loop
I was 0.6 A. The spatial distribution results of the
and
components in the plane
are given in
Figure 9 and
Figure 10.
When approaching the plane of the coil (z = 0), the distribution of has two extrema with an equal magnitude of 200.4 A/m at , which approximately corresponds to the average value between the outer and inner radii of the flat coil. The sizes of at the edges of the coil are opposite. At the center of the coil, . As the distance from the coil increases, the field rapidly decreases and approaches 0 at a distance greater than 25 mm. The maximum value of = 235.83 A/m occurs at (which corresponds to the radius of the first turn). As you move further from the center toward the outer radius, the value of decreases almost linearly. At the center of the coil, the field intensity drops to a value of 132.89 A/m.
5.3. Measured Field Distribution
During the operation of the experimental setup, the magnetic field intensity values were measured in the coordinate space of
x-
z with a step of 2 mm, which was sufficient for the current task. During each measurement, all three components of the magnetic field vector (
) were measured simultaneously. The measurement results are shown in
Figure 11,
Figure 12 and
Figure 13 for the corresponding magnetic field components. According to the analysis conducted, the
component equals zero.
Figure 11 shows that the small values of
are not related to the coil system and roughly correspond to the Earth’s magnetic field. The spatial distribution of the other two magnetic field components (
Figure 12 and
Figure 13) agrees well with the model.
Figure 14 presents a comparison of the experimental and measured dependencies of
and
. The value of
is chosen where the field intensities are at their maximum. It is seen that the experimental and calculated field intensities for
almost coincide, whilst there is a shift between the experimental and modelled values for
that is also due to the Earth’s field.
6. Conclusions
The purpose of this work was to create an inexpensive, easy-to-manufacture, and convenient 3D magnetic field scanner. The scanner operates by sequentially moving the sensor across the scanning area, collecting data at each step. These measurement data are then transmitted to a computer via a USB interface as a PLX macro file in Excel format. By using ready-made macros, the need to develop custom PC software is eliminated.
The 3D model of the scanner was created using OpenSCAD, and the plastic components were precisely manufactured through 3D printing, so no special skills are required for assembly. The stepper motors are located outside the scanning area to avoid interference with the measured magnetic field. All electronic components are available on Ebay or similar platforms, and the total cost does not exceed $35.
The magnetic field being measured was generated by a system of flat coils. Experimental data on the spatial distribution of the three magnetic field components were compared with modeled data, demonstrating an accuracy comparable to that of the Earth’s magnetic field. The results indicate that the developed scanner is highly suitable for precise magnetic field measurements with a spatial resolution of 0.5–1 mm over a scale of a few centimeters. By adjusting the step size between measurements, users can control the trade-off between speed and accuracy. Future work will aim to reduce scanning time and enhance spatial resolution by optimizing the measurement algorithm and incorporating a more advanced magnetic field sensor. Given its performance, this scanner has potential applications in laboratories and certification centers.