Skip to main content
Physics

Magnetic Field Simulation: Wires, Coils & Beams

Map the magnetic field of a wire, a coil, and a magnet with compasses. Then test the force on a wire and bend an electron beam.

A long straight current-carrying wire produces a circular magnetic field proportional to current and inversely proportional to distance (B = mu_0 I / (2*pi*r)), whose vector sum with Earth's horizontal magnetic field sets a compass needle's deflection angle (tan(theta) = B_wire / B_Earth). In this interactive 3D magnetic field simulation, students test straight wires, solenoids with cores, magnetic wire forces, and curved electron beams.

  • 11 languages
  • Laptop · tablet · phone
  • Members

Create a free account to get 2 lifetime Free Lab Passes for any labs in the library. The course guide on this page stays free.

Inside this lab

  1. 1

    Preview

    • Driving question
    • What you will predict
    • Equipment and safety
  2. 2

    Lab

    • Lock in prediction
    • Run the experiment, measure and replay
    • Your notebook fills in as you go
  3. 3

    Check

    • Did the lab agree with you?
    • Claim, evidence, reasoning
    • Check questions and a printable lab report

How this magnetic field simulation connects Ampere's law and Lorentz force

Moving electric charges both create magnetic fields and experience forces inside external magnetic fields. Placing a compass beneath a straight wire tests B ∝ I / r directly against Earth's horizontal field (tan(theta) = B_wire / B_Earth), while switching to coils, current-balance wires, and an electron beam tube connects Ampere's law with F = I L B and F = q v B.

Apparatus, safety notes, and step-by-step procedure

  • Apparatus: 3D straight-wire compass rig (adjustable DC current I in A, compass separation r in cm), solenoid coil with removable ferromagnetic cores, Hall magnetic field probe (mT/uT), magnetic wire force balance, and cathode-ray electron beam deflection tube.
  • Safety note (for physical lab prep): In a real physics lab, limit high currents in straight wires to short intervals to prevent wire overheating, and keep strong neodymium magnets away from electronics and mechanical watches.
  1. Open the 3D bench in Ideal mode on the straight-wire compass station; verify the compass aligns with Earth's reference field (theta = 0 deg) at I = 0 A.
  2. Set compass distance r = 2.0 cm south of the wire and current I = +2.0 A; record compass deflection angle (45.00 deg, meaning B_wire = B_Earth).
  3. Cut the current in half to I = +1.0 A at the same r = 2.0 cm, record deflection (26.57 deg), and verify tan(26.57 deg) = 0.500—half the field.
  4. Restore I = +2.0 A and double the distance to r = 4.0 cm; confirm deflection matches 26.57 deg (tan(theta) = 0.500), proving B ∝ I / r.
  5. Reverse the current to I = -2.0 A at r = 2.0 cm and confirm the compass deflects symmetrically to -45.00 deg per the right-hand rule.
  6. Switch to the solenoid station, record internal magnetic field B vs. current and turn density n = N / L, then insert a ferromagnetic core to measure field amplification.
  7. Switch to the wire force station and vary current I and field B to test F = I L B sin(theta).
  8. Switch to the electron beam station, adjust accelerating voltage V and Helmholtz coil current, and verify that beam radius shrinks as B increases (r = m v / (q B)).

Recording table and model reference data

Model reference data — run your own trials in the 3D lab. Values below reflect Ideal compass deflections south of the straight wire where B_wire / B_Earth = tan(theta).

TrialIndependent Variable (Wire Current I & Distance r)Dependent Variable (Compass Deflection theta & tan(theta))UnitsObservation
Ref 1I = +2.0 A, r = 2.0 cmtheta = +45.00 deg, tan(theta) = 1.000A, cm, degB_wire equals Earth's horizontal reference field
Ref 2I = +1.0 A, r = 2.0 cmtheta = +26.57 deg, tan(theta) = 0.500A, cm, degHalving current halves tan(theta) (not theta itself)
Ref 3I = +2.0 A, r = 4.0 cmtheta = +26.57 deg, tan(theta) = 0.500A, cm, degDoubling distance halves B_wire, matching Ref 2
Your TrialRecord station, I, r (or V, B)Record theta, tan(theta), or beam radius rA, cm, deg, mTPlot tan(theta) vs. I/r to obtain a straight line

Lab report outline (blank template)

  1. Title: Identify the magnetic relationship investigated (wire B ∝ I / r, solenoid core effect, or electron e/m beam curvature).
  2. Purpose: State how compass tangent deflection or beam radius tests Ampere's law and Lorentz force.
  3. Hypothesis: Predict how tan(theta) changes with I, r, and current sign reversal.
  4. Variables: List I, r, core material, or accelerating voltage (independent); theta, B, F, or beam radius (dependent); Earth's field and mode (controlled).
  5. Data Table: Record I (A), r (cm), theta (deg), tan(theta), and inferred B_wire (uT).
  6. Analysis & Calculation: Graph tan(theta) against I (at fixed r) and against 1/r (at fixed I), verify linearity through the origin, and compute B_Earth = mu_0 I / (2*pi*r*tan(theta)).
  7. Conclusion & Sources of Error: Explain why tan(theta)—rather than angle theta directly—is proportional to B_wire, and analyze how stray ferrous objects, finite wire length, or compass friction affect Real-mode accuracy.

Next electromagnetism investigations

Test changing magnetic flux in Electromagnetic Induction, connect current circuits in Ohm's Law & Circuits, or explore Physics Simulations.

Common questions

How does a compass needle measure the magnetic field of a straight wire?

When a horizontal wire aligns north-south, its magnetic field points east-west—perpendicular to Earth's horizontal field B_Earth—so the compass deflects by angle theta satisfying B_wire = B_Earth * tan(theta).

What happens to magnetic field strength if you double distance from a straight wire?

By Ampere's law for a long straight wire (B = mu_0 I / (2*pi*r)), doubling perpendicular distance r cuts magnetic field magnitude B in half.

How does reversing current direction affect the compass deflection?

Reversing current flips the right-hand-rule field direction by 180 degrees, causing the compass needle to deflect by the exact same magnitude in the opposite angular direction (e.g., +45 deg to -45 deg).

Why does inserting an iron core inside a solenoid increase its magnetic field?

Ferromagnetic iron aligns its internal magnetic domains with the coil's field, multiplying the total magnetic flux density inside and near the solenoid dramatically.

Why does an electron beam curve into a circle inside a uniform magnetic field?

The magnetic Lorentz force F = q v x B acts perpetually perpendicular to electron velocity, providing centripetal acceleration without changing speed, yielding circular radius r = m v / (q B).

How do you determine the direction of magnetic force on a current-carrying wire?

Apply the right-hand rule for F = I L x B: point fingers along conventional current I, curl toward magnetic field B, and your thumb points along the magnetic force on the wire.