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
Preview
- Driving question
- What you will predict
- Equipment and safety
- 2
Lab
- Lock in prediction
- Run the experiment, measure and replay
- Your notebook fills in as you go
- 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
IinA, compass separationrincm), 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.
- 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) atI = 0 A. - Set compass distance
r = 2.0 cmsouth of the wire and currentI = +2.0 A; record compass deflection angle (45.00 deg, meaningB_wire = B_Earth). - Cut the current in half to
I = +1.0 Aat the samer = 2.0 cm, record deflection (26.57 deg), and verifytan(26.57 deg) = 0.500—half the field. - Restore
I = +2.0 Aand double the distance tor = 4.0 cm; confirm deflection matches26.57 deg(tan(theta) = 0.500), provingB ∝ I / r. - Reverse the current to
I = -2.0 Aatr = 2.0 cmand confirm the compass deflects symmetrically to-45.00 degper the right-hand rule. - Switch to the solenoid station, record internal magnetic field
Bvs. current and turn densityn = N / L, then insert a ferromagnetic core to measure field amplification. - Switch to the wire force station and vary current
Iand fieldBto testF = I L B sin(theta). - Switch to the electron beam station, adjust accelerating voltage
Vand Helmholtz coil current, and verify that beam radius shrinks asBincreases (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).
| Trial | Independent Variable (Wire Current I & Distance r) | Dependent Variable (Compass Deflection theta & tan(theta)) | Units | Observation |
|---|---|---|---|---|
| Ref 1 | I = +2.0 A, r = 2.0 cm | theta = +45.00 deg, tan(theta) = 1.000 | A, cm, deg | B_wire equals Earth's horizontal reference field |
| Ref 2 | I = +1.0 A, r = 2.0 cm | theta = +26.57 deg, tan(theta) = 0.500 | A, cm, deg | Halving current halves tan(theta) (not theta itself) |
| Ref 3 | I = +2.0 A, r = 4.0 cm | theta = +26.57 deg, tan(theta) = 0.500 | A, cm, deg | Doubling distance halves B_wire, matching Ref 2 |
| Your Trial | Record station, I, r (or V, B) | Record theta, tan(theta), or beam radius r | A, cm, deg, mT | Plot tan(theta) vs. I/r to obtain a straight line |
Lab report outline (blank template)
- Title: Identify the magnetic relationship investigated (wire
B ∝ I / r, solenoid core effect, or electrone/mbeam curvature). - Purpose: State how compass tangent deflection or beam radius tests Ampere's law and Lorentz force.
- Hypothesis: Predict how
tan(theta)changes withI,r, and current sign reversal. - Variables: List
I,r, core material, or accelerating voltage (independent);theta,B,F, or beam radius (dependent); Earth's field and mode (controlled). - Data Table: Record
I (A),r (cm),theta (deg),tan(theta), and inferredB_wire (uT). - Analysis & Calculation: Graph
tan(theta)againstI(at fixedr) and against1/r(at fixedI), verify linearity through the origin, and computeB_Earth = mu_0 I / (2*pi*r*tan(theta)). - Conclusion & Sources of Error: Explain why
tan(theta)—rather than anglethetadirectly—is proportional toB_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.


