Browsed by
Tag: hot exchanger

A Conveyor Belt Control System with an Arduino PLC and a Rasberry PI Panel PC HMI

A Conveyor Belt Control System with an Arduino PLC and a Rasberry PI Panel PC HMI

http://www.industrialshields.com

Conveyor belts are very common in industry: we can find them in different industries like mining, food & beverage or chemicals.  They are used to deliver heavy materials from one place to another. In this project we will make a control system based on M-Duino PLC hardware that can be controlled through an SCADA / HMI software for food industry.

Introduction

The application to be developed must ensure that a conveyor belt works properly:

  1. Must verify that the conveyor runs all the time.
  2. If a problem occurs, must alert to the operators of the plant.

To fulfill the requirements, the conveyor system has sensing devices like photoelectric and inductive sensors, lights and relay’s. Specifically, the hardware devices to be programmed and its function are as follows:

  1. Photoelectric sensor: Detect each manufactured product.
  2. Inductive motion sensor: Detect motion of motor.
  3. Relay’s output: Stop motor motion if an error occurs.
  4. Strobe lights: Alert if an alarm occurs.

The system is as shown below:

picture1

Code

We are going to program the M-Duino as it follows in the next part of this tutorial.

  1. For the photoelectric sensor, we are going to use interrupts in the rising mode. Each time that we have a new interruption, a new manufactured product has been detected.
  2. To detect that the motor is running we will use interrupts in rising mode as well. Each time that we have a new interruption, we can count a new cycle loop detected.
  3. We are going to use three strobe lights, two of them to alarm if a failure occurs:
  • If the motor has stopped.
  • If a production failure occurs, that it means that we don’t detect products through the photoelectric barrier for more than 30 seconds).
  1. The last strobe light comes from another part of the plant, and indicates that we have product demand, so the conveyor belt should be working. We are going to use relays to stop motors if an alarm occurs.

2014111_arduino_code

// Industrial Shields by BOOT & WORK CORP. // Powered by Opiron Electronics -www.opiron.com- // Feb.2015 technical information for newsletter // This sketch demonstrates how to program some // digital input / output signals through an M-Duino // PLC. The sketch is inspired in a real project of a // food plant, where we have to control a conveyor belt. // Keywords: Conveyor Belt, industrial automation. ////////////////////////////// //// PLC: M-DUINO MODULE //// //// Number of inputs: 2 //// Number of outputs: 4 //// you need to configurate the correctly switch position for running like digital / analog or PWM mode ////////////////////////////// //// M-Duino Pins Used: //// Q0.0 — PIN 36 — Digital Output (24Vdc) — Motor Failure Strobe //// Q0.1 — PIN 37 — Digital Output (24Vdc) — Product Demand Strobe //// Q0.2 — PIN 38 — Digital Output (24Vdc) — Product Failure Strobe //// Q0.3 — PIN 39 — Digital Output (24Vdc) — Stop Motor //// I0.0 — PIN 22 — Digital Input (24Vdc) — Photoelectric Barrier sensor, when active, a new product crosses the photoelectric barrier //// I0.1 — PIN 23 — Digital Input (24Vdc) — Inductive sensor, when active, a new loop detected in the motor //Pins defintion #define Motor_Failure_Strobe 36 // Alert if a motor failure alarm occurs #define Product_Demand_Strobe 37 // Alert if a product order is required #define Production_Failure_Strobe 38 // Alert if a production failure occurs #define Stop_Motor 39 // If an alert is detected we will stop the conveyor belt #define Photo_sensor 22 // Photoelectric sensor to detect manufactured products #define Ind_sensor 23 // Inductive sensor to detect the motion in the motor //Thresholds and constant interval times #define MINSPEED_THRESHOLD 500 // We consider that the minimum speed when the motor runs is 500 rpm, if a less speed is detected, we must alert and stop the plant #define time_photo_limit 4500 // We consider an interval of 4,5 seconds as the limit between each product can cross the photoelectric barrier #define rpm_interval 60000 // 1 minute // Variables volatile unsigned int rpm; // Variable to count the speed of the motor, consider rpm as revolutions per minute boolean Alarm; // Variable that says if we are in an alarm state or not unsigned long time_photo; // Variable to count the time between each product cross the photoelectric barrier unsigned long prevTime_rpm; // Variable to count each 60s the rpm of the motor // Functions void speedcount(); void manufacturing(); void setup() // Configuration is here: { // Pin settings pinMode(Motor_Failure_Strobe, OUTPUT); pinMode(Product_Demand_Strobe, OUTPUT); pinMode(Production_Failure_Strobe,OUTPUT); pinMode(Stop_Motor,OUTPUT); pinMode(Photo_sensor, INPUT); pinMode(Ind_sensor, INPUT); // Thresholds settings rpm=MINSPEED_THRESHOLD; // Initial speed value initialized with a higher value of minimun motor speed to disable an initial alarm // Interrupts attachInterrupt(Ind_sensor, speedcount, RISING); // Pin 2 attachInterrupt(Photo_sensor, manufacturing,RISING); // Pin 3 // Variables Alarm=0; } // End setup void loop() // The code in loop() runs repeatedly: { if(millis() – prevTime_rpm > rpm_interval) // Each 60 seconds we reinitialize rpm’s to 0 { prevTime_rpm = millis(); rpm=0; } if (rpm<MINSPEED_THRESHOLD) // Alarms Check I: Motor doesn’t work at the proper speed { digitalWrite(Motor_Failure_Strobe,HIGH); digitalWrite(Stop_Motor,HIGH); Alarm=1; } if(time_photo>time_photo_limit) // Alarms Check II: The manufactured products doesn’t cross the photoelectric barrier { digitalWrite(Production_Failure_Strobe,HIGH); digitalWrite(Stop_Motor,HIGH); Alarm=1; } else if (Product_Demand_Strobe) // Nonmal Conditions { Alarm=0; digitalWrite(Motor_Failure_Strobe,LOW); // The Failure Strobes must be off digitalWrite(Production_Failure_Strobe,LOW); digitalWrite(Stop_Motor,LOW); // The Motor must be running } // End Normal Conditions } // End loop void speedcount() // This function is executed each time that we have a new interrupt { rpm++; // Speed up! } // End speedcount() void manufacturing() // This function is executed each time a new product crosses the photoelectric barrier { time_photo=0; // When a new product crosses the photoelectric cell, the counter must reset } // End manufactuing()

POWERED BY OPIRON ELECTRONICS
Controlling temperature with a got exchanger through a modulating valve in chemical industry

Controlling temperature with a got exchanger through a modulating valve in chemical industry

Introduction

In industrial applications, the need to control temperature is usual. A typical element used and designed with this purpose is the hot exchanger, which interchanges two or more fluids with different temperatures.
Ardbox PID loopIn this post we are going to explain how to implement a temperature control through a modulating valve that will regulate the amount of steam that enters the hot exchanger, in order to heat the chemical process. To fulfill the specified requirements, Opiron electronics has developed a PID algorithm which will run on the Ardbox PLC from Industrialshields. Hot Exchanger Logic

Obviously, the main purpose of the aglorithm that we are going to make is a program to control the temperature of the pipe where the chemical process flows.  The element that will give us the chance to regulate the temperature is a modulating valve that has an analog input interface (0 / 10 Vdc) where we are going to send the setpoint from our PLC.

The modulating valve will control the amount of steam that flows to the pipe, and therefore the temperature (the more amount of steam we send, the more temperature there is in the pipe).

To control the temperature, we will use a PID algorithm and a temperature sensor as the input. However, there are other elementary elements to program:

  • valve open / close
  • pump on / off

These will be used from a process safety point of view: basically, if the temperature of the process is out of the limits (>80 ºC).

See below the developed code by Opiron:

2014111_arduino_code

 

// Industrial Shields by BOOT & WORK CORP.
// Powered by Opiron Electronics -www.opiron.com-
// Jan.2015 technical information for newsletter
// This sketch demonstrates how to use a PID with 
// an ARDBOX ANALOG PLC. The sketch is inspired in a
// real project of a chemical plant, where we have to 
// control the temperature of a pipe.
// PID explanation: The purpose of the pid is to 
// control a loop with a temperature sensor and
// a modulating valve. The modulating valve has 
// an analog input where we can send the setpoint
// Keywords: PID, industrial automation, modulating valve
/////////////////////////////////
//// PLC: ARDBOX ANALOG MODULE///
//// Number of Digital inputs: 2  
//// Number of Digital outputs: 3
//// Number of Analog inputs: 1
//// Number of Analog outputs: 1
//// you need to configurate the correctly switch position for running like digital / analog or PWM mode.
//////////////////////////////
//// Ardbox Pins Used:
//// Q0.9 --- PIN 0 --- Digital Output (24Vdc) --- Start / Stop pump
//// Q0.8 --- PIN 1 --- Digital Output (24Vdc) --- Open / Close feeding valve
//// Q0.7 --- PIN 7 --- Digital Output (24Vdc) --- Light alarm indicator
//// I0.3 --- PIN 4 --- Digital Input (24Vdc)  --- Pump runs confirmation 
//// I0.2 --- PIN 8 --- Digital Input (24Vdc)  --- Feed Valve Opened Ok
//// I0.9 --- PIN A0 --- Analog Input (0/10Vdc) --- Feeding Temperature signal
//// Q0.6 --- PIN A3 --- Analog Output (0/10Vdc) --- Setpoint to Modulating Valve

//libraries
#include 

//Pins defintion
#define Pump_Output 0        // Start / Stop pump
#define Valve_Output 1       // Open / Close feeding valve
#define Light  7             // 1 = Red (alarm) / 0 = false (Ok)
#define Pump_Input 4         // Pump Runs Ok
#define Valve_Input 8        // Feed Valve Opened Ok
#define Temperature A0       // Feed Temperature (after PID)
#define ModulatingValve A3   // Setpoint to Modulating Valve

// Other constants
#define HighTemp  80
#define LowTemp  40
#define intervalValve 10000
#define intervalPump 10000
#define intervalTemperature 60000

// Variables
unsigned long Valvetime;            // We use time to check if Valve opens when we have sent an Open Order
double Setpoint, Input, Output;     // PID Values
double kp = 2.5, ki = 30.3, kd = 5.1;         
unsigned long PIDwindowStartTime;   // Use it to compare PID Window Time
unsigned long PumpwindowStartTime;  // Use it to compare Valve Opening time
unsigned long ValvewindowStartTime; // Use it to compare Valve Opening time
unsigned long TemperaturewindowStartTime; // Use it to compare Temperature out of range
boolean valvefail;                  // 0 = Valve OK, 1 = Valve fails
boolean pumpfail;                   // 0 = Pump OK, 1 = Pump fails
boolean tempfail;                   // 0 = Temp OK, 1 = Temp fails

// Objects
PID TemperaturePID(&Input, &Output, &Setpoint,kp,ki,kd, DIRECT);

void setup() 
{ //Configuration is here:

  //Pin settings
  pinMode(Pump_Output, OUTPUT);
  pinMode(Valve_Output,OUTPUT);
  pinMode(Light,OUTPUT);
  pinMode(Pump_Input,INPUT);
  pinMode(Valve_Input,INPUT);

  // turn the PID on
  TemperaturePID.SetMode(AUTOMATIC);
  Setpoint=60;

  // Ini variables
  valvefail=0;
  pumpfail=0;
  tempfail=0;

} // End setup

void loop() {    // The code in loop() runs repeatedly:

if (tempfail)   // Alarms check I: tempfail
{
  digitalWrite(Pump_Output,LOW);
  digitalWrite(Valve_Output,LOW);
  digitalWrite(Light,HIGH);
}

else if (valvefail) // Alarms check II: Valve can't be opened
{
  digitalWrite(Pump_Output,LOW);
  digitalWrite(Valve_Output,LOW);
  digitalWrite(Light,HIGH);
}

else if (pumpfail) // Alarms check II: Pump doesn't start properly
{
  digitalWrite(Pump_Output,LOW);
  digitalWrite(Valve_Output,LOW);
  digitalWrite(Light,HIGH);
}

else 
  {
    digitalWrite(Pump_Output,HIGH);
    digitalWrite(Valve_Output,HIGH);
    digitalWrite(Light,LOW);
    Input = analogRead(Temperature);
    if (Input> HighTemp || Input < LowTemp)     {     if(millis() - TemperaturewindowStartTime>intervalTemperature)  //We count 1 minute             
    { 
      TemperaturewindowStartTime += intervalTemperature;
      tempfail=1;
    }
    }
    else
    {
      tempfail=0;
    }
    TemperaturePID.Compute();
    analogWrite(ModulatingValve, Output);
    if (Pump_Input==0)    //We wait for the Opened confirmation from the valve
    {
    if(millis() - PumpwindowStartTime>intervalPump)  //We count 10s until the Valve is Opened. If the Valve doesn't return the opened confirmation, we send an alarm                
    { 
      PumpwindowStartTime += intervalPump;
      pumpfail=1;
    }
   } // end If Pump_Input
   else if (Pump_Input==1)
   {
    pumpfail=0;  
   } // end Valve_Input==1
    if (Valve_Input==0)    //We wait for the Opened confirmation from the valve
    {
    if(millis() - ValvewindowStartTime>intervalValve)  //We count 10s until the Valve is Opened. If the Valve doesn't return the opened confirmation, we send an alarm                
    { 
      ValvewindowStartTime += intervalValve;
      valvefail=1;
    }
   } // end If Valve_Input
   else if (Valve_Input==1)
   {
    valvefail=0;  
   } // end Valve_Input==1

  } // end else, normal conditions
} // end loop
POWERED BY OPIRON ELECTRONICS