A remote lab for measuring, visualizing and analysing the field of a cylindrical permanent magnet

Qualitative experiments such as visualizing magnetostatic fields with iron filings are often carried out in primary and secondary school, while quantitative evaluations of permanent magnetic fields are often left aside. This also applies to most lectures at university despite the fact that the topic would fit quite well into a lecture on electrodynamics. Gaining a quantitative picture of permanent magnetic fields is a rather difficult task. Calculating such fields often requires numerical methods and measuring them a very sensitive apparatus. However, as magnetic fields are invisible, properties of these fields have to be determined in order to visualize them quantitatively. A remote laboratory was developed to be used in teaching at the Ludwig-Maximilians-Universität München. It combines exact measurements and theoretical predictions for the field of a cylindrical permanent magnet. Furthermore, multiple representations of the measurements and possibilities of analysis are offered. The laboratory is accessible via https://www.didaktik.physik.uni-muenchen.de/sims/magneticfield/.

This is quite surprising if you take into account that the students know the effects of magnetic fields since pre-school age, as many toys rely on magnetism.
During their school career and later at university, students deepen those first experiences with magnetism. A quantitative analysis of magnetostatic problems is often left aside due to the difficulties connected with the generation of quantitative data. However, the analysis of the field of a permanent magnet would contribute substantially to the students' understanding of magnetic fields.
Quantitative data could be created either by calculating the field or by measuring it around a magnet but in both cases difficulties arise: • An analytical calculation of the field of a permanent magnet is possible only for a few special cases; • the magnetic flux density of the field of a permanent magnet decreases very rapidly with increasing distance from the magnet.
Hence, for the measurement, a very sensitive apparatus is necessary. As the time that is available for lesson preparation as well as the spendable budget often are limited, using readily built remote experiments seems to be a promising approach.
Remote labs with which the field of a coil can be determined have already been used for teaching (Kofman andConcari 2012, Alves et al 2017).
Magnetic fields are vector fields, thus students' difficulties regarding symbolic and graphical representations of this field as well as problems with the translation between those representations have to be considered (Bollen et al 2017). However, multiple representations are an effective tool to support understanding in physics (Larkin and Simon 1987, van Heuvelen 1991, Dufresne et al 1997, van Heuvelen and Zou 2001, Kohl and Finkelstein 2006. Especially for the description of vector fields in general and magnetic fields in special, using multiple external representations is very suitable, for several reasons. • External representations can show complementary aspects (Ainsworth 1999). Information characterizing a vector field can be separated into different representations: one representing the directions of the field, the other showing the absolute values. • Representations can constrain the interpretation of other representations (Ainsworth 1999). For vector fields this could mean that a 3D plot of absolute values could help to interpret a contour plot of the same data and vice versa. • Additionally, using multiple representations can under certain circumstances lead to a deeper understanding (Ainsworth 1999 ande.g. Seufert 2003).
Remote labs can offer possibilities for a visualization of measured data in multiple ways. Therefore, such a laboratory also supports those advantages, which multiple representations bring along.
The remote lab described in this paper combines both a very sensitive measurement of the field of a permanent magnet and a visualization of the results of the measurement using multiple external representations. The laboratory furthermore supports a comparison of measured data with a theoretical model of the field of the bar magnet which allows a determination of the magnetization and of the field on the axis of symmetry of the magneteven inside the magnet.

Experimental setting and theoretical background
The remote lab measures the field of a cylindrical bar magnet. This geometry was chosen for two reasons. Firstly, because of the rotational symmetry by measuring the field on a plane, which includes the axis of symmetry of the magnet information about the structure of the whole magnetic field can be gained. Secondly, for this special geometry, a mathematical solution for the field on the axis of symmetry of the magnet is calculable. The formula combined with the measured data allows a quantification of the magnetization and of the Bfield and H-field on the axis of symmetry inside and outside the magnet. The next sections describe the setup of the built remote laboratory and give a mathematical derivation of a formula which describes the magnetic field on the axis of symmetry of the magnet.

Experimental setup and functions of the experiment
The experimental setup (figure 1) allows a measurement of the magnetic flux density on a plane around a cylindrical magnet. Due to the rotational symmetry of the magnet, the measurements on this plane are sufficient to gain information about the whole three-dimensional field.
During construction, a big challenge was to avoid ferromagnetic materials, as these would modify the field of the magnet. Therefore, the experimental setup consists mainly of aluminum and plastic. Electrical components such as the motor controlling units and the devices, which are necessary for the measurement and the remote control over the internet, are more than a meter away from the sensor head. The installed motors are about half a meter away from the sensor head and are not active during the measurement process. The contribution of those devices to the measured magnetic flux density is below the resolution of the measurement device.
To take care of the influence of surrounding static magnetic fields, including the Earth's magnetic field, the laboratory was calibrated for the position where it was installed.
The permanent magnet is located in the center of a round plate, which can be rotated by a stepper motor. A toothed belt connects the plate and the motor. The center of the plate corresponds to the origin of the coordinate system, which is used for the positioning of the sensor and later for the visualization of the measured data. The axis of symmetry of the magnet corresponds to the x-axis of the coordinate system. The north pole of the magnet is pointing to positive x-direction. By rotating the plate, the magnet is rotated together with the coordinate system.
For measuring the field precisely, a two-dimensional (2D) Hall sensor is used which can be moved radially back and forth by a linear drive. This linear drive also consists of a distant stepper motor, which turns a non-ferromagnetic worm gear drive and very carefully moves a sleigh on which the sensor is installed. An exact positioning is necessary because of the fast decrease of the flux density with increasing distance to the magnet.
The sensor head is set to the same height as the centerline of the magnet. At this height, due to the symmetry of the field, the z-component of the magnetic flux density vanishes and a 2D measurement is sufficient to determine the magnetic field on the plane around the magnet. The sensor consists of an aluminum profile with two Hall sensor plates of type KSY44 embedded (figure 2).
Those two sensor plates are positioned perpendicular to each other in T-form. One of the Hall sensor plates is arranged radially to the round plate and measures the angular component of the magnetic flux density. In the following, it is called the transversal plate. The other one is positioned perpendicular to it and measures the radial component of the magnetic flux density. It is called the axial hall sensor plate.
In order to perform a measurement, first, the transversal sensor measures the value for the angular component of the field. After that, the sensor head moves outwards radially so that the axial sensor plate measures the radial component at the same position where the first measurement was recorded (see figure 3). By doing so, both the angular and radial component of the field are determined at the point of interest.
Because of magneto-resistive and piezoelectric effects, the Hall voltage is not linear with the magnetic flux density. Hence, a calibration of the measurement apparatus especially of the Hall sensor plates is necessary in order to get results that are more precise.
The test bench used for the calibration of the Hall sensor plates was previously calibrated using a high precision NMR magnetometer, which is regularly tested by the Physikalisch-Technischen Bundesanstalt.
Assuming that the measured magnetic flux density was linear with the measured Hall voltage of the sensor, figure 4 shows the deviation of the measured magnetic flux density from the current magnetic flux density on the test bench. Deviations cause an error of less than 0.1%.
To measure as accurately as possible a polynomial regression was fitted to the calibration data for both Hall sensor plates. The laboratory first measures the output voltages and then uses these polynomials to calculate the corresponding values for the magnetic flux density. The measured magnetic flux density on the plane around the permanent magnet is in the range of 300 mT.
 For the later visualization of the data, the software of the laboratory performs a coordinate transformation and converts the measured angular and radial components of the magnetic field to Cartesian coordinates.

Calculation of the field on the axis of symmetry
Calculating magnetic fields of permanent magnets is a challenging task. Generally, one has to fall back on numerical methods. Nevertheless, for some special cases analytical solutions can be calculated quite easily. To determine the field of a cylindrical bar magnet on the axis of symmetry of the magnet the procedure is as follows.  As the magnetic flux density has no sources and there are no free currents or time varying electric fields, Maxwell's equations yield Additionally, magnetic flux density, magnetic field strength and magnetization of the magnet are connected via Equation (2) implies that the magnetic field strength H  is conservative and therefore has a potential Φ such that which is solved in order to get an expression of the magnetic field. The Poisson equation (6) can be solved by applying Green's identities similar to the electrostatic problem of free charges. A step by step solution of this problem for the field on the axis of symmetry of a cylindrical bar magnet of length L and homogeneous magnetization M x parallel to this axis can be found on the webpages of settings 2 and 3 of the remote laboratory. In the following sections the results will suffice.
The magnetic field H x  ( ) on the axis of symmetry of the magnet for inside the magnet where x L And outside the magnet where x L: This equation also describes the magnetic flux density inside the magnet which can be seen by using equations (3) and (7).
Plotting the formulae (7)-(9) for a fictional cylindrical permanent magnet of length L 100 mm, = radius R 7.5 mm = and a magnetization of M x 850 kA m x 1 = -( ) inside the magnet results in figure 5. While the magnetic flux density is continuous on the end faces of the magnet, the magnetic field changes its value and even its sign. The changing sign indicates that the magnetic field inside the magnet points in opposite direction to the field outside. For a closer look at the derivation of the field inside the magnet, see also Sommerfeld (1956).
The cylindrical permanent magnet used in the laboratory has the same geometric dimensions but unknown magnetization. By measuring the magnetic flux density on the symmetry axis in dependence of the distance x and fitting the theoretical derived formula to these measured data, the magnetization of the magnet can be determined. Using this result together with equation (7), even the magnetic field inside the permanent magnet can be determined.

The remote laboratory
To offer access from everywhere for everyone and anytime the remote laboratory can be used via a HTML5 webpage. A software regulates access so that only one person at a time can control the experiment.
On the main webpage of the laboratory, the user can choose between three settings of the experiment.
• In setting 1 the magnetic flux density of the magnet can be measured and visualized immediately in up to nine different representations. • In setting 2 the magnetization of the magnet can be determined.
• Setting 3 allows an evaluation of the magnetic field on the axis of symmetry, even inside the magnet.
If a user is in control of the experiment, another user can access the webpages of the different settings as a spectator. Waiting for access in setting 1, the spectator can visualize a previously recorded dataset, while in settings 2 and 3, the spectator can have a look at the mathematical derivation of the used formulae. To reduce the time during which the experiment is blocked, measured data remains stored until the user closes the webpage. Even if the experimentation time has expired the user can work with the measured dataset or have an extensive look at the derivation of the formulae without blocking the experiment.
To grant access to as many students of a lecture as possible the laboratory does not support an automated recording of data, as this would block the experiment for a long time. Instead, the previously recorded dataset can be displayed.
The following sections concentrate on the usage of the remote laboratory. They describe the webpages, which serve as user interfaces of the experiments, the visualizations of the measured data, and the data analysis.

Setting 1: measurement and visualization
The user interface of setting 1 is divided into four quarters (figure 6). In the upper left quarter, the video live stream shows the experiment from above. The magnet on the round plate, the Hall sensor and the coordinate system are visible. When a user acts on the controlling unit of the user interface, the action of the apparatus can be seen immediately in the video live stream.
The bottom left quarter contains the controlling unit of the experiment. Here the user can execute measurements and enter the position to which the Hall sensor shall be moved next.
Due to the symmetry of the setup, Polar coordinates are very suitable for controlling the experiment. However, many students are more familiar with Cartesian coordinates. This is why measurements are visualized in a Cartesian coordinate system. To facilitate the orientation in both, the controlling of the experiment and the visualization of the recorded data, the users can choose if they wish to move the Hall sensor according to Polar or Cartesian coordinates. After this selection, the corresponding input sliders appear and the users can choose the position they want. The laboratory calculates on which path the chosen position is reachable and then moves the sensor to the new position.
For the measurement of the field at the position of the Hall sensor, the user has to push the 'Measure' button. The remote laboratory then measures the angular and radial component of the magnetic flux density at that point.
The right half of the user interface is reserved for visualizing the measured data. Therefore, it consists of two boxes so that two external representations of the magnetic field can be displayed simultaneously. This makes it possible to work with different representations at a time according to the theoretical background discussed in the introduction.
In each of the two visualization boxes setting 1 of the remote laboratory allows a representation of the measured values in up to nine different visualizations. These visualizations are the following.  In contrast, the strength of the magnetic field is encoded in color in the multicolor 'Iron Filings representation'. For this, a rainbow color scale is used where red represents high and blue small values of the magnetic flux density. It stands out that although the reddish to yellowish area of the color scale corresponds to about 80% of the scale, only a small fraction of the filings wear these colors. It is obvious that the absolute values of the magnetic flux density decrease very rapidly with increasing distance to the poles of the magnet. The symmetry of the representation suggests a homogeneous magnetization inside the magnet.
3.1.2. Direction plot. In the direction plot (figure 8), arrows of unity length visualize the measured data. The arrows start at the position of the measurement and point to the direction of the magnetic flux density. Because of this convention, an asymmetry arises in the visualization (which might be confusing for novices and should be discussed in lectures). At the south pole, the arrows seem to be much closer to each other than they are at the north pole. This asymmetry has its origin in the representation itself and not in the magnetic field. While again the unicolor direction plot does not contribute information about the strength of the magnetic field, this information is encoded in color in the multicolor direction plot.
3.1.3. Magnetic needle plot. A mixture of the last two representations is helpful to overcome the asymmetry difficulties of the direction plot. This representation is called the 'Magnetic Needle Plot' (figure 9). The magnetic needles are small arrows, which have their center at the position of measurement. As in the 'Iron Filings representation', the magnetic needles behave like dipoles and align tangentially to the magnetic flux density. In contrast to the 'Iron Filings representation', information about the explicit directions of the magnetic field is included. Although it visualizes the same data, the 'Magnetic Needle Plot' seems to be much more symmetrical than the direction plot. Again, no information about the strength of the magnetic field is encoded in the unicolor representation while in the multicolor representation this information is encoded in color.
3.1.4. 3D plot. A 3D plot of the absolute values is another possibility the laboratory supports for visualizing the strength of the magnetic field (figure 10, left side). In this visualization, the x and y coordinates indicate the places where the measurements were recorded, while the absolute values of the magnetic flux density are plotted in z-direction. At the poles, the fast decrease in the absolute values is this time encoded in the big slope of the plot. This representation reveals that the field around the center of the magnet (x=0) has vanishing absolute values.
3.1.5. Contour plot. Although it looks different from the 3D plot, the contour plot representation (figure 10, right side) contains the same information. In this case the strength of the magnetic field is encoded in color and so two dimensions are sufficient for a representation of the data. For this representation, the same color scale is used as for the previously discussed colored representations. The contour plot contains contour lines which indicate locations of same absolute value of the magnetic flux density. A special highlight of  this representation is that it emphasizes the structure of the field much more than the 3D plot. The distance between the contour lines is an indication of how fast the field changes its absolute values. Near the poles, it varies a lot over short distances, while this variation declines with increasing distance to the magnet. Therefore, at the poles the distance between the contour lines is very small, but increasing with increasing distance to the magnet. Around the magnet, the contour lines seem to form figure eights.
For this representation a set of data is needed. That is why the contour plot visualizes a previously recorded dataset. User-recorded data are marked in the representation; the absolute values are encoded in the color of the markers. The exact value of the measurement can be viewed by hovering the mouse-pointer over the marking.
3.1.6. Data of the last measured point. In addition to the mentioned representations, it is also possible to show the raw data of the sensor. This means that the measurements of the axial and transversal Hall plate as well as the absolute value of the magnetic flux density in Tesla are displayed. Additionally, the software of the laboratory calculates and displays the values of the magnetic flux density along the x-and y-axis. Therefore, the software performs a coordinate transformation of the measured data.
3.1.7. Navigation and options. In all graphical representations, it is possible to fade in a previously recorded dataset by toggling the corresponding switch. The plotly mode bar (Plotly Technologies Inc. 2015) supports additional controlling options. The bar is visible while hovering over those representations. Figure 10 shows the bar above the 3D and contour plot. Clicking the symbols causes the following actions.
• Photo icon: the browser downloads the visualization in png-format.
• Magnifier: selection of the zoom function. Allows the user to zoom in and out by dragging and dropping. • Cross with arrows: activation of the Pan mode. Using this, the visualization can be positioned in the display. • Plus or minus symbol: additional control of the zoom function.
• Rotate button of the 3D plot: enables a rotation along the z-axis of the 3D plot.
• House in the mode bar of the 3D plot: resets the representation to default.
• St Andrew's cross with arrows in the mode bar of the contour plot: scales the visualizations automatically.
By default, it is possible to zoom into the visualizations using the mouse. In two dimensions, by using drag and drop, a rectangle can be stretched over a region to enlarge it. By clicking the representation twice, the software will zoom out again.
In three dimensions the zoom function can be controlled by turning the mouse wheel; a rotation of the graph is possible by dragging and dropping.
As described in the corresponding sections, the presented visualizations yield the possibility of a qualitative analysis of the magnetic field of the cylindrical magnet. In settings 2 and 3 a quantitative analysis of the measured field leads to a value for the magnetization and a mathematical expression of the field on the axis of symmetry of the magnet.

Setting 2: determination of the magnetization
The user interface in setting 2 consists of three sections (figure 11). The upper right section contains the video live stream. The controlling unit is positioned in the upper left section. The sensor in this setting moves on the positive x-axis of the coordinate system, which is the axis of symmetry of the cylindrical magnet. With the corresponding slider, the position of the sensor on this axis can be chosen, and by clicking the 'Measure' button the absolute value of the magnetic flux density at that point can be recorded. The measured value is immediately visualized in a diagram on the lower part of the user interface.
The theoretically derived equation for the magnetic flux density along the symmetry axis of the magnet is also displayed on the bottom half of the user interface. All but one of the variables are determined by the geometry of the magnet. The magnetization of the magnet, which is the only missing variable, can be evaluated by analysing the measurements made. Therefore the graph of the theoretically derived formula has to be fitted to the measured data points. For changing the magnetization, there is a slider on the user interface. The graph of the formula changes according to variations of the magnetization. After recording measurements along the axis of symmetry, the graph can be fitted to the measured data by adjusting the magnetization with the slider. The graph, which interpolates the measured data points best, gives a value for the magnetization of the magnet.
For interested users a link leads to a webpage containing further information about the derivation of the used formula and the associated graphs (see 2.2).

Setting 3: evaluation of the magnetic field on the axis of symmetry
Setting 3 (figure 12) of the experiment has the same structure as setting 2 before. Even the procedure is very similar. Again, the user has to measure the field on the axis of symmetry and subsequently has to adapt the graph of the formula of the magnetic field on this axis. This time the values of the measured data and the graph of the formula of the magnetic flux density are divided by the magnetic field constant so that they can be displayed together with the At this point, the differences between the H-field and the B-field become apparent. It is evident from the graph in figure 12 that the magnetic flux density is continuous on the faces of the magnet while in contrast the H-field changes value and even sign discontinuously. This behavior can be derived from Maxwell's equations. It holds that B 0,  =   · which causes the continuity of the normal component of the B-field on the end faces of the magnet. In contrast, on the end faces there are the sources of the magnetization (see the derivation on the webpages of settings 2 and 3) and because of H M  = -     · · (see equation (4)) there are sources of the H -field, too.
It is obvious from the graph that the magnetic flux density along the axis of symmetry reaches its maximum in the middle of the magnet. The maximum value This behavior is also apparent from equation (9). If the radius R of the cylindrical magnet is much smaller than its length L, the maximum of the magnetic flux density approaches B x M 0 .
x R L x , 0 m = »  ( ) · Further, under this assumption the magnetic flux density takes half the maximum value on the end faces of the magnet B x M .
x R L L x , 2 The graph shows that this approximation gives quite good results for the permanent magnet of the remote lab (R L 7.5 mm, 100 mm = = ).

Conclusion
Permanent magnets and their fields are the content of courses in primary school, secondary school and university. Thereby, naturally, the complexity of the problems treated increases. The described remote laboratory is a tool for teaching at university and offers the opportunity for a very sensitive and exact measurement of the field of a permanent magnet. These measurements can be visualized in multiple ways including qualitative and quantitative representations. Furthermore, the experiment supports processing of the measured data in order to get an expression for the magnetization and the internal and external field along the axis of symmetry of the magnet. Everyone can use the laboratory at anytime and from everywhere via the internet. That is why on the one hand teachers can use the laboratory in class as a teaching aid and on the other hand, students can use it at home to deepen their knowledge.
In summary, the remote laboratory combines experimentation, visualization and analysis. The spectrum of possible applications makes it a powerful tool for conveying knowledge about permanent magnetic fields.