user41245: I am carrying out a physics experiment using an Arduino. This experiment requires accurate time measurements of upto a millisecond. However I am using a relay to turn on/off an electromagnet and there is a maximum lag of 10ms due to the relay. I am a complete beginner. Please suggest alternative mechanisms to switch the electromagnet and save those precious milliseconds. 
P.S. - the magnet is driven by 12V 2.5A DC.

user-1: I think you need something like a relay driver.
On this site:
http://www.learningaboutelectronics.com/Articles/Relay-driver-circuit.php
i found this picture:

In "practical electronics for inventors (fourth edition)" is a similar picture with following text on page 445:
"Here, an npn transistor is used to control a relay. When the transistor's base receives a control voltage/current, the transistor will turn on, allowing current to flow through the relay coil and causing the relay to switch states. The diode is used to eliminate voltage spikes created by the relay's coil. The relay must be chosen according to the proper voltage rating, etc."
You can replace the relay with the magnet. But you will still need a diode. When you switch off the magnet it will generate a voltage and will try to push the current (there is energy saved in the coil). This diode will help it to unload the energy. Otherwise this energy can destroy something.

user4143: A relay is just an electromagnet, and the same circuit that can drive a relay can drive an electromagnet. You just need to make sure it can handle the power.
The simplest circuit is to use an N-channel MOSFET:

simulate this circuit – Schematic created using CircuitLab
Just make sure that the MOSFET can handle the required power dissipation and switches on fully at below 5V on the gate (a gate threshold voltage of less than 3V is ideal).

41245: <p>I am carrying out a physics experiment using an Arduino. This experiment requires accurate time measurements of upto a millisecond. However I am using a relay to turn on/off an electromagnet and there is a maximum lag of 10ms due to the relay. I am a complete beginner. Please suggest alternative mechanisms to switch the electromagnet and save those precious milliseconds. 
P.S. - the magnet is driven by 12V 2.5A DC.</p>
 -1: <p>I think you need something like a relay driver.</p>

<p>On this site:</p>

<p><a href="http://www.learningaboutelectronics.com/Articles/Relay-driver-circuit.php" rel="nofollow noreferrer">http://www.learningaboutelectronics.com/Articles/Relay-driver-circuit.php</a></p>

<p>i found this picture:</p>

<p><a href="https://i.stack.imgur.com/dpPz9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dpPz9.png" alt="enter image description here"></a></p>

<p>In "practical electronics for inventors (fourth edition)" is a similar picture with following text on page 445:</p>

<p><strong>"Here, an npn transistor is used to control a relay. When the transistor's base receives a control voltage/current, the transistor will turn on, allowing current to flow through the relay coil and causing the relay to switch states. The diode is used to eliminate voltage spikes created by the relay's coil. The relay must be chosen according to the proper voltage rating, etc."</strong></p>

<p>You can replace the relay with the magnet. But you will still need a diode. When you switch off the magnet it will generate a voltage and will try to push the current (there is energy saved in the coil). This diode will help it to unload the energy. Otherwise this energy can destroy something.</p>
 4143: <p>A relay is just an electromagnet, and the same circuit that can drive a relay can drive an electromagnet. You just need to make sure it can handle the power.</p>

<p>The simplest circuit is to use an N-channel MOSFET:</p>



<p><img src="https://i.stack.imgur.com/su86b.png" alt="schematic"></p>



<p><sup><a href="/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fsu86b.png">simulate this circuit</a> &ndash; Schematic created using <a href="https://www.circuitlab.com/" rel="nofollow">CircuitLab</a></sup></p>

<p>Just make sure that the MOSFET can handle the required power dissipation and switches on fully at below 5V on the gate (a gate threshold voltage of less than 3V is ideal).</p>
