KB Controls is reader-supported. When you buy through links on our site, we may earn an affiliate commission. Read more in our disclaimer
A Step-by-Step Tutorial for solving Factory I/O's "From A to B (Set and Reset)" Scene with Control I/O
This tutorial is part of the series, "Factory I/O with Control I/O". In this series, you can learn PLC programming by programming solutions for a range of common industrial automation applications. By the end of the series, you will have created a portfolio of projects that demonstrate your expertise in PLC programming. You can find all of the content from that series here.
In this tutorial, I will show you how to program a solution for the Factory IO scene "From A to B (Set and Reset)" using Control I/O, the built-in soft PLC for Factory I/O.
Since we have already covered some basic features of Factory I/O, Control I/O, and PLC programming in previous tutorials, I will move slightly faster through this tutorial and only take additional time to explain new concepts that we haven't seen before.
At the end of the tutorial, I will introduce some challenges for you to solve to apply the lessons that we have covered in the course and to test your PLC programming skills.
To follow along with this tutorial, you will need to have Factory IO installed on your machine. If you don't already have Factory IO installed on your machine, you can use my affiliate link to start your 30-day trial of Factory IO.
Before we start programming a solution for this scene, let's look at the requirements for this application.
In this application, we will program the controls for two conveyors.
Totes are loaded onto the first conveyor called the Entry Conveyor and are transported onto the next conveyor, called the Conveyor. To start, only one tote will be loaded onto the Entry Conveyor at a time.
When the scene is started, the Entry Conveyor should run continuously to transport totes to the Conveyor.
The Conveyor should start running when the tote triggers the sensor mounted at the beginning of the conveyor, called Sensor A and stop running when the tote triggers the sensor mounted at the end of the conveyor, called Sensor B.
As you can see, this is a slightly more complex application than what we have seen before because we are controlling two pieces of equipment that interact with each other.
Let's see how to create this logic in Control I/O.
Before we can program a solution for this application, we have to set the project up by opening the scene and configuring the Control I/O communication driver.
Launch Factory IO from the Start Menu of your machine and click on Scenes to open the list of pre-built scenes available for Factory IO.
Click on “2 — From A to B (Set and Reset)” to open today’s scene.
Configure the communication driver for the scene by clicking on File > Drivers.
In the Driver Selection dropdown, choose Control I/O.
After selecting the Control I/O driver, the Control I/O editor opens. This is a graphical code editor that can be used to write PLC programs for Factory I/O scenes in a language similar to Function Block Diagram (FBD).
Now that the project is set up, we can program a solution for the application.
Let’s start by programming the logic for the Entry Conveyor. The logic here is simple — the Entry Conveyor should always run.
To make the Entry Conveyor always run, we can connect the output for the Entry Conveyor's motor directly to a Boolean Source that always has the value True.
Go a head and program the logic for the Entry Conveyor as shown below.
We can set the value of the Boolean Source to True by clicking on the power icon in the Source. Now the Entry Conveyor will run continuously while the Factory I/O model is running.
Now that the logic for the Entry Conveyor is complete, let’s look at the logic for the Conveyor.
The Conveyor's motor should start running when Sensor A is triggered and stop running when Sensor B is triggered. Another way to say this is that we want the Conveyor tag to be set to True when Sensor A is triggered and reset to False when Sensor B is triggered. When the value of a tag is set to True by a function block, the tag retains the value True until another function block resets the value of the tag to False.
To control the setting and resetting of a tag in Control I/O, we can use an SR, short for Set-Reset, or RS, short for Reset-Set, function block. The difference between these two instructions is the priority.
In an SR instruction, the setting action has the priority, so if both inputs are activated then the associated tag will be set to True.
In an RS instruction, the resetting action has the priority, so if both inputs are activated then the associated tag will be set to False.
In our application, we will use the RS Function Block. In general, if you have moving parts like a motor, then reset should be the priority. That way, the movement stops in the case of an abnormal situation.
Go ahead and drag an RS function block from the Logical folder and drop it on the canvas.
Now we can connect Sensor A to the SET input of the RS function block and connect Sensor B to the RESET input of the RS function flock.
Since the photoelectric cells in Factory IO are normally closed (that is, the tag has the value True when the sensor is free and the value False when the sensor is occupied), then we have to put a NOT instruction in front of the SET and RESET pins.
Finally, we can connect the Conveyor tag to the OUT pin of the RS function block.
The completed logic looks like the image below.
Back in Factory I/O, press the play button to run the scene.
You should see the entry conveyor running continuously. When the tote hits Sensor A, the Conveyor should start running until the tote hits Sensor B.
Our logic seems to be working correctly.
Our PLC program works very well when we have one tote on the system. Realistically though, an operator will load many totes on the system at one time.
In Factory I/O, switch back to edit mode and delete the tote from the conveyor.
From the Parts Palette, add an “Emitter” part. An Emitter is a special part that acts as an entry point for products to the system. The Emitter continuously adds new parts to the system.
With the Emitter in place, run the Factory I/O model again.
You should see that parts begin to collide and pile up in the scene. This is because the Entry Conveyor is constantly pushing products on the Conveyor even when the Conveyor is not running.
Your first challenge is to improve this behaviour - the Entry Conveyor should stop running at the correct time so that parts do not collide on the Conveyor.
Inching is additional functionality that can be programmed for a conveyor to make the best use of the space on a conveyor to accumulate products. When inching mode is enabled on a conveyor, the conveyor only runs for long enough to let a product onto the conveyor. In this way, you can build a train of products on the conveyor.
Your challenge is to add a Selector part to the Factory I/O scene that will let an operator toggle between normal and inching mode for the Conveyor.
In normal mode, the behaviour of the Conveyor does not change.
In inching mode, the Conveyor should run when Sensor A is triggered and stop when Sensor A is free. When Sensor B is triggered, the Entry Conveyor should not send any more parts to the Conveyor.
In this tutorial, we learned how to use the SR and RS function blocks to set the value of a tag to True and reset the value of a tag to False. This function block is very useful and is commonly used when you want to write a value to a Boolean tag and have the tag retain that value even after the input conditions become False.
At the end of the tutorial, I introduced two challenges to test your PLC programming skills. If you haven't already, sign up to the mailing list below to be notified when the challenge solutions are available.
Finally, the project files for this tutorial are linked below.
Take your PLC programming skills and build a portfolio of projects by programming solutions for 10 common industrial automation applications using Factory I/O and Control I/O, Factory I/O's built-in soft PLC.