Two wires running parallel to each other are connected to a car battery through a double-pole, double-throw (DPDT) switch and a tap switch. When the DPDT switch is in one position, the currents in the wires flow in the same direction, so that when you close the tap switch, the wires attract each other. When you flip the DPDT switch, the currents in the wires flow in opposite directions, and when you press the tap switch, the wires repel each other.
In 1820, Hans Christian Oersted – while performing a classroom demonstration! – discovered that a current in a wire produces a magnetic field around the wire. The relationship between this magnetic field and the current that produces it is given by Ampère’s law, which states ∮B · dl = μ0i, where dl is an element of a circular path around the wire, μ0 is the permeability constant, which equals 4π × 10-7 tesla·meter/ampere, and i is the current in the wire. By convention, current refers to the flow of positive charge, which is in the opposite direction to the flow of electrons. Evaluating the integral gives the magnitude of the magnetic field. ∮B · dl = (B)(2πr) = μ0i, or B = (μ0i/2πr). The right-hand rule (see demonstration 68.13 – Right-hand rule model) gives its direction. Place your right hand near the current-carrying wire, with the thumb pointing in the direction of the current. Now curl the fingers around the wire. Your fingertips point in the direction of the magnetic field (north).
In a way, this explains half of this demonstration. The other half is that a charge moving in a direction perpendicular to a magnetic field (or in a direction that has a component that is perpendicular to the magnetic field), experiences a sideways force. So, then, does a current flowing in a wire. This demonstration shows the effects of forces that act on a pair of parallel wires as a result of the current in each wire flowing through the magnetic field produced by the current in the other wire.
In this demonstration, when you press the tap switch, current flows simultaneously in two parallel wires mounted next to each other. Each wire thus sits in the magnetic field produced by the current in the other wire. With the wires sitting as shown in the photograph above, in the space between the wires, the magnetic field produced by the current in each wire points either toward the back of the table, or out from the front of the table, depending on the direction of the current. With the red lead and tap switch connected to the positive terminal of the car battery, the current in the right-hand wire always flows downward. (Switching the DPDT switch changes the direction of the current in the left-hand wire.) So the magnetic field produced by the current in the right-hand wire always points toward the back of the table.
We first note that a charge q moving in the left-hand wire, experiences a force Fq = qv × B, whose magnitude is Fq = qvB sin θ. Since the current in the wire is perpendicular to the magnetic field, θ = 90°. If we consider electron flow, q = e, and v = vd, the drift speed of the electron in the wire, and Fe = evdB. vd = j/ne, where j is the current density (i/A, where A is the cross-sectional area of the wire), and n is the number of conduction electrons per unit volume in the wire. Thus, Fe = jB/n. The length of wire in the field, l, contains nAl conduction electrons, so the total force on the wire is F = (nAl)Fe = nAl(jB/n). Since jA = i, this gives F = ilB.
When the current-carrying wire is not perpendicular to B, the general equation is F = il × B, which we must use if we wish to find the direction of the force. (If we are interested only in the direction of the force, considering a single charge and using F = qv × B gives, of course, the same result. Also, as noted above, by convention, current refers to the flow of positive charge. Electrons flow in the opposite direction, but they are also negative. The double change in sign means that whether we use conventional current or flow of electrons, we obtain the same direction for the force on the wire.)
We now consider the operation of the demonstration. In all cases, the direction of B refers to its tangent between the two wires, where the field lines intersect the line between the two wires.
Current flowing in opposite directions in the two wires:
Current in the left-hand wire flows upward. B from the current in the right-hand wire points toward the back of the table, so for the left-hand wire, il × B points to the left. B from the current in the left-hand wire also points toward the back of the table. Current in the right-hand wire flows downward, so for the right-hand wire, il × B points to the right.
With a leftward force on the left-hand wire, and a rightward force on the right-hand wire, the wires are pushed apart.
Current flowing in the same direction in both wires:
Current in the left-hand wire flows downward. B from the current in the right-hand wire points toward the back of the table, so for the left-hand wire, il × B points to the right. B from the current in the left-hand wire points out from the front of the table. Current in the right-hand wire flows downward, so for the right-hand wire, il × B points to the left.
With a rightward force on the left-hand wire, and a leftward force on the right-hand wire, the wires are pulled together.
The definition of the Ampere:
The ampere (A) is the SI unit of current. One ampere equals one coulomb per second (C/s). From 1948 until 2019, the official definition of the ampere was based on an ideal version of an experiment performed in the 1820s by André-Marie Ampère, and was stated:
The ampere is that constant current which, if maintained in two straight parallel conductors of infinite length, of negligible circular cross-section, and placed 1 meter apart in vacuum, would produce between these conductors a force equal to 2 × 10-7 newton per meter of length.
As noted above, B = (μ0i/2πr), and F = ilB. So if we consider a wire carrying a current i, sitting in the magnetic field of a wire carrying a current i′, the force per unit length is F/l = (μ0ii′/2πr). From these equations and this definition of the ampere, it follows that μ0 = 4π × 10-7 weber/(ampere·meter).
The earlier definition of the ampere, adopted in the U.S. in 1893, was the current that would cause silver to deposit on a cathode at a rate of 1.118 mg/s. When it was adopted internationally in 1908, it was restated as the current equal to (1.118 mg/M) elementary charges per second, where M is the mass of a silver atom (in mg/mol). The new definition sets the value of the ampere by fixing the value of the elementary charge at 1.602176634 × 10-19 C, so that 1 s·A = 1 C.
A fun fact:
Power transformers comprise tightly-wound coils that have many turns of wire, with no space between the turns. All the turns in each coil are, of course, wound in the same direction, so current flows through all of them in the same direction. A DC current would cause all the turns to be pulled together. The current flowing through a power transformer, however, is AC at the line frequency of 60 Hz. Every half cycle, the current reaches a maximum. Between maxima, the current decreases, passes through zero and increases again. This means that every half cycle, the coil turns are pulled together, and between half cycles, they relax. This is why, no matter how tightly wound they are, power transformers hum.
References:
1) Halliday, David and Resnick, Robert. Physics, Part Two, Third Edition (New York: John Wiley and Sons, 1977), pp. 677, 719, 721-2, 746-9.
2) Sears, Francis Weston and Zemansky, Mark W. College Physics, Third Edition (Reading, Massachusetts: 1960), pp. 645-7.
3) https://www.nist.gov/si-redefinition/ampere-introduction
4) https://www.nist.gov/si-redefinition/ampere-future
5) https://www.nature.com/articles/s41567-018-0108-x (Keller, Mark W., Elementary again).