Fork me on GitHub

Project Notes

#102 SolenoidControl

Controlling a mini solenoid with an Arduino.

Here’s a quick demo of the circuit in action:



Solenoids are useful devices for converting electrical signals and digital logic into physical movement. Whereas motors provide rotation, solenoids are usually used for binary control (valves on or off, locks engaged or free).

So we basically need the Arduino to be a switch. Connecting an Arduino to a solenoid just requires attention to two factors:

  • the current (and possibly voltage) required by the solenoid probably exceeds the power an Arduino can directly provide, so we’d use a transistor or FET to switch a higher-power current source
  • being electromagenetic devices, solenoids can produce significant back-EMF and require a flyback diode to proect other components in the circuit

For this circuit, I’m using a mini push-pull solenoid that is rated for 3-12V. The data I have from the seller page on aliexpress specifies:

  • Length: 20.3 MM
  • Weight: 12g
  • Voltage: DC 3 V, current: 0.08 A
  • voltage: 6 V, Current: 0.17 A
  • voltage: 9 V, Current: 0.26 A
  • Voltage: 12v, current: 0.35 A
  • Internal resistance: 32.8 ohm

That kind of makes sense, although I’m not sure why the rated current is a tad under the voltage/resistance calculation.

The switching transsitor used here is the S9013, which is rated for 500mA continuous collector current - sufficient for this application. A 1N4001 diode provide flyback protection.



The Schematic

The Build

Credits and References

About LEAP#102 SolenoidArduino
Project Source on GitHub Return to the LEAP Catalog

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

LEAP is my personal collection of electronics projects, usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting (IMHO!).

The projects are usually inspired by things found wild on the net, or ideas from the sources such as:

Feel free to borrow liberally, and if you spot any issues do let me know. See the individual projects for credits where due. There are even now a few projects contributed by others - send your own over in a pull request if you would also like to add to this collection.