PLC Programming Tutorial for Beginners_ Part 1
Articles,  Blog

PLC Programming Tutorial for Beginners_ Part 1


Hello again, in this lesson we will learn
how to write a PLC program for the machine illustrated here by using an “S7 300” PLC
and “STEP 7” software. As you can see we have two pumps which are
being used to transfer two separate liquids into this tank.
Inside the tank there are two level switches installed in the lower and upper parts of
the tank respectively, the switches are digital which means that they can only ever be in
one of two states: “true” or “false.” There is also an electrically powered mixer
inside the tank which starts working for a defined period of time, mixing the two liquids
together after the tank has filled. We also have a discharge valve in the bottom
of the tank which controls the draining of the liquid from the tank. Ok now Let’s see what the program should do.
This lower level switch has an open contact inside it. When the level of the liquid drops
to the level of the switch’s position the contact closes, sending a 24 volt DC signal
to the PLC input. We want to write the program so that when
the level of the liquid reaches this minimum, the pumps will be activated and begin filling
the tank with the liquids. The pumps continue filling the tank until
the level reaches its maximum at the higher level switch. When this happens the open contacts
in the switch will be closed and another 24 volt signal will be sent to the PLC input
telling us that the tank is full. When this signal has been sent, first the
pumps should shut down so that no more liquid enters the tank, and then this mixer should
be turned on. We want the mixer to operate for seven seconds,
mixing the liquids that have been pumped into the tank.
After seven seconds the mixer should automatically shut down and this discharge valve should
open. With the valve open the liquid will be discharged
from the tank and transferred to another location within the factory to be processed.
When the level of the liquid in the tank drops to the minimum set level of the lower switch,
the switch contacts will close again thus starting a repeat of the cycle.
Ok so now we need to click on the “SIMATIC Manager” desktop icon in order to start
writing the program. “SIMATIC Manager” is a program which manages subprograms of
“STEP 7.” To start our programming first we need to
create a new project by clicking on the “new” icon on the toolbar to open the “new project”
window. In this window we enter a name for our project
in the “name” field. We’ll call this project “Mixer” and enter it here.
The path to our saved project is shown in the “storage location.” However we can use
the browse button to navigate to a different location other than the default.
OK after creating the project we click on its name to highlight it, then from the “insert”
menu we select one of these “stations” dependent upon the control system that we intend to
use. As discussed previously we will be using an
“S7-300” PLC to control our machine, so we need to select the second option shown
here which is “station 300.” After selecting this option we see that a subgroup named “SIMATIC
300” has been added to our project. Next we click on this “hardware” icon which
takes us to the hardware so that we can configure the modules we need for the PLC.
Our PLC is an “S7 300″ so we need to select the relevant modules from “SIMATIC 300”
subgroup here. First of all we need a rack into which we
will mount the modules. To insert the rack, open the “rack 300” and
double click on the “rail” to add it to the left window.
As you can see this rack has 11 slots We need to install a “power supply” in
the first slot to power our PLC modules and turn them on.
To do this we open this “PS 300” folder and double click on this two-ampere power
supply to insert it into the first slot of the rack.
Note that all the listed PLC modules have an order number or part number which is displayed
in this lower box when each module is clicked on. In “real-world” projects the order number
of each module that we select should match exactly the module in the enclosure but as
this is a demonstration project for training purposes we can ignore that requirement for
now. Ok in the second slot of the rack we always
insert the “CPU” module. To select the desired module we open this
“CPU 300” folder, which opens to show us all types of “300 CPUs.”
We want to select a “316 CPU”, so we need to open this “CPU 316” folder and click on
the relevant part number to insert it into the second slot in the rack.
Now, in addition to these two modules we need an input and an output module, both digital.
The input and output modules are both categories in the subgroup “SM 300”
To insert a digital module we need to open this “DI 300” folder and double click on this
24 volt module which has 16 inputs However, as you can see, after doing this
we get a message that this module can only be inserted into slots 4 – 11. So we need
to leave the third slot empty, select the fourth slot and then double click on the module
again to insert it into the rack Now we can also insert the digital output
module by opening the “DO 300” here. Double click on this module to insert a 24 volt,
16 output module. OK the addresses of the digital input module
range from byte zero to byte number one, which means that the addresses we can use in this
module for our program start at “I 0.0” for the first input and continue through to
“I 1.7” for the last input. This gives us 16 digital inputs.
Similarly as you can see the addresses of our digital output module range from byte
number 4 through to byte number 5, so there are 16 addresses that we can use for this
module starting at “Q 4.0” continuing through to “Q 5.7.”
OK so now the configuration is complete and we can download it to the PLC. We will use
a simulator to test the program, so we need to click on this “simulator on/off” icon
in the “SIMATIC” environment in order to run the simulator program.
Now we go to the insert menu and select “input variable” so that we can insert an input variable
Similarly we can select “output variable” but as the address of our output module starts
from byte number 4 we need to change this “0” to a “4.”
Before downloading the configuration first click on the “save and compile” icon to save
it, then we click on this download icon. This brings up a window where we need to select
the CPU to which we want to download the configuration and then click “OK”.
In the next window click on “view” and then select the appropriate “MPI” address, and
after clicking “OK” the configuration will download to the CPU.
Now, having completed the configuration we can check the project tree and see that a
subgroup with the same name as the CPU has been added there.
Now we can write our program in a block named “OB 1”
We can find the “OB 1” by opening the “S7 Program” folder and looking in the “block”
folder. Ok now we open the “OB 1” by double clicking
on it; as it’s the first time we have opened it this “properties” window opens.
We simply OK the window to get into the programming environment.
So far we have learned how to make some basic settings and organize the environment so that
we can start programming. In the next lesson we’ll learn how to write a program using simple
and practical instructions that will control our machine.
So did you like this video? We hope you did! And if you did, subscribe and share it with
your friends.

100 Comments

Leave a Reply

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