How to Build an Electro-Pneumatic Reciprocating System With a 5/2 Solenoid Valve

Learn how to build an electro-pneumatic reciprocating system using a 5/2 solenoid valve, double-acting cylinder, limit switches, relays, or a PLC.

An electro-pneumatic reciprocating system combines electrical control with compressed air to make a pneumatic cylinder automatically move back and forth.

A typical system uses a double-acting pneumatic cylinder, a 5/2 directional control valve, two end-of-stroke sensors or limit switches, and an electrical control circuit. When the cylinder reaches one end of its stroke, the control circuit changes the state of the solenoid valve, causing the cylinder to travel in the opposite direction.

This creates a repeating sequence:

Extend – detect end of stroke – retract – detect end of stroke – extend again

Unlike a manually operated pneumatic circuit, an electro-pneumatic system can repeat this cycle automatically using relay logic or a PLC.

These circuits are particularly useful for learning how pneumatics, electrical control, limit switches, actuators, and industrial automation work together.

Table of Contents

Watch the Step-by-Step Guide

What You Will Learn

By the end of this guide, you will understand:

  • How a 5/2 solenoid valve controls a double-acting cylinder
  • The difference between single-solenoid and double-solenoid valves
  • How to build the pneumatic circuit
  • How limit switches control reciprocating motion
  • How relay logic can automate the cycle
  • How the same system can be controlled using a PLC
  • How to troubleshoot common reciprocating-cylinder problems
  • Where this type of circuit is used in industrial automation

How Does a 5/2 Solenoid Valve Work?

A 5/2 valve is a directional control valve with:

  • 5 ports
  • 2 switching positions
5-2 solenoid vale

It is commonly used to control double-acting pneumatic cylinders because it can direct compressed air to either side of the cylinder while providing separate exhaust paths.

Typical 5/2 Valve Ports

PortCommon LabelFunction
1PCompressed-air supply
2ACylinder working port
3R / EAExhaust
4BCylinder working port
5S / EBExhaust

The exact port markings can vary by manufacturer, so always confirm them using the valve manufacturer’s symbol or datasheet.

How the Valve Produces Reciprocating Motion

The solenoid coil produces an electromagnetic force that shifts the valve spool. This changes the internal air passages.

In one valve position, compressed air may flow to port A while port B exhausts.

In the opposite position, compressed air is routed to port B while port A exhausts.

The result is that the cylinder can move in either direction.

For a reciprocating system, the electrical control circuit repeatedly changes the valve state whenever the cylinder reaches the end of its travel.

Single-Solenoid vs. Double-Solenoid 5/2 Valves

One of the most important decisions when designing an electro-pneumatic circuit is choosing between a single-solenoid and double-solenoid 5/2 valve.

Single-Solenoid 5/2 Valve

A single-solenoid valve normally has:

  • One electrical coil
  • A spring return
  • One energized state
  • One spring-return state

The exact cylinder response depends on the valve’s normal position.

In a common arrangement, energizing the coil moves the cylinder in one direction and removing power allows the spring to return the valve to its normal position.

This makes the single-solenoid configuration relatively simple for beginner projects.

Double-Solenoid 5/2 Valve

A double-solenoid valve has:

  • Two coils
  • Two electrically controlled positions
  • No spring return in the basic bistable arrangement

A pulse to one coil moves the valve into one position. A pulse to the other coil changes it to the opposite position.

Because the valve can remain in its last commanded position without continuously powering a coil, the control strategy is different from a spring-return valve.

Comparison

FeatureSingle SolenoidDouble Solenoid
Number of coils12
Return mechanismSpringElectrical switching
Control complexityLowerHigher
Typical control methodOn/off signalSet/reset or pulse control
Beginner-friendlyYesRequires more control logic
PLC applicationsSimple systemsMore advanced sequencing

For a first electro-pneumatic project, a single-solenoid 5/2 valve can be easier to understand. A double-solenoid valve is useful when you need independent control of both valve states.

Components Required for an Electro-Pneumatic Reciprocating System

Before building the circuit, gather the required pneumatic and electrical components.

ComponentPurpose
Air compressorSupplies compressed air
FRL unitFilters, regulates, and optionally lubricates compressed air
5/2 solenoid valveControls cylinder direction
Double-acting cylinderProduces reciprocating movement
Flow control valvesAdjust cylinder speed
Limit switches or proximity sensorsDetect cylinder end positions
Relay or PLCProvides electrical control logic
24 V DC power supplyPowers control components when applicable
Start/Stop push buttonsProvides operator control
Tubing and fittingsConnects pneumatic components
Exhaust silencersReduce exhaust noise
MultimeterHelps diagnose electrical faults
Mounting frameSecures the components

The actual supply pressure, coil voltage, cylinder dimensions, and component ratings must always be selected according to the manufacturer’s specifications.

Pneumatic Circuit for a Reciprocating Cylinder

The basic pneumatic circuit follows this arrangement:

Compressor – FRL – 5/2 Solenoid Valve – Double-Acting Cylinder

The two working ports of the 5/2 valve connect to the two sides of the cylinder.

Step 1: Connect the Air Supply

Connect the compressor outlet to the FRL unit.

The FRL prepares the compressed air before it reaches the directional valve.

Step 2: Connect the FRL to the 5/2 Valve

Connect the regulated air supply to port 1 (P) of the 5/2 valve.

Step 3: Connect the Cylinder

Connect:

  • Valve port A to one side of the cylinder
  • Valve port B to the other side of the cylinder
pneumatic, FRL, distributor, 5/2 DCV to double acting cylinder connectionm-Bob Teaches Tech

The exact cylinder-side connection determines which valve state corresponds to extension or retraction.

Step 4: Install Flow Controls

Install flow-control valves near the cylinder ports to control the speed of extension and retraction.

A meter-out arrangement is commonly used in pneumatic applications because it provides better control of actuator movement in many situations.

Step 5: Install Exhaust Silencers

Use suitable silencers on the exhaust ports to reduce pneumatic noise.

Step-by-Step: How to Build the Electro-Pneumatic Reciprocating System

Step 1: Mount the Components

Secure the compressor connection, FRL unit, 5/2 valve, cylinder, sensors, and electrical components on a stable frame or training panel.

A well-organized layout makes the circuit easier to inspect and troubleshoot.

Step 2: Assemble the Pneumatic Circuit

With the air supply isolated, connect:

  1. Compressor to FRL
  2. FRL to valve port 1
  3. Valve port A to one cylinder port
  4. Valve port B to the other cylinder port
  5. Flow controls to the cylinder ports
  6. Silencers to the exhaust ports

Check every fitting before applying pressure.

Step 3: Test the Valve Manually

Many pneumatic directional valves include a manual override.

Use this feature, where provided, to verify that the valve switches correctly and that the cylinder moves in both directions.

Testing the pneumatic circuit independently from the electrical control circuit makes troubleshooting much easier.

Step 4: Install the End-of-Stroke Limit Switches

Install one switch at the extended position and another at the retracted position.

These switch provide feedback to the control system.

For example:

Cylinder fully extended → Limit 1 activated → command retract

Then:

Cylinder fully retracted → Limit 2 activated → command extend

Mechanical roller limit switches can be used, while magnetic cylinder sensors or proximity sensors can provide non-contact position detection.

Step 5: Build the Electrical Control Circuit

The electrical circuit connects:

Connect Power To the first limit switch of the electropneumatic circuit
  1. Connect power through the first limit switch to the relay A1

Depending on the application, the control logic can be implemented using:

  • Relays
  • Contactors
  • A PLC

Step 6: Test at Low Pressure

Start with a controlled pressure and observe one complete cycle.

Check:

  • Cylinder extension
  • Sensor operation
  • Valve switching
  • Cylinder retraction
  • Sensor operation at the opposite end

Do not increase speed or pressure until the sequence works reliably.

Step 7: Adjust the Cylinder Speed

Adjust the flow-control valves until the cylinder moves smoothly.

If the cylinder is too fast, it can cause excessive mechanical shock and unreliable sensor operation.

If it is too slow, the machine may operate inefficiently.

How to Wire a 5/2 Solenoid Valve for Reciprocating Motion

The electrical control method depends on the type of 5/2 valve.

Option 1: Relay Control With a Single-Solenoid Valve

A simple relay-based system can use a seal-in or latching circuit to maintain the operating state after the Start button is released.

A typical sequence is:

  1. Press Start.
  2. Control relay energizes.
  3. Relay contact maintains the circuit.
  4. Solenoid coil energizes.
  5. Cylinder moves toward one end.
  6. End-of-stroke sensor changes the control state.
  7. Valve returns or changes state.
  8. Cylinder moves in the opposite direction.
  9. The second sensor repeats the sequence.

The exact relay arrangement depends on the valve configuration and whether the control circuit must continuously energize the coil.

Option 2: Double-Solenoid Valve With Interlocking Logic

A double-solenoid valve requires careful control because both coils must not be energized simultaneously.

A common strategy is:

Extend command → energize extend coil

Retract command → energize retract coil

Electrical interlocking can be added so that the control circuit prevents both outputs from being energized at the same time.

Full electropneumatic connection ewith a latching circuit

This can be implemented using relay contacts or PLC logic.

PLC Control of an Electro-Pneumatic Reciprocating System

A PLC makes the circuit easier to expand and modify.

A typical PLC arrangement could include:

Inputs

  • Start push button
  • Stop push button
  • Extend limit switch
  • Retract limit switch
  • Emergency-stop status

Outputs

  • Solenoid output for extend
  • Solenoid output for retract
  • Status indicator

The logic can be programmed using ladder logic.

A simplified sequence is:

START
  ↓
Cylinder extends
  ↓
Extend sensor ON
  ↓
Cylinder retracts
  ↓
Retract sensor ON
  ↓
Cylinder extends
  ↓
Repeat

A PLC also allows you to add:

  • Timers
  • Counters
  • Cycle limits
  • HMI controls
  • Fault alarms
  • Automatic/manual modes
  • Production counters
  • Additional pneumatic stations

This is where the circuit becomes especially relevant to industrial automation and PLC programming.

Safety Considerations

Pneumatic systems can store significant amounts of energy. Do not treat a training circuit as harmless simply because the components are small.

Before operating the system:

  • Check the rated pressure of the cylinder and valve.
  • Never exceed component ratings.
  • Depressurize the system before servicing pneumatic tubing.
  • Isolate electrical power before working on wiring.
  • Keep hands away from the cylinder’s moving path.
  • Install an emergency-stop arrangement appropriate to the machine.
  • Verify the solenoid coil voltage before applying power.
  • Secure tubing and wiring so they cannot interfere with moving parts.
  • Use suitable exhaust silencers where required.
  • Test the system at a controlled pressure before normal operation.

For an industrial machine, the safety system should be designed according to the machine’s risk assessment and applicable safety requirements.

Common Problems and How to Troubleshoot Them

ProblemPossible CauseRecommended Check
Cylinder does not moveNo air supplyCheck compressor, regulator, and pressure
Valve does not switchIncorrect coil voltage or wiringMeasure voltage at the solenoid
Cylinder moves only one directionIncorrect valve connections or valve faultCheck port connections and manual override
Cylinder moves too quicklyExcessive airflowReduce flow-control setting
Cylinder moves too slowlyRestricted airflow or low pressureCheck pressure, tubing, and flow controls
Reciprocation does not repeatSensor not detecting end positionCheck sensor position and wiring
Cylinder stops prematurelySensor positioned incorrectlyReposition the limit switch or proximity sensor
Both coils activateMissing electrical interlockCheck PLC or relay logic
Solenoid coil overheatsIncorrect voltage or duty conditionCheck coil rating and control method
Pneumatic system is noisyExcessive exhaust noiseInstall suitable exhaust silencers
Cylinder movement is jerkyPoor flow control or unstable pressureAdjust flow controls and verify air supply

Why the Cylinder May Fail to Reciprocate

One of the most common beginner mistakes is assuming that a pneumatic cylinder will automatically reverse direction when it reaches the end of its stroke.

It will not.

The system needs feedback and control logic.

The limit switch or proximity sensor detects the cylinder position. The electrical control circuit then changes the state of the directional valve.

That creates the closed-loop sequence:

Cylinder movement → position detection → electrical decision → valve switching → cylinder movement

This simple concept is one of the foundations of industrial automation.

Applications of Electro-Pneumatic Reciprocating Systems

The same control concept appears in many industrial machines.

Examples include:

  • Conveyor pushers
  • Part sorting mechanisms
  • Clamping systems
  • Automatic stamping machines
  • Pick-and-place equipment
  • Packaging machines
  • Diverting mechanisms
  • Cutting equipment
  • Assembly fixtures
  • Material handling systems

In a real production machine, the basic two-sensor reciprocating circuit can be expanded with PLCs, HMIs, additional sensors, safety systems, counters, and multiple actuators.

Relay Control vs. PLC Control

FeatureRelay ControlPLC Control
Initial complexityLowerHigher
WiringMore extensiveMore compact
Logic changesRequires rewiringSoftware change
Timers/countersAdditional hardwareBuilt-in functions
HMI integrationLimitedExcellent
DiagnosticsMore difficultEasier
ExpansionLimitedHighly scalable
Best applicationSimple machines and trainingIndustrial automation

For learning electro-pneumatics, relay logic is valuable because it shows how the underlying control sequence works.

For larger automation systems, PLC control provides much greater flexibility.

Watch a Beginer-Friendly Introduction to Pneumatics

Frequently Asked Questions

What does 5/2 mean on a solenoid valve?

A 5/2 valve has five ports and two switching positions. The five ports typically include one pressure supply port, two cylinder working ports, and two exhaust ports.

What type of cylinder is used with a 5/2 valve?

A 5/2 directional control valve is commonly used with a double-acting pneumatic cylinder, where compressed air is applied alternately to either side of the piston.

Can a 5/2 valve make a cylinder reciprocate automatically?

Yes, but the valve itself does not create the complete reciprocating sequence. The system needs an electrical control method, such as limit switches with relay logic or PLC logic, to detect the end of each stroke and command the next valve position.

Can I build the system without a PLC?

Yes. A basic electro-pneumatic reciprocating system can be built using relays, push buttons, limit switches, and a solenoid valve.

A PLC becomes more useful as the machine becomes more complex.

What sensors can detect the cylinder position?

Common choices include:

  • Mechanical limit switches
  • Magnetic reed sensors
  • Magnetic solid-state cylinder sensors
  • Proximity sensors

The best option depends on the cylinder, mounting arrangement, required reliability, and control system.

What voltage should I use for the solenoid valve?

Use the voltage specified on the valve’s coil nameplate or datasheet.

Never assume that every pneumatic solenoid uses 24 V DC.

Common coil configurations include 24 V DC and various AC voltages, depending on the valve.

Why is my cylinder moving in the wrong direction?

The cylinder direction depends on how the two cylinder ports are connected to the A and B ports of the directional valve.

Swap the working-port connections only after safely depressurizing the system and verifying the valve manufacturer’s recommended configuration.

What pressure should I use?

There is no universal operating pressure for every system.

Small demonstration systems may operate comfortably within a moderate pressure range, but the correct value depends on the cylinder, valve, regulator, tubing, fittings, and application.

Always follow the manufacturer’s ratings.

What is the difference between a 4/2 and 5/2 valve?

Both can control a double-acting cylinder.

A 5/2 valve has two exhaust ports, providing separate exhaust paths for the two cylinder directions. This configuration is widely used for pneumatic actuator control.

Why does my double-solenoid valve require interlocking?

A double-solenoid valve has separate coils for its two switching commands. The control system should prevent both coils from being energized simultaneously.

In a PLC system, this is normally handled through the logic. In a relay system, electrical interlocking can be used.

Building an Electro-Pneumatic Reciprocating System

Building an electro-pneumatic reciprocating system is one of the best practical ways to understand how pneumatic power and electrical control work together.

The core system is simple:

Compressor + FRL + 5/2 solenoid valve + double-acting cylinder + position sensors + control logic

Once the basic circuit is working, the same concept can be expanded into a PLC-controlled automation system with timers, counters, HMI control, alarms, and multiple pneumatic actuators.

For anyone learning mechatronics, pneumatics, PLC programming, or industrial automation, this project provides a practical example of how an electrical control signal can command a pneumatic actuator to perform a repeatable automated sequence.

Recommended Next Step

After building the basic reciprocating circuit, the next useful project is to replace the relay logic with a PLC ladder logic program and add Start, Stop, Emergency Stop, cycle counting, and automatic/manual operating modes.

That takes the project from a simple pneumatic demonstration to a realistic industrial automation training project.

About The Author