Fork me on GitHub

Project Notes

#102 SolenoidControl

Controlling a mini solenoid with an Arduino.

The Build

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

SolenoidControl

Notes

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.

Construction

Breadboard

The Schematic

The Build

Credits and References

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

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

LEAP is just my personal collection of projects. Two main themes have emerged in recent years, sometimes combined:

  • electronics - 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
  • scale modelling - I caught the bug after deciding to build a Harrier during covid to demonstrate an electronic jet engine simulation. Let the fun begin..
To be honest, I haven't quite figured out if these two interests belong in the same GitHub repo or not. But for now - they are all here!

Projects are often inspired by things found wild on the net, or ideas from the many great electronics and scale modelling podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know (or send a PR!). See the individual projects for credits where due.