Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Industrial Automation

Pneumatic Solenoid Valve Control Using Arduino and Relay

Pneumatic Solenoid Valve Control Using Arduino and Relay

March 11, 2026 /Posted byJayesh Jain / 0

Controlling a pneumatic solenoid valve with Arduino and a relay module is one of the most practical skills in industrial automation. Solenoid valve Arduino relay control allows makers, automation engineers, and hobbyists to switch high-voltage pneumatic actuators from a low-power microcontroller, bridging the gap between digital logic and heavy industrial equipment. Whether you are building an automated irrigation system, a pneumatic press controller, or a factory conveyor gate, this guide walks you through every step.

Table of Contents

  • How Pneumatic Solenoid Valves Work
  • Choosing the Right Relay Module
  • Wiring the Circuit: Arduino + Relay + Solenoid Valve
  • Arduino Code for Solenoid Valve Control
  • Safety Considerations for Industrial Environments
  • Advanced Control: Timed Pulses and Sensor Feedback
  • Frequently Asked Questions

How Pneumatic Solenoid Valves Work

A pneumatic solenoid valve is an electromechanical device that controls compressed air flow. When voltage is applied to its coil, the electromagnet shifts a spool or poppet that opens or closes air ports. Most industrial valves are rated for 12V DC or 24V DC (common in Indian industrial panels), though 220V AC versions are also found in legacy installations.

Valve configurations are described as N/M (ports/positions): a 5/2 valve has five ports and two positions; a 3/2 valve has three ports and two positions. For most Arduino projects, a simple 2/2 normally-closed valve (two ports, two positions) works well — the valve is closed when de-energised and opens when Arduino energises the coil.

The coil resistance typically ranges from 15Ω to 40Ω. At 24V, this means 0.6A to 1.6A of coil current — far beyond the 40mA that an Arduino pin can source. This is precisely why a relay (or MOSFET driver) is essential.

Recommended: 5V Modbus RTU 4-Channel Relay Module with Optocoupler Isolation — Optocoupler isolation protects your Arduino from inductive spikes generated by solenoid coils.

Choosing the Right Relay Module

For solenoid valve Arduino relay control, select a relay module based on three criteria:

  • Coil voltage: Most Arduino relay modules are activated by 5V logic. Ensure the relay module accepts a 5V control signal (or 3.3V if using ESP32).
  • Contact rating: The relay contacts must handle the solenoid’s operating voltage and current. A 10A / 250V AC relay easily handles a 24V DC solenoid at 1A.
  • Isolation: Use an optocoupler-isolated relay module. This electrically separates the Arduino’s low-voltage circuit from the high-voltage solenoid side, protecting your microcontroller from back-EMF and voltage spikes.

Common relay module options available in India:

  • Single-channel 5V relay module — ₹30–₹60, ideal for single valve control
  • 4-channel relay module — ₹80–₹150, controls four valves independently
  • Solid State Relay (SSR) — ₹200–₹500, better for high-frequency switching or AC solenoids
Recommended: 12V 4-Channel Relay Module with RS485 — Useful when your control panel runs on 12V logic with Modbus communication to a master PLC.

Wiring the Circuit: Arduino + Relay + Solenoid Valve

The wiring follows a simple three-stage topology:

  1. Arduino → Relay module IN pin — A digital output pin (e.g., D7) drives the relay coil through the optocoupler.
  2. Relay contacts → Solenoid valve — The normally-open (NO) contact of the relay connects to one terminal of the solenoid coil; the common (COM) terminal connects to the positive rail of your external power supply (12V or 24V DC).
  3. External power supply negative — Connect the other terminal of the solenoid to the negative rail of the external supply. Never share the solenoid’s power supply with Arduino’s 5V rail.

Freewheeling diode: Always add a 1N4007 diode across the solenoid coil terminals (cathode to positive, anode to negative). This clamps the back-EMF spike when the coil is de-energised, protecting the relay contacts. Many pre-assembled solenoid valve coils already have a built-in diode — check the datasheet.

Common-ground rule: If you use an optocoupler-isolated relay board, the Arduino GND and the solenoid power supply GND do NOT need to be shared. But if using a non-isolated module, tie the grounds together for signal integrity.

// Wiring Summary
// Arduino D7  →  Relay IN1
// Arduino 5V  →  Relay VCC
// Arduino GND →  Relay GND
//
// 24V PSU (+) →  Relay COM
// Relay NO    →  Solenoid (+)
// Solenoid (-) →  24V PSU (-)
// 1N4007 diode across solenoid (+) to (-), cathode at (+)

Arduino Code for Solenoid Valve Control

The simplest sketch toggles the relay on and off on a fixed interval. Most relay modules are active-LOW — the relay energises when the IN pin is pulled LOW. Always check your specific module’s datasheet.

// Solenoid Valve Control with Arduino Relay Module
// Active-LOW relay module assumed

const int RELAY_PIN = 7;   // Digital output pin

void setup() {
  pinMode(RELAY_PIN, OUTPUT);
  digitalWrite(RELAY_PIN, HIGH);  // Relay OFF at startup (active-LOW)
  Serial.begin(9600);
}

void loop() {
  // Open valve for 2 seconds
  digitalWrite(RELAY_PIN, LOW);   // Energise relay → valve opens
  Serial.println("Valve OPEN");
  delay(2000);

  // Close valve for 3 seconds
  digitalWrite(RELAY_PIN, HIGH);  // De-energise → valve closes
  Serial.println("Valve CLOSED");
  delay(3000);
}

Button-Triggered Valve Control

For manual override with a push button:

const int RELAY_PIN  = 7;
const int BUTTON_PIN = 2;

void setup() {
  pinMode(RELAY_PIN, OUTPUT);
  pinMode(BUTTON_PIN, INPUT_PULLUP);  // Internal pull-up
  digitalWrite(RELAY_PIN, HIGH);      // Safe initial state
}

void loop() {
  if (digitalRead(BUTTON_PIN) == LOW) {   // Button pressed (active-LOW)
    digitalWrite(RELAY_PIN, LOW);         // Open valve
  } else {
    digitalWrite(RELAY_PIN, HIGH);        // Close valve
  }
}
Recommended: 8-Channel SSR Module (OMRON) for Arduino — Solid State Relays handle AC solenoid valves without mechanical wear, ideal for high-cycle applications.

Safety Considerations for Industrial Environments

Working with pneumatic solenoid valves in an industrial environment requires strict safety practices, particularly in India where voltage standards can vary:

  • Pressure relief: Never open a solenoid valve into a blocked pneumatic line. Install a pressure relief valve at the cylinder end.
  • Lockout/Tagout: De-pressurise the system before any wiring work. Follow IS/IEC lockout procedures.
  • Enclosure rating: Mount the Arduino inside an IP54 or higher rated enclosure in dusty or humid factory environments.
  • Fuse protection: Add a 2A fuse on the 24V supply line feeding the relay contacts.
  • Watchdog timer: Enable Arduino’s watchdog timer (wdt.h) to automatically reset the microcontroller if the firmware hangs, preventing the valve from getting stuck open.
  • Fail-safe state: Choose a normally-closed solenoid valve if the safe state is closed on power loss, and normally-open if the safe state is open.

In Indian factories, 24V DC power supplies are widely available and preferred for control circuits. The 24V SMPS (Switched Mode Power Supply) can typically power both the relay module and the solenoid coil from a single source, simplifying wiring.

Advanced Control: Timed Pulses and Sensor Feedback

Beyond simple on/off control, you can implement more sophisticated solenoid valve Arduino relay control strategies:

Timed Pulse (Latch) Control

Some solenoid valves are bistable (latching) — they change state on a pulse and hold without continuous power. A 50ms pulse is sufficient:

void pulseValve(int pin, int duration_ms) {
  digitalWrite(pin, LOW);       // Activate
  delay(duration_ms);
  digitalWrite(pin, HIGH);      // Release
}

Pressure Sensor Feedback Loop

Using a 4–20mA pressure transmitter with an Arduino analog input (via a 250Ω shunt resistor that converts current to 1–5V):

const int RELAY_PIN    = 7;
const int PRESSURE_PIN = A0;
const float TARGET_PSI = 80.0;

void loop() {
  int raw = analogRead(PRESSURE_PIN);
  // Convert ADC reading to PSI (calibrate for your transmitter range)
  float voltage  = raw * (5.0 / 1023.0);
  float pressure = (voltage - 1.0) * (100.0 / 4.0);  // 0-100 PSI range

  if (pressure  TARGET_PSI + 2) {
    digitalWrite(RELAY_PIN, HIGH);  // Close fill valve
  }
  delay(100);
}
Recommended: 4-20mA to 5V Converter for Arduino Industrial Sensor Interface Board — Essential for reading industrial pressure transmitters with your Arduino without additional resistors or complex scaling circuits.
Recommended: 5V Modbus RTU 1-Channel Relay Module with RS485 — Control solenoid valves remotely over RS485 Modbus from a PLC or SCADA system.

Frequently Asked Questions

Can I power the solenoid valve directly from Arduino’s 5V pin?

No. Arduino’s 5V pin can supply a maximum of 200mA (from USB). A 24V solenoid coil draws 600mA to 1.5A. Always use an external power supply for the solenoid and use the relay module as a switch between the supply and the coil.

Why does my relay chatter or make clicking sounds?

Chattering usually means the relay coil is not getting enough current from the Arduino pin. Ensure the relay module’s VCC is connected to 5V (not 3.3V) and the module has a dedicated transistor driver. Also check that the Arduino sketch does not have rapid toggling logic errors.

My solenoid valve gets very hot. Is this normal?

Slight warmth is normal; industrial solenoid coils can reach 60–70°C in continuous operation. If it is too hot to touch after a few minutes, check the voltage (24V coil with 12V supply will stay cool but not fully open; 24V coil with 30V will overheat). Ensure adequate ventilation around the coil.

Can I use an ESP32 or NodeMCU instead of Arduino for WiFi control?

Yes. ESP32 GPIO pins output 3.3V, which is sufficient to trigger most optocoupler-isolated relay modules. Some budget relay modules require 5V — in that case, add a small NPN transistor (2N2222) as a level shifter between the ESP32 pin and the relay’s IN terminal.

How do I control a valve from a PLC via Modbus?

Use a Modbus RTU relay module (RS485 interface). The relay has a unique Modbus slave address, and you write to coil register 0x0000 to turn it on or off. The PLC acts as the Modbus master, sending commands over a twisted-pair RS485 bus. This eliminates the Arduino entirely for production systems.

Shop Industrial Automation at Zbotic →

Tags: arduino relay, industrial automation, pneumatic control, relay module, solenoid valve
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
Lovelace Dashboard Design: Hom...
blog lovelace dashboard design home assistant ui guide india 597956
blog diy drone frame build f450 vs s500 carbon fiber guide 597966
DIY Drone Frame Build: F450 vs...

Related posts

Svg%3E
Read more

Compressed Air Monitor: Pressure and Leak Detection

April 1, 2026 0
Table of Contents Understanding Compressed Air Monitor Technical Fundamentals of Compressed Air Monitor Indian Market: Components and Pricing Sensor Integration... Continue reading
Svg%3E
Read more

Industrial Gas Detection: Multi-Gas Monitoring System

April 1, 2026 0
Table of Contents Understanding Industrial Gas Detection Technical Fundamentals of Industrial Gas Detection Indian Market: Components and Pricing Sensor Integration... Continue reading
Svg%3E
Read more

Cold Room Controller: Compressor and Defrost Cycle

April 1, 2026 0
Table of Contents Understanding Cold Room Controller Technical Fundamentals of Cold Room Controller Indian Market: Components and Pricing Sensor Integration... Continue reading
Svg%3E
Read more

Grain Storage Monitor: Temperature and Moisture

April 1, 2026 0
Table of Contents Understanding Grain Storage Monitor Technical Fundamentals of Grain Storage Monitor Indian Market: Components and Pricing Sensor Integration... Continue reading
Svg%3E
Read more

Poultry House Controller: Climate and Feeding Automation

April 1, 2026 0
Table of Contents Understanding Poultry House Controller Technical Fundamentals of Poultry House Controller Indian Market: Components and Pricing Sensor Integration... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now