An electric current produces a magnetic field. This applet simulates an experiment concerning the magnetic field of a straight current-carrying wire. A large current passes through a vertical wire. You can reverse the direction of this current by using the red button. The signs at the ends of the wire symbolize the poles of the connected battery. The conventional direction of current is given by the red arrow. Note that the motion of the electrons (green dots) is opposite to the conventional direction!
A compass needle which can be moved (by dragging the mouse with pressed mouse button) shows the direction of the magnetic field (blue) at a given position. North and south pole of the compass needle are painted with red respectively green colour. The influence of the earth's magnetic field is neglected in this simulation.
The magnetic field lines of a straight current-carrying wire form concentric circles around the wire. The direction of the magnetic field (blue arrows) is given by the right-hand rule: When the thumb of the right hand points in the direction of the conventional current, the fingers curl around the wire in the direction of the magnetic field.