Introduction: TANK_CONTROL PROJECT
Introduction
TANK_CONTROL project presents some of the basic concepts of control commonly used in industry, and provides the foundation to understand more complex control processes. Common terms and concepts relating to process control are defined in this project. Control loop, Process variable, Setpoint, Measured variable and Error definitions are considered. Also you will learn about the three tasks necessary for process control: Measure, Compare and Adjust
Supplies
Bill of Materials (BOM)
ITEM DESCRIPTION QTY
1 Arduino Uno, Rev. 3 1
2 Potentiometers, 10K 2
3 Diode 1N4001 2
4 Transistor 2N3904 1
5 Resistor 330, 0.25W 1
6 Resistor 1K, 0.25W 1
7 Resistor 47K, 0.25W 1
8 Hex Inverter, 74HC04 IC 1
9 Condenser 0.1µF 1
10 Relay SPDT, 12 Volts 1
11 ITR-9606 DIP-4 Opto Switch 1
12 Submersible Pump, BOYU SP-1500, 120 Vac 1
13 Plastic float 1
14 Plastic valves 2
15 Metallic base 1
16 Hardware (Connectors, gaskets, plastic hose,
plastic tubes) LOT
17 Plasic water bottle (20 lts) 1
18 Plastic container 1
Step 1: Project Scope
This project consists of the assembly of a level control system in a tank.
Level measurement is an important and common variable in the industry environment.
There are many ways to sense level. You could use pressure, ultrasonic, capacitance, or discrete (switches) sensors.
For this project we will consider a potentiometer, as a sensor, attached to a floating mechanism to bring data information to the controller.
In the figure 1 you can see the block diagram for the project. There are two tanks: TANK_1 and TANK_2. In TANK_1 we measure the level and TANK_2 is used to recirculate the liquid.
There are two valves, one to control the stream to TANK_1 and the other which is the drain to TANK_2. RL and RSP are two potentiometers which inform to the controller of the status of the level and the set point.
Finally the pump keeps recirculating the liquid to maintain the desire level in TANK_1.
Step 2: Principle of Operation
To understand how this system operates, we have to consider the following control definitions:
Process Value (PV): The value to be measured. In this case, the tank level
SetPoint (SP): The required value
Output (OUT): The controller output
Error: the difference between the measured variable (PV) and the setpoint (SP) and can be either positive or negative
Closed Control Loop: A closed control loop is a configuration of a control system where the process variable is measured, compared with a setpoint, and action is taken to correct any deviation from setpoint
Controller: A device capable of read data from a measurement instrument, compare with the set point and then generates an output value, which is the result of that comparison
There are 2 main control types:
⦁ ON-OFF
⦁ PID, where P: Proportional, I: Integral and D: Derivative are the modes of control
These 3 modes are used in different combinations:
P – Only proportional
PI – Proportional + Integral
PID – Proportional + Integral + Derivative
PD – Proportional + Derivative
The diagram show in Fig. 2 is a typical ON_OFF control block.
Float position (PV) can vary from 0 to 100%.
With the SP (Set Point), we can fix the desire value of level.
If the level is lower than the SP value, then the pump is activated (OUT = 1) until the SP value is reached.
If the level is greater than the SP value, then the pump is stopped (OUT = 0) until the SP value is reached.
We can represent the operation of this control loop through the following equation:
PV – SP = Δ; Where Δ is the Error
if Δ > 0, then OUT = 0 (Boolean)
if Δ < 0, then OUT = 1 (Boolean)
Fig. 3 shows graphically the operation of the controller.
If the process value is less than the setpoint, output value will be “1” (activated pump)
If the process value is greater than the setpoint, output value will be “0” (pump off).
Step 3: HMI (Human Machine Interface)
At this time HMI (Human Machine Interface) is considered.
There is much software developed for HMI applications available in the market. LabVIEW, Wonderware, Panel Studio, FoxView, eLogger and Infilink are some of them
For the HMI of this project I found an application for micro-controllers in the web, called SerialComInstruments4 and develop by Ulrich Albert Maassen.
The web address to download this application is: www.SerialComInstruments.com
In the figure 4, I show the screen for the project. There, you can see the tanks, valves and the pump, in the left side are the numeric values expressed in % (0%-100%). At the top-right of the screen you can see the trending of the variables of the tank. Status of the pump can be observed in the indicator above the pump.
SerialComInstruments4 allows you to create environments to build process displays where you can see the process values, set points, Trends, X-Y Graphics, Numeric Displays, Vertical Meters and Digital Displays.
In the main menu you will find six fields to access the different functions of this application:
File, Interface, Terminal, Settings, Test Tools and Help
You also can perform the following functions:
COM: If you select “COM”, you will be able to Connect and Disconnect the interface
LAN: Network connection
Start /Stop Trend: Start or Stop the trending of process variables
Design Toggle: In this field you can go to the Edit Mode. In this mode you can build your display
Liste: Displays a list of all the instruments that you used in your design
Display1, 2, 3, 4, 5: Allows you to select the desired display (display 1, display 2, etc.)
If you select “File” you can start a new Project, Load and Save a Project (Figure 4.1)
You can select the Serial “Interface”, where you specify: Com Port, Baud Rate, also you can change the Data Protocol (Figure 4.2.1 and figure 4.2.2)
"Terminal" menu allows you to visualize serial data in the screen (Figure 4.3)
In "Settings" you can activate the Carriage Return and the Line Feed (Figure 4.4)
In "Test Tools" menu you can simulate process changes through a sinewave generator and a ramp wave generator (Fig. 4.5)
Selecting the field “Instr. Box” you can select a diversity of resources for your project Vertical, Flex and Horizontal Meters are available in Analog Meter of the Tool Box (Figure 4.6)
Numeric Display and Led’s are available in Digital Meter of the Tool Box
Trends are available in Graph of the Tool Box
Analog Sliders are available in Analog Actors of the Tool Box
Switch Buttons and Button Panels are available in Digital Actors of the Tool Box
Text Displays are available in Text Based of the Tool Box
Background and Text Labels are available in Design of the Tool Box
Step 4: Assembly
- Figure 6 shows assembly of the plastic water bottle (TANK_1); plastic valves and tubing are also assembled
- Figures 7, 8 and 9 show the metallic base and plastic float assembled
- Figure 10 shows the detail of the level potentiometer
- Figure 11 shows the plastic container (TANK_2)
- Figure 12 shows the Submersible Pump installed in the plastic container
- Figures 13 and 14 show the System assembled
Step 5: Schematics
Fig. 15 shows the Circuit Diagram of the project....
Step 6: Code
// This routine let you to CONTROL level in a tank:
// Standard protocol to select instruments:
void SendString (byte InstrNr, int MW) {
Serial.print ('#');
Serial.print (InstrNr);
Serial.print ('M');
Serial.print (MW);
Serial.print ('<'); }
void SendString (byte InstrNr, int f, int d, int m) {
Serial.print ('#');
Serial.print (InstrNr);
Serial.print ('M');
Serial.print (f);
Serial.print (d);
Serial.print (m);
Serial.print ('<') ;}
void setup ()
{ // initialize serial communication at 9600 bits per second:
Serial.begin (9600); }
void loop () {
int RL = A0; // select the input pin for the LEVEL potentiometer
int RSP = A1; // select the input pin for the SET POINT potentiometer
int X = 8; // select the pin for the pump control (ON - OFF)
int LEVEL = 0.0; // variable to store the value coming from RL
int SETPOINT = 0.0; // variable to store the value coming from RSP //
declare X as an OUTPUT:
pinMode(X, OUTPUT);
// read the values from RL and RSP:
LEVEL = analogRead (RL);
SETPOINT = analogRead (RSP);
// compare sensor values:
int F;
int D;
int M;
if (LEVEL < SETPOINT - 21){digitalWrite(X, HIGH); }
if (LEVEL < SETPOINT) {F = 2; }
if (LEVEL < SETPOINT) {M = 0; }
if (LEVEL > SETPOINT + 21) {digitalWrite(X, LOW); }
if (LEVEL > SETPOINT) {F = 3 ;}
if (LEVEL > SETPOINT) {M = 1 ;}
float TRUE_LEVEL = LEVEL * (100.00 / 1023.00);
float TRUE_SETPOINT = SETPOINT * (100.00 / 1023.00);
// print out the value you read:
SendString (2, TRUE_LEVEL); // Instrument #02 – Vert_Meter
SendString (3, TRUE_LEVEL); // Instrument #03 – Tank_Meter
SendString (4, F, D, M); // Instrument #04 - LED
SendString (5, TRUE_LEVEL); // Instrument #05 – Num_Display
SendString (6, TRUE_SETPOINT); // Instrument #06 - Num_Display
SendString (12, TRUE_LEVEL); // Instrument #12 - Trend
SendString (13, TRUE_SETPOINT); // Instrument #13 - Trend
delay (500); }
Step 7: Conclusion
To successfully work with control systems, it is necessary to understand the concepts and principles that are typically used to explain process control.
In this project we use a very simple system which utilizes a float connected to a variable potentiometer that will change the resistance according to the amount of motion of the float. But despite the simplicity of the system, the number of principles, terms and concepts involved is immense. Many of those principles and concepts were not addressed in this project, but those who were, are the basis for continuing a deeper study in the extremely wide world of control and instrumentation.





