senior project report -...
TRANSCRIPT
2014
Hussain Abbas
Qassim Ashoor
20090222
David Krause
Senior Project Report
Hussain Ashoor 20090222
2 | P a g e
Abstract
The aim of project was to design, build, program and test a separation system
which is used in BANAGAS Company which is operating now to gets gas from
the ground. The designing of this project was done by using Altium designer
program which designed the circuit in it and also the Solid Works was used to
design some hardware parts. The building part of this project was to make a
wood board to fix the tanks which made with acrylic plastic and fix all the
sensors and equipment on it for simulation. The programming part was into
two parts, first part was using PLC program RSlogix 5000 and Mbed
microcontroller which will indicate any pump on the LCD display. Furthermore,
the SCADA program was used to give an advantage of operating the process
by following the process through computer. The process is the main and the
most important process in Banagas Company. This process is extracting raw
oil from the ground which without this process the company will shutdown.
The benefit of this project is to make a simulation for trainees at the Company
to let them become familiar with the company processes. After finishing the
project some points were mentioned for how to improve the project in future
such as using better equipment, components, sensors and modules for the
PLC controller.
Hussain Ashoor 20090222
3 | P a g e
Table of Contents Abstract ..................................................................................................................... 2
Table of Contents ...................................................................................................... 3
Table of Figures ........................................................................................................ 4
Table of Tables ......................................................................................................... 5
Project Objectives ..................................................................................................... 6
Objectives and task description ................................................................................. 7
Altium .................................................................................................................. 12
Relay Circuit ........................................................................................................ 20
Software .............................................................................................................. 28
PLC Program ................................................................................................... 28
PLC modules input and output list .................................................................... 29
Discussion ............................................................................................................... 32
Observations and recommendations ....................................................................... 33
Appendix A .............................................................................................................. 34
PLC program rungs ............................................................................................. 34
Mbed program code ............................................................................................. 41
Appendix B .............................................................................................................. 44
Datasheets .......................................................................................................... 44
Appendix C ............................................................................................................. 47
Hussain Ashoor 20090222
4 | P a g e
Table of Figures Figure 1: Bilge pump 700 GPH .................................................................................. 7
Figure 2: Ultrasonic sensor fixed in the project .......................................................... 7
Figure 3: Level sensor switch .................................................................................... 8
Figure 4: level sensor position is normally open ........................................................ 8
Figure 5: level sensor position is normally close ........................................................ 8
Figure 6: MQ2 gas sensor ......................................................................................... 9
Figure 7: Temperature sensor ................................................................................... 9
Figure 8: Fan 24 volts ............................................................................................. 10
Figure 9: LCD display 16 X 2 .................................................................................. 10
Figure 10: LCD connection pins .............................................................................. 10
Figure 11: seven-segment ....................................................................................... 11
Figure 12: seven-segment voltage divider and pins header ..................................... 12
Figure 13: one the seven-segment display circuits .................................................. 13
Figure 14: Switching regulator circuit LM2576 ......................................................... 14
Figure 15: Voltage comparator circuit ..................................................................... 15
Figure 16: Mbed voltage divider with pins header ................................................... 16
Figure 17: Mbed chip with LCD display ................................................................... 17
Figure 18: PCB circuit ............................................................................................. 18
Figure 19: PCB relay circuit ..................................................................................... 20
Figure 20: Relay schematic circuit .......................................................................... 21
Figure 21: Solid work design of the tank .................................................................. 22
Figure 22: The tank after building ........................................................................... 23
Figure 23: 3D concept which was made in Solid works ........................................... 23
Figure 24: 3D printer machine making the concept.................................................. 24
Figure 25: Stand of ultrasonic sensor dimensions ................................................... 24
Figure 26: Wood board and tanks fix on it ............................................................... 26
Figure 27: Control panel .......................................................................................... 26
Figure 28: Mbed pins ............................................................................................... 30
Figure 29: SCADA main page ................................................................................. 31
Figure 30: Rung 0 to 2 ............................................................................................. 34
Figure 31: Rung 3 to 5 ............................................................................................. 34
Figure 32: Rung 6 to 9 ............................................................................................. 35
Figure 33: Rung 10 to 13 ......................................................................................... 35
Figure 34: Rung 14 to 17 ......................................................................................... 36
Figure 35: Rung 18 to 19 ......................................................................................... 36
Figure 36: Rung 20 to 22 ......................................................................................... 36
Figure 37: Rung 23 to 24 ......................................................................................... 37
Figure 38: Rung 25 to 27 ......................................................................................... 37
Figure 39: Rung 28 to 30 ......................................................................................... 37
Figure 40: Rung 31 to 32 ......................................................................................... 38
Figure 41: Rung 33 to 34 ......................................................................................... 38
Figure 42: Rung 35 to 37 ......................................................................................... 38
Figure 43: Rung 38 to end ....................................................................................... 39
Figure 44: Beginning alarm add on .......................................................................... 39
Figure 45: Beginning alarm add on 2 ....................................................................... 39
Figure 46: Leakage alarm add on ............................................................................ 40
Hussain Ashoor 20090222
5 | P a g e
Figure 47: High temperature add on ........................................................................ 40
Figure 48: Code 1 to 18 ........................................................................................... 41
Figure 49: Code 20 to 45 ......................................................................................... 41
Figure 50: Code 47 to 72 ......................................................................................... 42
Figure 51: Code 74 to 93 ......................................................................................... 42
Figure 52: Code 96 to 110 ....................................................................................... 43
Figure 53: LM2576 datasheet .................................................................................. 44
Figure 54: LM2576 drawing circuit in the datasheet................................................. 45
Figure 55: Ultrasonic sensor wiring colors ............................................................... 46
Figure 56: Ultrasonic teaching way .......................................................................... 46
Figure 57: Panel in process ..................................................................................... 47
Figure 58: Panel in process 2 .................................................................................. 47
Figure 59: Board and fixing the tanks on it with the level sensors ............................ 48
Figure 60: Process in progress and the pump1 & 2 are on ...................................... 48
Figure 61: Process in progress and showing that pump 2 is stopped ...................... 49
Figure 62: Process in progress and filling Bapco tank with oil ................................. 49
Figure 63: PCB circuit ............................................................................................. 50
Figure 64: Relay PCB circuit ................................................................................... 50
Table of Tables Table 1: switching regulator results ......................................................................... 14
Table 2: bill of material ............................................................................................ 19
Table 3: Relay Circuit table of materials .................................................................. 20
Table 4: PLC module output list............................................................................... 29
Table 5: PLC module input list and analog input list ................................................ 29
Hussain Ashoor 20090222
6 | P a g e
Project Objectives
The objectives of this project were:
- Implementing what was learned in the engineering years since year 1
until the 3rd year of studying
- Working individually to produce a level 7 fully functioning project
- Showing that the students are capable of doing the research and
solving the problems that they face during doing a project
- Creating a project from a start by starting first with an idea until
finishing the project by their selves.
- Improving critical thinking and innovation for the students and giving
them the chance of improving their on projects.
- Search about how to build the circuits required for this project.
Hussain Ashoor 20090222
7 | P a g e
Objectives and task description
Bilge Pump
It was used in the tanks to transfer water from the main row tank to the
separation tank and then drive them to the final stage in the process. The
pumps could operate till 12 volts but will be used with 3 volts supply.
Figure 1: Bilge pump 700 GPH
Ultra sonic sensor
The Ultrasonic sensor was used in Bapco store tank to detect and indicate the
level of the oil that will be store in the tank so it could be transfer to Bapco
after it reaches the high level. The sensors have to be taught by using the
teaching button on the top of them, the sensors come with an installation
instruction to provide the technique of teaching them. See appendix B
Figure 2: Ultrasonic sensor fixed in the project
Hussain Ashoor 20090222
8 | P a g e
Level switch (sensor)
The level switch sensor PTFA0100 from CELDUC was used to maintain the
water level in separation tank till it reaches 100 % and to let the bilge pump
turn on and deliver the water to Bapco tank and also to the Boiler tank. The
level switch sensor has a temperature rating from 0-70 C, its maximum
switching current is 0.5 amps and its maximum switching voltage is 200 Volts
DC.
Figure 3: Level sensor switch
Figure 4: level sensor position is normally open
Figure 5: level sensor position is normally close
Hussain Ashoor 20090222
9 | P a g e
Gas & Smoke detector
This MQ2 was mainly used to detect the gas (Smoke) along the process
where it was actually used during the entire process. This sensor is highly
accurate by detecting gas. The circuit voltage is 5 volts and the resistance
could be adjusts because of the variable resistor.
Figure 6: MQ2 gas sensor
Temperature sensor PT100
It was mainly used to measure the temperature of the water at the boiler tank
to keep monitoring the boiling temperature which will give an alarm when the
temperature reaches certain temperature.
Figure 7: Temperature sensor
Hussain Ashoor 20090222
10 | P a g e
Fan 24 Volts
The fan was used as an exhaust system in the project, which is delivering the
smoke from a tank to another for example from separation system tank to
Banagas tank which will be stored there for another process.
Figure 8: Fan 24 volts
LCD 16 X 2
The LCD display was used to keep monitoring the operation step by step and
to detect any leakage could happen during the operation. Moreover, any
pumps operating will be shown on the LCD display.
Figure 9: LCD display 16 X 2
Figure 10: LCD connection pins
Hussain Ashoor 20090222
11 | P a g e
Seven-segment
A seven-segment display (SSD) or seven-segment indicator is form of
electronic display device for displaying decimal numerals that is an alternative
to more complex dot matrix displays. Seven-segment displays are widely
used in digital clocks, electronic meters and other electronic devices for
displaying numerical information. Six 7-segments were used in the project and
they were divided into two. Each three 7-segments were indicating a process.
First three seven-segments were used to indicate the temperature of Boiler
tank. Second three seven-segments were used to indicate the level of oil level
in Bapco store tank.
Figure 11: seven-segment
Hussain Ashoor 20090222
12 | P a g e
Altium
Mbed, Seven-Segment, Voltage regulator and voltage comparator circuit
Figure 12: seven-segment voltage divider and pins header
A header of 10 pins was used to take signals from PLC controller which gives 24V to
the 7segment circuits which need 5V. For that, resistors were added to reduce the
voltage to 5V which is voltage divider circuit. A calculation was used to find the
resistors value.
𝑉𝑜𝑢𝑡 = 𝑅𝑏
𝑅𝑎 + 𝑅𝑏 × 𝑉𝑖𝑛
5𝑉 = 4.7𝐾
𝑅𝑎 + 4.7𝐾 × 24𝑉
𝑅𝑎 = 18𝐾
The 4.7Kohm and 18Kohm were used because they are available in the university
store.
Hussain Ashoor 20090222
13 | P a g e
Figure 13: one the seven-segment display circuits
Seven-segment circuit contains of two main parts the seven-segment displays
and the (CD4511BE) decoder. There are three seven-segment displays in
one part and each seven-segment connected with a decoder. A decoder is a
device which does the reverse operation of an encoder, undoing the encoding
so that the original information can be retrieved. The same method used to
encode is usually just reversed in order to decode. The PLC output will supply
the binary code to the decoders, then the decoder will encoder the binary
code to the seven-segment to display the number. This circuit will be supplied
from the PLC 24V. For the decoders it need about 5V, so the (LM2576) chip
has been used to reduce the voltage from 24V to 5V for the decoders. For the
seven-segment it need about 2V so a 470ohm resistors pack used to reduce
the value from 5V to 2V.
Hussain Ashoor 20090222
14 | P a g e
Figure 14: Switching regulator circuit LM2576
This circuit will be supplied from the PLC 24V and it will reduce the voltage to
5V which is needed in most of the PCB components. So the (LM2576) chip
has been used to reduce the voltage from 24V to 5V. Moreover, the regulator
circuit was designed in the Altium program and after that it was connected on
bread board to do some experiments. The inductor that was used in the circuit
was (221) 200uH which near to value 150uH as shown in the datasheet and
also that inductor could be alive till 2 amps. The table below is showing the
experiment results.
Table 1: switching regulator results
Load Current Temp Voltage Theory current
3.3 ohms (100 watts)
1.36 amps 38 C 4.7 V 1.4 amps
2 X 4.7 ohm (100 watts)
Parallel ( 2.35 ohm)
1.9 amps 52 C
After 30 min 73 C
4.7 V 2 amp
Besides, in the beginning the MC 34063 was tested to be supplier voltage for
the project but it has a maximum of 1.5 amps which can operate but for the
project was done it needs around 2 amps to be operate which the LM 2576 is
suitable to be used instead of MC 34063 which gets heat faster than LM 2576.
Hussain Ashoor 20090222
15 | P a g e
Figure 15: Voltage comparator circuit
Voltage comparator is a device that compares between two voltages or even
currents and shows which is larger. The voltage comparator circuit was added
in the circuit to sense the smoke leakage happened through the process.
Furthermore, the circuit gives both of PLC and Mbed a signal that there is a
leakage in the plant which will stop the process immediately and switch on the
siren. The comparator circuit gets 5 volts from the switching regulator circuit.
The Op amp 358 was used to generate the signal to the PLC and give the
signal to switch on the Alarm. A trimmer 10k was used to change the analog
signal to digital so it gives the signal to PLC.
Hussain Ashoor 20090222
16 | P a g e
Figure 16: Mbed voltage divider with pins header
A header of 10 pins was used to take signals from PLC controller which gives 24V to
the Mbed pins which need 3.3V. For that, resistors were added to reduce the voltage
to 3.3V which is voltage divider circuit. A calculation was used to find the resistors
value.
𝑉𝑜𝑢𝑡 = 𝑅𝑏
𝑅𝑎 + 𝑅𝑏 × 𝑉𝑖𝑛
5𝑉 = 4.7𝐾
𝑅𝑎 + 4.7𝐾 × 3.3𝑉
𝑅𝑎 = 30𝐾
The 4.7Kohm and 30Kohm were used because they are available in the university
store.
Hussain Ashoor 20090222
17 | P a g e
Figure 17: Mbed chip with LCD display
Mbed is a microcontroller which based with 40 pins and it was designed to
give a highly productive solution for product development which connects with
internet. The Mbed was used in the project to show a process that happens
on the LCD display. The LCD display it is a liquid crystal display and it is used
in wide range of application such as computer mentoring, television and as
used in this project monitoring the process. As showing above in figure (16)
the LCD was connected with Mbed from pin 15 to 20 which will display the
process.
The PCB design is below in figure (17) which contains all the above circuits in
one PCB which will be high level of PCB design.
The client has request to put the inputs headers on the top of the PCB and the
output which are the seven segment holders on the bottom. Moreover, the
Mbed chip was put on the left as shown in figure (17).
Hussain Ashoor 20090222
18 | P a g e
Figure 18: PCB circuit
Hussain Ashoor 20090222
19 | P a g e
Comment Designator Footprint LibRef Quantity
LM2576 *LM1 LM2576 LM2576 1
Op Amp AR1 Opm Amp Op Amp 1
Cap C1, C2 CAP RAD 8D 9H 3.5P
Cap 2
Diode Schottky
D1 DO-35 DIODE AXIAL
Diode Schottky 1
Inductor L2 inductor Inductor 1
MBED M1 MBED CON 40 MBED 1
LCD - TEXT M2 LCD display LCD - TEXT 1
Header 5X2H P1, P2, P3, P5, P6, P7 header10s Header 5X2H 6
Header 10 P4, P8 7seg to plc header10
Header 10 2
Header 10_1 P9 header10s Header 10_1 1
3 Pin P10 Gas detector pins Header 3 1
NPN Q1, Q2 trans NPN 2
Res2 R1, R2, R6, R7, R8, R9, R10, R11 , R12, R13, R14, R15, R16, R17, R18, R19, R20, R21, R22, R23, R24, R25, R26, R27, R28, R32, R33, R34, R35, R36, R37, R38, R39, R40, R41, R42, R43, R44, R45, R46, R47, R48, R49, R50, R51, R52, R55, R56, R57, R58, R59, R60, R61, R62, R63, R64, R66, R67, R68, R69, R71, R72, R73, R74, R75, R76, R80
RES AXIAL 6X2.3 P10.16
Res2 67
Res Pack4 R3, R4, R5, R29, R30, R31
DIP-16 Res Pack4 6
Res2 R53, R54, R65, R70, R78
AXIAL-0.4 Res2 5
Res2 R77, R79 RES AXIAL 3.5X1.7 P5.08
Res2 2
CD4511BCN U1, U2, U3, U4, U5, U6
CD4511 CD4511BCN 6
Table 2: bill of material
Hussain Ashoor 20090222
20 | P a g e
Relay Circuit
A relay is an electrically operated switch. The relay circuit was designed on a
saperate PCB for a higly purposes. Furthermore, the method of using relays
wes to switch on the pumps with a certain voltage. The relay opens depends
on a voltage that was given by the power supply which is in parellel with the
PLC controller and also on the other channel fixed on a voltage to give the
relay the pulse to switch on the pumps.
Figure 19: PCB relay circuit
As showing below the schematic circuit was designed a boxes but the foot
print was designed one according the relay physical dimension. Furthermore,
the pumps were used a connector of two pins and the pin hole was expended.
Table 3: Relay Circuit table of materials
Comment Description Designator Footprint Lib Ref Quantity
Header 3X2 Header, 3-
Pin, Dual row P1 header6relay Header 3X2 1
Power Supply
PowerSupply1 CON Euro 5mm
2 Pin LP Power Supply
1
Pump
Pump1,Pump2, Pump3, Pump4
CON 2PIN FCI 200220110-H02
Pump 4
Relay
Relay1, Relay2, Relay3, Relay4
Relay Relay 4
Hussain Ashoor 20090222
21 | P a g e
Figure 20: Relay schematic circuit
Hussain Ashoor 20090222
22 | P a g e
Solid Works
Solid Works program was used to draw and design a piece of equipment that
was considered to build in the project as a conical pipe to deliver the smoke
from a fan to another fan. In fact, the designed piece was carried out
Bernoulli’s principles where it has two different cross sectional areas. This will
make a different in pressure and velocities of the smoke as it will be
discussed in the research part. Furthermore, other design also was
considered to be design which was a boiler tank which was asked for a
dimension of the tank and it was drawn in Solid Works also. Moreover, the
ultrasonic sensor should have a stand which was also designed in Solid
Works and the stand should have a height more than 28 cm so the ultrasonic
sensor can sense the water. The below figures are the designed concepts
and also after it was built.
Figure 21: Solid work design of the tank
Hussain Ashoor 20090222
23 | P a g e
Figure 22: The tank after building
Figure 23: 3D concept which was made in Solid works
Hussain Ashoor 20090222
24 | P a g e
Figure 24: 3D printer machine making the concept
Figure 25: Stand of ultrasonic sensor dimensions
Hussain Ashoor 20090222
25 | P a g e
Fabrication
Acrylic & Wood Board
Acrylic sheets are fairly strong, light weight, easily molded plastics, mainly
used for clear or tinted glazing and colored sanitary fittings. Acrylic sheets
melt and burn easily, so that is a fire hazard as well as having low fire
resistance, although it can be broken to allow escape and unlike glass does
not splinter into sharp pieces. Wood board is a place that the project fitted on
to be demonstrated and also it has legs to make it stronger so it can carry the
tanks on itself.
Design
Any project need to be built physically need a base to be put on. The problem
was between choosing acrylic plastic for the board or wood and as know
wood boards have a strong shape which can handle more than 30Kg, but on
the hand the plastic box and the acrylic board can't handle that much of
weight. But the panel side was used with acrylic plastic.0020
Building
As showing in figure (24) the board was built with a measurement that the
boxes will be fit on it. As showing the tanks were built with acrylic plastic 4mm.
Also in figure (25) the panel was built with the same acrylic size 4mm and was
drilled to fix the component in it.
Hussain Ashoor 20090222
26 | P a g e
Figure 26: Wood board and tanks fix on it
Figure 27: Control panel
Hussain Ashoor 20090222
27 | P a g e
Steel
Steel sheets are an alloy of iron which can be used for hard purposes. It can
be fit for boiling process which is can handle the heat. It a conductor metal
which should has an insulator from wood.
Design
It was designed in Solid works program as shown in figure (22) which should
be drawn over there with a physically size which will be printed on a paper
with the dimensions that was drawn with.
Building
The design was handled to mechanical department and it was built in their
labs. As shown in figure (21) the steel tank was done and the insulator was
covered around it so it will be safe when the demonstration is in progress.
LED’s, Buzzer, LCD and seven-segment
LED is a semiconductor diode that converts applied voltage to light and it was
used in lamps and digital displays. Seven-segment indicator is form of
electronic display device for displaying decimal numerals that is an alternative
to more complex dot matrix displays. Seven-segment displays are widely
used in digital clocks, electronic meters and other electronic devices for
displaying numerical information. LCD display it is a liquid crystal display and
it is used in wide range of application such as computer mentoring, television
and as used in this project monitoring the process.
Design
The LEDs were the main components in the panel because it is indication all
the process from the beginning till the end. For that the LEDs that were used
in the panel was 24V which they do not need a resistor as a 2V LEDs.
Furthermore, the panel was designed for them as the dimension of each
component.
Building
The connections were made and each LED negative pin will connect to a
ground which all LEDs will be common grounded and the positive pin will be
connecting to PLC terminal block.
Hussain Ashoor 20090222
28 | P a g e
Software
PLC Program
The process will start by pressing the (Start_button) switch and it will be shut
down for maintenance by pressing the (stop_button) switch three times. The
stop_button was changed to three times in case if the operator pressed the
stop_button by mistake it won’t stop the process and lose the time and should
maintain the process all from the beginning. In the main program after the
Start_button is pressed it will delay the process for 2 minutes in that time the
beginning alarm will turn on for 10 seconds to inform the technician the
process will start after 10 seconds. After that, it will start turning on pump1,
pump2 and the fans. After the level switch reached 100% of the separation
system tank a delay was added also the prepare pump3 and pump4 for
turning on. In other case, when the 100% level switch is closed which become
on it will wait in any case so it won’t let pump3 starts before 4 and the
opposite they will both turn on in the same time after the timer 4 and 5 are
done. In that case the fans will be on all through the process till the
stop_button is pressed three times to shutdown the system. Furthermore, the
pumps in separation system tank will operate to deliver the separated material
which divides into three, (Unwanted) water, Oil (Bapco) and gas which should
be delivered to Banagas. Next, pump 3 and pump 4 will operate to the
mentioned tanks and each tank has a sensor to work on. For example, Bapco
tank has the ultrasonic sensor which will sense the oil level and if it reached
90% it will directly switch off the pump and it will be ready to deliver to Bapco
Company. As the Boiler tank will be receive the water from the separation
tank till the level switch of the separation tank reaches 50% and it will stop
because of the Boiler tank size does not accept more than that to boil. But in
the Boiler tank a temperature sensor is fixed which will sense the water
temperature and will be indicated on the control panel (seven-segment) and
also if the temperature exceeded 120o C will turn on the siren and the alarm
light. A multiplexing out code was added into the program to show the values
on the seven-segment display. The multiplexing code was done for the
temperature and the oil level in the Bapco tank. Besides that, Banagas store
tank will receive the gas from the separation system tank and when the whole
Hussain Ashoor 20090222
29 | P a g e
process is done it will only stop_button to be press so it will shut down the first
cycle of the process till it is ready for the next one. See Appendix A for rungs
explanation.
PLC modules input and output list
Output 1 Local 4 Output 2 Local 6 Run Local:4:O.Data.0 BCD A (Level-
Temp) Local:6:O.Data.0
Stopped Local:4:O.Data.1 BCD B (Level-Temp)
Local:6:O.Data.1
Alarm_Light Local:4:O.Data.2 BCD C (Level-Temp)
Local:6:O.Data.2
Pump_1 Local:4:O.Data.3 BCD D (Level-Temp)
Local:6:O.Data.3
Pump_1_Green Local:4:O.Data.4 Stobre_1 Local:6:O.Data.4
Pump_1_Red Local:4:O.Data.5 Stobre_2 Local:6:O.Data.5
Pump_2 Local:4:O.Data.6 Stobre_3 Local:6:O.Data.6
Pump_2_Green Local:4:O.Data.7 Stobre_4 Local:6:O.Data.7
Pump_2_Red Local:4:O.Data.8 Stobre_5 Local:6:O.Data.8
Pump_3 Local:4:O.Data.9 Stobre_6 Local:6:O.Data.9
Pump_3_Green Local:4:O.Data.10 BL_Level Local:6:O.Data.10
Pump_3_Red Local:4:O.Data.11 BL_Temp Local:6:O.Data.11
Pump_4 Local:4:O.Data.12 Local:6:O.Data.12
Pump_4_Green Local:4:O.Data.13 Local:6:O.Data.13
Pump_4_Red Local:4:O.Data.14 Siren Local:6:O.Data.14
Fans Local:4:O.Data.15 Local:6:O.Data.15 Table 4: PLC module output list
Table 5: PLC module input list and analog input list
Input Local 5 Analog Input Start_button Local:5:I.Data.0 Level Local:2:I.Ch0Data
Stop_button Local:5:I.Data.1 Water_temp Local:2:I.Ch2Data
Reset_Alarm Local:5:I.Data.2
Maintanance_P1 Local:5:I.Data.3
Maintanance_P2 Local:5:I.Data.4
Maintanance_P3 Local:5:I.Data.5
Maintanance_P4 Local:5:I.Data.6
Maintanance_Reset Local:5:I.Data.7
Gas_Sensor Local:5:I.Data.8
Oil_25per Local:5:I.Data.9
Oil_50per Local:5:I.Data.10
Oil_100per Local:5:I.Data.11
Water_25per Local:5:I.Data.12
Water_50per Local:5:I.Data.13
Water_100per Local:5:I.Data.14
Local:5:I.Data.15
Hussain Ashoor 20090222
30 | P a g e
Mbed program
Mbed program code is companion program which will show in the LCD
display screen the pumps if they are ON or not. Furthermore, the Mbed
controller was connected on the PCB and then to the PLC with 24V which a
voltage divider was placed to give the Mbed 3.3V so it can get the signal from
the PLC if the pump are on or not. The technique that was used in Mbed code
was pin detect because the process starts with a push button and the only
code could understand that is the pin detect. The library of the pin detect was
added in the Mbed code so it could be recognized. The main condition was
that if a function is happening in that time will directly show it on the LCD
display screen and when it released the written sentence will disappear.
Figure 28: Mbed pins
Hussain Ashoor 20090222
31 | P a g e
SCADA
The Factory Talk View program was used as a monitoring program, which will
show all the processes from the PLC in the plant step by step. The Main page
as showing below has 6 light indications for the water and oil leveling to show
if the tank is full or not. Also, there are 8 indicator lights to show if the pumps
are operating or not. Moreover, the page is showing the status of the process
is running or stopped and the alarm indication (Siren and light) will turn on to
show that there is something in the process happens. The input switches
were changed to internal coil because the SCADA does not recognize the
physical input.
Figure 29: SCADA main page
Hussain Ashoor 20090222
32 | P a g e
Discussion
Each part in the project there were more than one results to choose between.
The chosen results were chosen to be the most suitable values and have
more than one reason to be the chosen. For the voltage divider for the seven-
segment circuit there was more than one value to be chosen from the give the
same output voltage. In this case the values were chosen are 18Kohm and
4.7Kohm,
𝑉𝑜𝑢𝑡 =𝑅𝑏
𝑅𝑎 + 𝑅𝑏× 𝑉𝑖𝑛 .
Using the voltage divider formula the output voltage will be
(𝑉𝑜𝑢𝑡 = 4700
4700 +18000× 24 = 5.0𝑉).
As known the large resistor has a lower wasted current for example in this
case it will be around 1m amps and if a small resistor was used will have a big
waster current which will affect the battery life. From this another point that
needs to be considered is the power rating of the resistors. This goes in favor
of resistors with larger resistance because resistors with lower resistance will
dissipate more power and heat up more as what happened for the transistor
resistor which is connected to the collector pin the one was used in the
beginning was 510 ohm which gets 24V and it burned because of the huge
current gets through it but after changing to 3.3k ohm with 5 watt it does not
gets damage because of the high resistance in the resistor. That means that
they will need to be larger (and usually more expensive and not available
everywhere) than resistors with larger resistance.
Hussain Ashoor 20090222
33 | P a g e
Observations and recommendations
The objectives of this project were achieved by searching to know about the
needed sensors and all the equipments that will be use in this project. All the
components connected by the schematic circuit in the Altium design program.
The circuits were designed to be printed as a PCB. The components were
soldered on the PCB and tested. Fully commented PLC program was written
to control the process and also fully commented Mbed code. Some of the
problems were overcome after analyzing and discovering what was going
wrong. The aims were achieved and also there are several ways to improve
this project:
Using better power supply that can handle more than 5 amps.
Using better PLC modules that can produce more that 205m amps, so
the components will be connected directly to it.
Adding extra reliable sensors all through the process.
If a budget was mentioned for the project it can build the project again
and improve it with better equipment and high sensitive one.
Hussain Ashoor 20090222
34 | P a g e
Appendix A
PLC program rungs
Figure 30: Rung 0 to 2
Figure 31: Rung 3 to 5
Hussain Ashoor 20090222
35 | P a g e
Figure 32: Rung 6 to 9
Figure 33: Rung 10 to 13
Hussain Ashoor 20090222
36 | P a g e
Figure 34: Rung 14 to 17
Figure 35: Rung 18 to 19
Figure 36: Rung 20 to 22
Hussain Ashoor 20090222
37 | P a g e
Figure 37: Rung 23 to 24
Figure 38: Rung 25 to 27
Figure 39: Rung 28 to 30
Hussain Ashoor 20090222
38 | P a g e
Figure 40: Rung 31 to 32
Figure 41: Rung 33 to 34
Figure 42: Rung 35 to 37
Hussain Ashoor 20090222
39 | P a g e
Figure 43: Rung 38 to end
Figure 44: Beginning alarm add on
Figure 45: Beginning alarm add on 2
Hussain Ashoor 20090222
40 | P a g e
Figure 46: Leakage alarm add on
Figure 47: High temperature add on
Hussain Ashoor 20090222
41 | P a g e
Mbed program code
Figure 48: Code 1 to 18
Defining all the pumps pin so it can call them back later when the program run.
Figure 49: Code 20 to 45
Hussain Ashoor 20090222
42 | P a g e
Figure 50: Code 47 to 72
Figure 51: Code 74 to 93
Hussain Ashoor 20090222
43 | P a g e
Figure 52: Code 96 to 110
This callback will often be of little use as it’s called after every assertion or
desertion. You can define how many continuous samples must be asserted
before the attach_asserted () function is called.
Hussain Ashoor 20090222
44 | P a g e
Appendix B
Datasheets
Figure 53: LM2576 datasheet
Hussain Ashoor 20090222
45 | P a g e
Figure 54: LM2576 drawing circuit in the datasheet
The above circuit was choosing from the LM 2576 datasheet because of the
output current capability which is 3 amps. This circuit is an adjustable circuit
which can be changed by changing the resistors value (voltage divider).
Hussain Ashoor 20090222
46 | P a g e
Figure 55: Ultrasonic sensor wiring colors
Figure 56: Ultrasonic teaching way
From the above figure the teaching method of the ultrasonic sensor is by
pressing and holding the button until the light blinks 3 time and then release it.
The tank should empty and then hold the same button to blinks 4 times then
release it. After that, fill the tank with water full and hold the button to blinks 5
times then release it by then it will be taught with empty and full tank. Finally
to get out from the teaching mode the button should be pressed and hold to
blinks 3 times also then release by then it will be ready to use.
Hussain Ashoor 20090222
47 | P a g e
Appendix C
Figure 57: Panel in process
Figure 58: Panel in process 2
Hussain Ashoor 20090222
48 | P a g e
Figure 59: Board and fixing the tanks on it with the level sensors
Figure 60: Process in progress and the pump1 & 2 are on
Hussain Ashoor 20090222
49 | P a g e
Figure 61: Process in progress and showing that pump 2 is stopped
Figure 62: Process in progress and filling Bapco tank with oil
Hussain Ashoor 20090222
50 | P a g e
Figure 63: PCB circuit
Figure 64: Relay PCB circuit