A compass will be most affected by the magnetic field of a current carrying wire when the plane of the compass is at 90 degrees to the wire and lest effected when the plane of the compass is in the same plane as the wire.
Compass and electric current.
When a compass is placed on one side of the wire it will point in one direction.
When you put the compass near the electrical wire with current flowing through it the compass did not point north.
Click the turn on button to connect the battery and create an electric current in the wire which travels from the positive to the negative terminals.
To gain a deeper understanding of what an electric current is and how it behaves in a conductor we can use the water pipe analogy of electricity certainly there are some limitations but they serve as a very basic illustration of current and current flow.
If only the earth s magnetic field is involved the the compass points to magnetic north.
When you moved the compass near a bar magnet the needle pointed toward the magnet s magnetic field and not toward the north.
Instead the compass needle pointed in the direction of the current s magnetic field.
In either case the compass needle will follow the stronger magnetic field be that the magnet the magnetic field induced by current through the wire or the earth itself.