Using Arduino to power a solonoid

Has anyone used an Arduino to power a solenoid? I'm wanting to basically pulse an electromagnet with a frequency determined through trial and error to spin a flywheel laden with permanent magnets. Any info would be greatly appreciated.

Many have tried to do that with their first Arduino. Some will have tried again with their second Arduino. At that point, the brighter among them will have realised they are doing something wrong and come to the forum to ask why all their Arduino's keep getting fried.

An Arduino isn't meant to power anything it's a micro-controller. An Arduino can provide power to a small number of low power components like sensors or a few LEDs. Solenoids are not low power components.

To control a solenoid, you need a relay or better still a transistor (probably a MOSFET and some resistors), and a flyback diode. And a power supply or battery capable of the high current needed by a solenoid.

2 Likes


To avoid electromagnetic interference when driving a solenoid, the Arduino must do the following:

  1. Completely separate the Arduino power supply from the solenoid power supply.
  2. Add a feedback diode between the two terminals of the solenoid, keeping in mind the direction of current flow.

Here are two common circuits. When using the MOSFET and you want a gate resistor be sure R2 is connected to the Arduino port and the added resistor from port to input(gate).

image

image