Solenoids: Control Electronic, Mechanical, and Pneumatic Devices
September 23, 2021
Blog
Computing, in the sense of storing, routing, and manipulating data is, of course, a vast and interesting subject. At the end of the day however, I’d argue that one has to actually use this information for it to be useful. While this can mean providing information to humanity, in other cases the computer itself is tasked with manipulating our world directly through a variety of actuators and electro-mechanical apparatuses.
One such actuator is the solenoid, which produces direct linear motion through the use of an electromagnetic coil. When the coil is energized, it pulls a ferromagnetic armature core towards its center. When de-energized, a spring snaps the core – and whatever is attached to it – back to its at-rest state.
The advantage of such a setup is that linear motion can be induced quickly and simply. When compared to gearmotors, however, output force is generally low. Current and voltage requirements are significant when compared to what a microcontroller can output directly, so operation will normally mean breaking out a transistor or a dedicated motor driver IC.
You can see this type of actuator used in automated door locks, and a quick search reveals a 24VDC at 2.3A locking device on Amazon. While certainly usable, this voltage/current would require a bit of thought if you wanted to power it with a Raspberry Pi, Arduino, or similar. While direct action works well here, solenoids are often used trigger another device that ultimately does the work.
Relay: Electrically Operated Solenoid… For Electrical Operation
Electromagnetic coil (1) pulls common contact (3) between NC and NO contacts. (Image Credit: User:Bisgaard, language neutral version by Teslaton, CC BY-SA 3.0 <http://creativecommons.org/licenses/by-sa/3.0/>, via Wikimedia Commons)
One very common method for indirect solenoid control is via a relay. Here an electromagnet pulls a common contact into another normally open (NO) contact and when released, a spring pulls it back to touch a normally closed (NC) contact. In essence, it’s simply an electrically (i.e. solenoid) operated switch. Powered devices can be hooked up to either the NO or NC contact, or both, depending on the desired operation.
Such a setup shares some functionality with a transistor; however, a relay operates much more slowly. Relays provide total isolation from an electronics standpoint, and can be used with either AC or DC current. Additionally, their operation is easy to understand, and can be visible and even audible, facilitating setup and troubleshooting.
Solenoid Valve: A Relay for Fluid Operation
Solenoid coil assembly of a pneumatic valve. (Image Credit: By Sarah Adrita - Own work, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=87512525)
As a relay can control a switch for electrical current, one can also switch valves that control gas or liquid flow. An electrical signal activates a solenoid, which, in this device’s simplest implementation, opens or closes a valve to control fluid flow. Valves may also be designed to shuttle an internal mechanism between one of two states, swapping the direction of fluid flow between two lines. A third type uses two solenoids to shuttle between two fluid direction states. When both solenoids are de-energized, a spring return cuts off fluid flow off entirely.
This concept is explained nicely in this video.
Solenoid Valve > Pneumatic Actuator
Solenoids are fast and simple, but provide little pushing force. However, pneumatically-actuated pistons (i.e. cylinders) controlled by solenoid valves, are capable of both. Cylinder speed and force can be controlled by regulating air flow and pressure, making them a popular choice for industrial automation. Downsides of pneumatic power include the complication of pneumatic air lines and the solenoid valves themselves, and potential inefficiency due to leaks and other factors. Both must be weighted when considering such a system.
One potential source of confusion here is that when a valve is “open” it’s allowing fluid flow, activating pneumatic power. This is, of course, opposite to a relay or other electrical conductor, where a “closed” switch allows electrical power to be transmitted.
Conclusion
Solenoids aren’t always the answer, but they’re a great tool to have in your metaphorical tool belt. Control methods are similar to a DC motor, and Arduino motor shields and the like work well for this purpose. More information on how to use solenoids with such a shield is found here, as well as how to use transistors for Arduino control. For a fun example, with a little 5V solenoid and the EZ Fan 2 board (seen here in the context of Raspberry Pi fan control), you can use one to tap out a beat directly on your desktop as seen below:
.@arduino based macro pad plays notes, taps out beat with solenoid. New version of keypad available soon: https://t.co/YdvqqM2dwf @kickstarter ??? pic.twitter.com/ObGBRurS1D
— Jeremy Cook ? (@JeremySCook) September 16, 2021