← How-Tos
workshop 1 hr ago ◯ 7 min read

Pneumatic Cylinders and Solenoid Valves for Shop Automation: Sizing, Wiring, and Control

pneumaticssolenoid valvecylindershop automationcompressed airesp32relayfittingsworkshop

We've covered sizing and running a shop air compressor, and separately covered PLCs and relays for automation logic, but there's a gap in between those two guides: the pneumatic actuators themselves — cylinders, solenoid valves, and the fittings that connect them — that turn "I have compressed air" and "I have a control signal" into "something actually moves." Pneumatics show up constantly in maker automation builds: tool-change pushers, material clamps, pick-and-place end effectors, CNC dust shoe lifters, automated workholding. This guide covers choosing and wiring a basic pneumatic actuation system from a shop air line through to ESP32 or PLC control.

Why Pneumatics Instead of a Motor or Solenoid Actuator

Pneumatic cylinders earn their place in a maker's toolkit for specific reasons a stepper or servo doesn't match: they deliver very high force-to-size and force-to-cost ratios (a small, cheap cylinder can push with far more force than an equivalently priced electric linear actuator), they're inherently simple and fast for two-position (extend/retract) motion without needing any motion control electronics at all, and they tolerate dirty, dusty shop environments — sawdust, metal chips, coolant mist — far better than exposed lead screws or linear rails. The tradeoff is that standard cylinders only reliably do two things well: fully extend or fully retract. Precise intermediate positioning is possible with proportional valves and position feedback, but at that point you're often better served by an electric actuator; pneumatics shine specifically at fast, forceful, binary motion.

Cylinder Types and Sizing

TypeHow It WorksGood For Single-actingAir pushes one direction, a spring returns itSimple clamps, push-only applications, fail-safe retract on air loss Double-actingAir pushes both directions via two portsMost general use — faster, more controllable, no spring force fighting the stroke Rodless cylinderInternal piston drives an external carriage magnetically or mechanically, no exposed rodLong strokes in tight spaces, gantry-style linear motion Rotary actuatorConverts air pressure into rotary motion, typically 90–180°Flip/rotate stations, valve actuation, indexing

Sizing a cylinder means working out the force it needs to deliver at your available shop air pressure. The relevant formula for a double-acting cylinder extending:

Force (lbf) = Pressure (PSI) × Bore Area (in²) Bore Area = π × (bore diameter / 2)²

A 1-inch bore cylinder on a typical 80 PSI shop line gives roughly 63 lbf of push force (π × 0.5² × 80 ≈ 62.8). Retract force is slightly less on a double-acting cylinder because the rod itself takes up some of the piston's effective area on that side. Always size with margin — real shop air pressure sags under load and with line length/restriction, so a cylinder sized to the bare minimum force needed will underperform once it's actually plumbed into your system rather than tested on a bench regulator.

Stroke length should match the actual travel needed with a small margin, not more — a longer stroke than necessary adds unsupported rod length that increases buckling risk under load and air consumption for no benefit.

Solenoid Valves: The Switch Between Control Signal and Air Flow

A solenoid valve is the pneumatic equivalent of a relay: a small electrical signal (typically 12V or 24V DC in maker projects, occasionally 120V AC in industrial gear) energizes a coil that shifts an internal spool, redirecting compressed air to the cylinder. The spec that matters most for choosing one is its port configuration, conventionally described as "ways/positions":

Also check whether a valve is single-solenoid (spring-returns to a default position when de-energized — good for fail-safe behavior, like a clamp that releases automatically on power loss) or double-solenoid (needs a pulse to each coil to shift either direction, and holds its last position if power is lost entirely — useful where an unexpected fail-safe retract would itself be a hazard, such as a workholding clamp that shouldn't suddenly release mid-cut).

Wiring a Solenoid Valve to a Microcontroller

Solenoid coils draw far more current than a GPIO pin can source directly, and they're inductive loads that generate a voltage spike when de-energized, so they're driven the same way as any other solenoid or relay coil: through a flyback-diode-protected MOSFET or an off-the-shelf relay module, never wired directly to a GPIO pin.

ESP32 GPIO --- 220Ω resistor --- MOSFET gate (e.g. IRLZ44N logic-level) Solenoid 24V+ --- Solenoid coil --- MOSFET drain MOSFET source --- GND (common with ESP32 GND) Flyback diode (1N4007 or similar) across the coil, cathode to +24V

For a 24V solenoid system running off a separate supply from your microcontroller's 3.3V/5V logic, tie the grounds together (common ground is required for the MOSFET's gate signal to mean anything relative to the drain-source circuit) but keep the power rails separate, and consider an optocoupler between the GPIO and the MOSFET gate if the valve is driven by noisy motor or VFD wiring nearby — see our guide on digital isolation for that setup. A relay module rated for the solenoid's voltage and current is a simpler, slightly slower-switching alternative to a discrete MOSFET driver and is the better choice if you're not confident sizing a MOSFET circuit yourself.

Air Prep: Why a Clean, Dry, Regulated Supply Matters Here Specifically

Pneumatic cylinders and solenoid valves are far more sensitive to contaminated air than a basic air tool is — moisture causes internal corrosion and seal swelling in valves over time, and particulate causes sticking spools and premature seal wear in both valves and cylinder bores. At minimum, run a filter/regulator/lubricator (FRL) unit immediately upstream of your pneumatic control system, even if the rest of your shop air tools run fine without one:

See our compressed air drying and filtration guide for sizing a dryer stage if your shop air already has a known moisture problem, which is extremely common with a basic single-stage compressor and no dedicated drying equipment.

Fittings and Tubing

Push-to-connect (push-fit) fittings in 4mm, 6mm, or 1/4" polyurethane tubing cover the overwhelming majority of maker-scale pneumatic work and need no tools beyond a tubing cutter — push the tubing into the fitting until it seats, pull the colored collar to release it. Match tubing OD to the fitting spec exactly; metric (4mm/6mm/8mm/10mm) and imperial (1/8"/5/32"/1/4"/3/8") push-fit systems are not interchangeable despite looking similar, and mixing them is a common source of slow leaks that are maddening to track down. Keep runs as short and direct as practical — long thin tubing runs add flow restriction that shows up as sluggish cylinder response, particularly noticeable on fast-cycling applications like a tool-change pusher.

Safety note: compressed air stores real energy, and a cylinder under pressure can move with enough force and speed to injure a hand or fingers caught in its path — always design actuator placement so no one can reach into the cylinder's travel path during normal operation, and never point an open, disconnected air line at yourself or anyone else when bleeding a system down. When servicing any pneumatic circuit, de-energize the solenoid valve, shut off and bleed the air supply, and confirm zero pressure at a gauge before disconnecting fittings — a cylinder can hold residual pressure and move unexpectedly even after the main supply is shut off if a valve is left in a position that traps air in one chamber.

A basic pneumatic station — FRL unit, a handful of push-fit fittings, a 5/2 solenoid valve, and a double-acting cylinder sized with reasonable margin — costs less than most stepper motor and driver combinations capable of the same push force, and needs far simpler control logic: one GPIO pin, high or low. For fast, forceful, two-position motion in a shop automation build, it's worth reaching for before defaulting to a motor-driven linear actuator out of habit.