Arduino OPTA PLC – Function Block Diagram (FBD)

The Arduino Opta IoT PLC offers a convenient way to program it using the Arduino PLC IDE in function block diagram (FBD) format. This is a simple and intuitive method, and it is one of the industrial PLC languages. In addition to FBD, you can program the Opta PLC using any of the five official languages specified in the IEC standard and sketches written in C++.
The Function Block Diagram (FBD) is a graphical language used to design programmable logic controllers. It allows you to describe the function between input and output variables using a set of elementary blocks. These blocks can be connected to input and output variables using connection lines.
When wiring the inputs and outputs of the blocks, you can use single lines to connect two logical points of the diagram. This includes connecting an input variable to an input of a block, connecting an output of a block to an input of another block, or connecting an output of a block to an output variable. The connection lines are oriented, carrying associated data from the left to the right. It’s important to note that the left and right ends of the connection line must be the same type.
Arduino OPTA PLC - Function Block Diagram (FBD)
In addition, you can use multiple right connections, also known as divergence, to broadcast information from the left end of the connection line to each of its right ends. However, it’s essential to ensure that all ends of the connection are of the same type.
Now that we understand the basics of the Function Block Diagram (FBD) let’s dive into starting a new project and mapping the physical I/O in the Opta PLC.

The entire Arduino Opta IoT PLC Series is located here.
Previously in this series, we have discussed the following:
Opta Introduction Video
Arduino Opta IoT PLC Cutting Edge HardwareVideo
Arduino Opta Software InstallationVideo
Arduino Opta IoT PLC Quick Start Ladder LogicVideo
Easy Steps to Establish Communication between Arduino Opta IoT PLCVideo
Arduino PLC IDE Workspace: Unleash the Power!Video
Programming with the Arduino OPTA PLC – Ethernet PortVideo
Arduino OPTA PLC – Ladder Diagram First ProgramVideo
Arduino OPTA PLC – Instruction List (IL) First ProgramVideo
Note: A post is usually associated with each video. This will provide additional details and links discussed.

Start a new project.

Our project will create a stop-stop circuit with two lighted pushbutton switches using function block diagram (FBD) programming. When the green LED pushbutton is selected, the green LED light will turn on. This will remain on until the red-led push button is selected. When the green LED is on, the red LED is off, and vice versa. The CPU green LED will be on if the Arduino OPTA PLC is executing its program. Open your computer’s Arduino PLC Integrated Development Environment (IDE) software.
Opta New FBD Program
Start a new project by selecting “New Project” on the main software screen.
Opta New FBD Program
A second method of starting a new project is to select “New Project” from the main menu | File.
Opta New FBD Program
The third method is to choose the icon for a new project.
Opta New FBD Program
The new project window will now be displayed. Enter the name of the project in the dialog box. This will be the name of the Program stored on your drive. We will leave the default directory as it is. Ensure that the Opta 1.0 PLC is selected for the target. Select OK.
Opta New FBD Program
This will now create and save your program file for the Opta PLC.

Mapping physical I/O in the Opta PLC

The Opta has physical inputs and outputs we must map before using them in our project. In the workspace window, select the Resources tab at the bottom. Under local IO mapping, you will see all of the physical inputs and outputs on this controller.
Arduino Opta Mapping Inputs and Outputs
Select programmable inputs. The programmable inputs mapping will be displayed. We can assign a variable to each input we intend to use in our function block diagram. Under IO type, we can select digital (default) or analog. The analog resolution can also be selected for the inputs.
Arduino Opta Mapping Inputs and Outputs
Select relay outputs that display the relay outputs mapping.
Arduino Opta Mapping Inputs and Outputs
We can once again assign a variable to the relays that we will use in our function block diagram program.
Select LED Outputs, which display the LED outputs mapping.
Arduino Opta Mapping Inputs and Outputs
These are the status lights on the Opta CPU unit. We will make these represent the relays in our Program. Assign a variable name to the LED output that we will use. The Opta PLC also has a front LED that can be different colors. We will assign the green output to indicate that the Opta PLC code is scanning.
Arduino Opta Mapping Inputs and Outputs
Now that all of our mapping is complete, we can save the Program using the icon on the main page. We can also save the Program using the main menu | File | Save Program.

Wiring of the inputs and outputs

We can now physically wire the two lighted pushbutton switches to the inputs and the LEDs of these switches to the outputs.
Arduino Opta Wiring
Here is the wiring diagram of the Arduino OPTA PLC.
Arduino Opta Wiring
The positive 24-volt DC signal is wired to one side of the green normally open switch contact. It is also wired to one side of the red normally closed switch contact. The other side of the switches are wired to input 1 and 2, respectively. The positive 24-volt DC signal is wired to one side of the switch lamps. Relay outputs are provided on the Arduino OPTA PLC. The other side of the switch LED lamps are wired to one side of the relay for each switch. Green will be output one, and red will be output two. The other side of the relay output contacts of the PLC will be wired to the 0-volt DC signal. This completes the wiring of the PLC.

Tasks in the Opta PLC

To access the tasks in your project, navigate to the project tab and locate the tasks folder. You will see the list of IOs we have just mapped for this project.
Arduino Opta PLC Tasks
Expand the folder by clicking on the plus sign next to it. The tasks are categorized into Fast, Slow, Background, and Init. To configure the tasks, right-click on any four task folders and select task configuration.
Arduino Opta PLC Tasks
Your programs will be executed within the designated task folders. The Fast Task folder will execute your programs cyclically every ten milliseconds. (100 times per second) This can be changed by changing the set period to yes. You can then enter a value in the period column in milliseconds. The majority of programs will be placed in this folder. The Slow and Background task folders will also scan cyclically. They are both set at a fixed period of 100 and 500 milliseconds. (10 times per second and two times per second) These tasks are ideal for functions like math equations, etc. The Init or Initialize task folder sets variables or conditions in the PLC after it powers up. It will run for a single scan. Select OK to close the task configuration window.

Starting a New Function Block Diagram Program

Select | Project | New Object | New Program from the main menu to start a new program.
Arduino OPTA PLC - Function Block Diagram (FBD)
You can also do this by right-clicking on the project name and selecting the new Program under the add heading. The new program window will be displayed.
Arduino OPTA PLC - Function Block Diagram (FBD)
We will use a function block diagram (FBD) in our example.
Select FBD. Name the new Function Block Diagram program and assign it to the fast task folder. The program name cannot have spaces.
Select OK.
FBD PLC Programming
Our new function block diagram program will now be displayed in the work area. This Program also appears under the fast task folder and the project as a function block diagram symbol.
FBD PLC Programming
An FBD toolbar can be displayed by selecting it from the main menu | View | Toolbars | FBD Bar.
FBD PLC Programming
In the help menu, you will find all of the operators and their parameters that can be used for this function block diagram programming. Save the Opta PLC program.

Programming our Function Block Diagram (FBD)

The first block of code will turn on the CPU LED light. To do this, we will add two constants and ensure they are equal to turn on the LED.
FBD PLC Programming
Select the K icon on the FBD toolbar or in the first block workspace, right-click, and select New Object | Constant. You can also use Shift +  K to enter a constant.
FBD PLC Programming
We will add two constants. The value of the constant defaults to 0. Double-click on the constant to change the value.
FBD PLC Programming
We will change both values to 1.
FBD PLC Programming
Select New Block (Shift + B) on the FBD toolbar. You can also do this by right-clicking and selecting New Object…

Under the Objects Filter, select just the Operators. Select the equal (EQ) operator and select OK.
FBD PLC Programming
Clicking on the workspace will place the operator on the first block. You can move this around by clicking and holding the left mouse button on the EQ operator.
FBD PLC Programming
Select the Variable (Shift + V) from the FBD toolbar or right-click and select New Object | Variable.
FBD PLC Programming
The object properties window will now be displayed. Select the three dots next to the input selection.
FBD PLC Programming
Select the LED_Green variable from the Object Browser and select OK.
FBD PLC Programming
The object properties window will now show the variable. Select OK.
FBD PLC Programming
Our variable can now be seen on block 1, but it is facing the wrong way. Right-click on the variable and select Switch Direction.
FBD PLC Programming
Select the connection icon on the FBD toolbar or right-click on the workspace and select the connection mode. You will also notice that when the workspace is selected and you hit the space bar, the mode will alternate between Insert/Move and Connection modes.
FBD PLC Programming
Select the starting point. The objects on the workspace will show a green box. Left-click on the box. Select the endpoint. A dotted line will be displayed, and a green box will appear on the different objects. The cross mouse will turn into a cross-hair that indicates that a connection can be made. Left-click to complete the connection.
FBD PLC Programming
Right-click on the network number and select New network | After.
FBD PLC Programming
We can now enter our circuit’s function block diagram (FBD) based on the information previously.  If we have input 1 (Green PB) or output 1 (LED Green) and input 2 (Red PB NC), then output one and LED out one will turn on. If output 1 is 0, output two and LED out two will turn on. Save the Program by using the icon on the main menu or selecting “Save project” from the main menu | File.

Download the Function Block Diagram program to the Opta PLC.

Select setup communication from the main menu | On-Line. In the device link manager window, select Modbus TCP and then select activate.
Arduino Communication Modbus TCP
Select properties.
Arduino Communication Modbus TCP
We can now enter the IP address we established in the following post. Programming the Arduino OPTA PLC – Ethernet Port Our communication method with the OPTA PLC is now set.
Arduino OPTA PLC - Function Block Diagram (FBD)
Select the connect button.

We will now see that our computer is connected to the Opta PLC controller.
Arduino OPTA PLC - Function Block Diagram (FBD)
Select the download icon on the main menu. Since we didn’t compile the project first, the PLC IDE prompts us before downloading. Select Yes.
Arduino OPTA PLC - Function Block Diagram (FBD)
The output window will display the status of the download operation.
Arduino OPTA PLC - Function Block Diagram (FBD)
When this has finished, the bottom right side of the software will show you that the PLC IDE and controller programs are the same.

Monitoring the Function Block Diagram Logic and Variables

Select the live debug mode on the main screen. This will show you the status of the inputs and outputs on the FBD (Function Block Diagram).
Arduino OPTA PLC - Function Block Diagram (FBD)
Select the watch icon on the main menu. This will display the watch window. We can enter and select the variables (tags) we want to monitor.
Arduino OPTA PLC - Function Block Diagram (FBD)
Watch the video below to see how to create function block diagrams with the Arduino Opta IoT PLC.

Arduino Opta PLC – IoT and Industry 4.0 Enabler
Arduino Opto IoT PLC Series
Opta – Frequently Asked Questions (FAQ)

Finder OPTA 8A Series – Tutorials
Datasheet
Quickstart Sheet

Arduino Opta Hardware
Arduino PLC IDE
Arduino Software Download Page
(Arduino IDE, PLC IDE, PLC IDE Tools)

Watch on YouTube: Arduino OPTA PLC – Function Block Diagram (FBD) First Program

If you have any questions or need further information, please contact me.
Thank you,
Garry


If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLCs are not challenging to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, decimals, Hexadecimal, ASCII, and Floating points.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available for free download. The link is included when you subscribe to ACC Automation.

Leave a Comment