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

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

Project Source on GitHub Return to the LEAP Catalog
About LEAP

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.

Projects are often inspired by things found wild on the net, or ideas from the many great electronics podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know or send a pull-request.

NOTE: For a while I included various scale modelling projects here too, but I've now split them off into a new repository: check out LittleModelArt if you are looking for these projects.

Project Gallery view the projects as an image gallery Notebook reference materials and other notes Follow the Blog follow projects and notes as they are published in your favourite feed reader