The spatial dependence of magnetic fields in simple configurations is a common topic in introductory electromagnetism lessons, both in high school and in university courses. In typical experiments, magnetic fields and distances are obtained taking point-by-point values using a Hall sensor and a ruler, respectively. Here, we show how to take advantage of the smartphone capabilities to get simultaneous measures with the built-in accelerometer and magnetometer and to obtain the spatial dependence of magnetic fields. We consider a simple setup consisting of a smartphone mounted on a track whose direction coincides with the axis of a coil. While the smartphone is moving on the track, both the magnetic field and the distance from the center of the coil (integrated numerically from the acceleration values) are simultaneously obtained. This methodology can easily be extended to more complicated setups.

1.
M.
Monteiro
,
C.
Cabeza
, and
A. C.
Marti
, “
Rotational energy in a physical pendulum
,”
Phys. Teach.
52
,
561
(
Dec.
2014
).
2.
M.
Monteiro
,
C.
Cabeza
,
A. C.
Marti
,
P.
Vogt
, and
J.
Kuhn
, “
Angular velocity and centripetal acceleration relationship
,”
Phys. Teach.
52
,
312
313
(
May
2014
).
3.
M.
Monteiro
,
C.
Cabeza
, and
A. C.
Marti
, “
Exploring phase space using smartphone acceleration and rotation sensors simultaneously
,”
Eur. J. Phys.
35
(
4
),
045013
(
2014
).
4.
R.
Vieyra
,
C.
Vieyra
,
P.
Jeanjacquot
,
A.
Marti
, and
M.
Monteiro
, “
Five challenges that use mobile devices to collect and analyze data in physics
,”
Sci. Teach.
82
(
9
),
32
(
2015
).
5.
M.
Monteiro
,
C.
Cabeza
, and
A. C.
Marti
, “
Acceleration measurements using smartphone sensors: Dealing with the equivalence principle
,”
Revista Brasileira de Ensino de Fisica
37
(
1
),
1303
(
2015
).
6.
M.
Monteiro
,
C.
Stari
,
C.
Cabeza
, and
A. C.
Marti
, “
The polarization of light and Malus’ law using smartphones
,”
Phys. Teach.
55
,
264
(
May
2017
).
7.
N.
Silva
, “
Magnetic field sensor
,”
Phys. Teach.
50
,
372
(
Sept.
2012
).
8.
V.
Lara
,
D.
Amaral
,
D.
Faria
, and
L.
Vieira
, “
Demonstrations of magnetic phenomena: Measuring the air permeability using tablets
,”
Phys. Educ.
49
(
6
),
658
(
2014
).
9.
E.
Arribas
,
I.
Escobar
,
C. P.
Suarez
,
A.
Najera
, and
A.
Beléndez
, “
Measurement of the magnetic field of small magnets with a smartphone: A very economical laboratory practice for introductory physics courses
,”
Eur. J. Phys.
36
(
6
),
065002
(
2015
).
AAPT members receive access to The Physics Teacher and the American Journal of Physics as a member benefit. To learn more about this member benefit and becoming an AAPT member, visit the Joining AAPT page.