Early experimenters with electricity and magnetism noticed that the electric current produces a magnetic field. This discovery was an accident, but it was an accident that, given the curiosity of scientist, was bound to occur. When a magnetic compass is placed near the wire carrying a direct electric current, the compass does not point toward magnetic north. The needle gets displaced. The extent of the error relies on the fact on how close the compass is brought to wire, and on how much current the wire is carrying.
Scientific experimenters are just like children, they like to play around with things. Most likely, when this effect was 1st observed, the scientist tried different arrangements to see how the compass needle could be displaced, and how small a current could be detected.
To know more about this topic refer this given link:-
http://www.expertsmind.com/topic/measuring-devices/electromagnetic-deflection-9568.aspx