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.

  • 1
    Also, keep in mind that you cannot instantly power an electromagnet. You will have a time constant L/R where L is the magnet's inductance, and R the total circuit resistance (magnet windings, power supply, MOSFET...) Dec 28 '17 at 12:18
  • What type of physics experiment?
    – user2497
    Dec 29 '17 at 22:00

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).


I think you need something like a relay driver.

On this site:


i found this picture:

enter image description here

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.

  • Unless it's a very low power magnet (like, e.g., a relay), I wouldn't use an NPN transistor. An N-channel MOSFET, as pictured in Majenko's answer, is likely to perform better in most cases. Dec 29 '17 at 18:38
  • MOSFET are good. I looked in the book and they say that we can use power transistors for high-power amplifieers and power supplies. The range of power ratings are from 10 - 300W, frequency from 1 - 100MHz and Ic from 1 - 100A. He will need 12V times 2,5A this is above 10 and under 300W. I think 1 stands for 1Hz and he wants to switch only one time. The current is between 1 and 100A.
    – user40798
    Dec 29 '17 at 19:06
  • @user8886193 Don’t you mean a fast schottky? NPN should be replaced with an optocoupler, e.g. pc187. Please tell me more about this zener catch diode.
    – user2497
    Dec 29 '17 at 20:40
  • @user2497 In my book it is a diode (1N914). In the illustration in my answer it is a zener. This is illustration is from a website. Zener diodes work in both directions. In the forward direction it needs 0.6V to open like a simple diode. In the other direction (reverse direction) it needs the zeners breakdown voltage. In the illustration the breakdown voltage is 12V. Schottky diodes are used for example for telecomunication. They are fast and need 0.3V to open. It will work too. Optocoupler will work. One question to you: Can we connect the grounds of two different voltage supplies?
    – user40798
    Dec 29 '17 at 21:14
  • @user8886193 Yes, you can. Call it system COMmon, and it will become clearer in your mind. I don’t understand why it uses a zener, I learned to use fast rise schottkys to foil flyback. Or for lack of schottkys, 1n40xx general purpose diodes. A zener would just pass along Vsrc-Zdrop; why is this desirable?
    – user2497
    Dec 29 '17 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.