I have the following electromagnet and plan on connecting it to the following MOSFET which will be controlled by an Arduino (I'm thinking analogue or PWM). Do I need any other parts (resistors etc.) I'm sorry about the vague question but I don't know much about electronics at all and am just starting. By the way, the aim is to be able to control the strength of the electromagnet (12v 300mA-1A) using the Arduino easily.

  • \$\begingroup\$ You can connect the gate to the MCU output with a current-limiting resistor. Also make sure you have a common ground. But a fail-safe (to some extent) solution would be to use optical isolation. \$\endgroup\$ – Eugene Sh. Aug 26 '15 at 17:49
  • \$\begingroup\$ @EugeneSh. What is the MCU output and what is optical isolation? sorry but as I mentioned in my question I have just started working on electronics \$\endgroup\$ – DividedByZero Aug 26 '15 at 17:50
  • \$\begingroup\$ So probably you should familiarize yourself with the terms first. \$\endgroup\$ – Eugene Sh. Aug 26 '15 at 17:51
  • \$\begingroup\$ @EugeneSh. Well I know what optical isolation is but I don't know how that would be used in this case.. And as far as MCU output is concerned, I am learning on my own and can't find anything on the internet related \$\endgroup\$ – DividedByZero Aug 26 '15 at 17:53

You can connect a MOSFET directly, even without a resistor if you like (though it's not nice to put such a heavy load on the output), but if the MOSFET fails with a Drain-Gate short your Arduino will be scrap. I strongly suggest using a higher voltage MOSFET than that one- it's only 12V and you will at least be subjecting it to at least 12.5-13V when the MOSFET turns off. It does have nice specs at 4.5V drive (good for an ampere or two), but Vds breakdown is too low.

If you want a modicum of protection, (Edit: Assuming 5V Arduino) put a 5.1V zener on the Arduino output and a 200 ohm metal film resistor to the gate. Put 10K across the 5.1V zener as well so if the output goes open it won't partly turn on.

You must put a catch diode across the coil. Something like a 1N5819 would be good. Otherwise the MOSFET will get very hot and may fail very quickly.

Edit: You should make sure the MOSFET you select is capable of handling the full current of the solenoid (1A you say).


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ Do these values apply to both the 5V and 3V3 versions? (BTW - the OP does state the current range for the 12V solenoid as 300mA to 1A) \$\endgroup\$ – JIm Dearden Aug 26 '15 at 18:14
  • \$\begingroup\$ If I use a higher voltage MOSFET will my Arduino still face the threat of a drain-gate short? \$\endgroup\$ – DividedByZero Aug 26 '15 at 18:15
  • \$\begingroup\$ @RandomUser Yes, it's an inherent risk with non-isolated circuits with mixed voltages. That's why Eugene suggested opto-isolation. \$\endgroup\$ – Spehro Pefhany Aug 26 '15 at 18:16
  • \$\begingroup\$ @JImDearden Okay, edited, thanks. It applies for the 5V version. The knee is too soft on 3.3V zeners to be assured of protection. Maybe use a blue LED capable of 100mA rather than the zener. \$\endgroup\$ – Spehro Pefhany Aug 26 '15 at 18:18
  • 1
    \$\begingroup\$ looks good to me +1` \$\endgroup\$ – JIm Dearden Aug 26 '15 at 18:41

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.