Magnetism and Electricity

In 1819, Hans Christian Oersted, a Danish scientist was experimenting with electricity.  

 
Oersted noticed that a compass needle moved when a current flowed through a wire nearby.
  If you wrap a 10 cm length of bell wire round a pencil in a single layer coil and connect the ends to a 3v battery, you will make a solenoid. Bring a compass needle towards this and watch what happens.

 
You should find that the compass needle changes direction to line up with the centre of the coil because the coil behaves like a magnet.     If you reverse the battery terminal wires, then the compass needle should reverse. It will still be lined up with the pencil, but in the opposite direction.