تجربة اورستيد Oersted's Experiment
Hans Christian Oersted showed that an electric current can affect a compass needle in 1820. This confirms the direct relationship between electricity and magnetism, which in turn, paved the way for further understanding of the two. The direction of the magnetic field can be changed by flipping the wire around, which suggests that the direction of the magnetic field is dependent on the direction of current flow.
Place the compass on a horizontal surface.
Connect the wire to both ends of the battery.
Place the middle of the wire directly over the compass, parallel to the initial orientation of the needle.
Observe the needle deflect to one direction.
Now flip the wire over so the current flows in the opposite direction and place it over the compass again.
The needle will deflect in the other direction.
Additionally, you can place the compass on top of the wire now.
A current will carry with it its own magnetic field. The magnetic field lines form concentric circles around the wire so that the field points in one direction above the wire and the opposite direction below the wire. Using the right-hand grip rule, where one holds his hands as though he is gripping something with his thumb pointing in the direction of current flow, his fingers will curl in a way as to indicate the direction of the magnetic field. This is also the direction in which the needle deflects.