Arduino OPTA PLC – Ladder Diagram First Program

The Arduino Opta IoT PLC allows you to conveniently program it using the Arduino PLC IDE in ladder diagram format. This is the most common industrial PLC language, a simple and intuitive method. Additionally, you can program it in any of the five official languages specified in the IEC standard and using sketches written in C++.
Arduino OPTA PLC IDE - Ladder Diagram First Program
However, this article will solely concentrate on programming the Opta PLC using ladder logic, widely used in industrial automation and control applications. With ladder logic, you can easily design and implement logical operations by creating ladder diagrams that resemble the rungs of a ladder, making it a very effective and efficient programming technique. Let’s get started building the PLC ladder diagram.

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
Note: A post is usually associated with each video. This will provide additional details and links discussed.

Start a new project.

Open the Arduino PLC Integrated Development Environment (IDE) software on your computer system. Start a new project by selecting “New Project” on the main software screen.
PLC New Project
You can also select “New Project” from the main menu | File.
PLC New Project
The third method is to select the icon for new project.
Monitoring Variables
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. 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 that we will need to map before we can use them in our project.
PLC New Project
In the workspace window, select the Resources tab at the bottom.
Mapping inputs and outputs
Under local IO mapping you will see all of the physical inputs and outputs on this controller. Select programmable inputs. The programmable inputs mapping will be displayed.
Mapping inputs and outputs
We can assign a variable to each of the inputs we intend to use in our ladder diagram.
Under IO type, we can select digital (default) or analog. The analog resolution can also be selected for the inputs.
Mapping inputs and outputs
Select relay outputs that display the relay outputs mapping. We can once again assign a variable to the relays that we will use in our ladder logic program.
Mapping inputs and outputs
Select LED Outputs which display the LED outputs mapping. 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 three LED outputs 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 is working.
Mapping inputs and outputs
Select the button inputs to display the relay outputs mapping. We can assign a variable name to the user button input. 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 by using the main menu | File | Save Program.

Tasks in the Opta PLC

To access the tasks in your project, navigate to the project tab and locate the tasks folder.
Mapping inputs and outputs
Mapping inputs and outputs
You will see the list of IO that we have just mapped for this project.
PLC Tasks
Expand the folder by clicking on the plus sign next to it. The tasks are categorized into Fast, Slow, Background, and Init.
PLC Tasks
To configure the tasks, right-click on any of the four task folders and select task configuration.
PLC Tasks
Your programs will be executed within the designated task folders.
The Fast Task folder will execute your programs cyclically every 10 milliseconds. (100 times per second)
PLC Tasks
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 Ladder Logic Program

To start a new program, from the main menu select | Project | New Object | New Program.
New PLC Ladder Logic Diagram
You can also do this by right click on the project name, select new program under the add heading.
New PLC Ladder Logic Diagram
The new program window will be displayed. In our example, we will use a ladder diagram (LD).
Select LD. Name the new program Ladder and assign it to the fast task folder. Select OK.
New PLC Ladder Logic Diagram
Our new ladder program will now be displayed in the work area. It will contain a single rung with an input and output condition. This program also appears under the fast task folder and the project as a ladder diagram symbol.
The ladder diagram bar icons can be displayed or hidden using the main menu | View | Toolbars| LD Bar. As you will discover, multiple ways exist to move around and enter your program.
New PLC Ladder Logic Diagram
Right-clicking on the rung number will bring up a menu to add, delete, copy, or document the rung.
New PLC Ladder Logic Diagram
Selecting the contact and right-clicking will allow you to cut, copy, delete, change, or add additional contacts.
New PLC Ladder Logic Diagram
Selecting the output contact and right-clicking will allow you to cut, copy, delete, add, or view the properties of the output.
As you select the elements on the ladder rung, you will notice that the LD toolbar is also actively displaying the available options. As you highlight the toolbar icons, it will display a quick key sequence for the item.
Save the Opta PLC program.

Programming our Ladder Logic

Double-clicking on the input contacts in rung one will display the properties window.
New PLC Ladder Logic Diagram
Select delete.
New PLC Ladder Logic Diagram
Double-click on the output coil in the rung. Select the three dots to the right of the name. This will call up the object browser window.
New PLC Ladder Logic Diagram
Select the LED_Run for our output coil. This will be used to indicate that our program is running. Select OK.
Arduino OPTA PLC IDE - Ladder Diagram First Program
Right-click on the rung and add a new network after this rung. A new rung will be displayed as rung 2.
Double-click on the input contact. Select the three dots to the right of the name. This will call up the object browser window. Assign the input button tag.
Arduino OPTA PLC IDE - Ladder Diagram First Program
Right-click on this contact. Select new parallel contact. This will add a contact under this initial one. Double-click on this parallel contact and assign it as Input_1.
Double click on output and assign it as LED Out 1.
Arduino OPTA PLC IDE - Ladder Diagram First Program
Right-click on this output and select coil. A parallel output coil will be displayed. Call this coil output_1.
Arduino OPTA PLC IDE - Ladder Diagram First Program
Right-click on the rung and select copy network. We could also use Ctrl+C after we selected the rung.
Arduino OPTA PLC IDE - Ladder Diagram First Program
Select the rung again and right-click. Select paste network. (Ctrl + V) This will add rung 3. Change the first input and output to the second.
Arduino OPTA PLC IDE - Ladder Diagram First Program
Copy and paste again for rung 4.
Arduino OPTA PLC IDE - Ladder Diagram First Program
Change the input and output to three. If you forgot to include an input or output, go back to mappings and assign a variable. This must be done to include the physical IO in the program.
Monitoring Variables
Select the compile icon on the main menu. This will compile our Opta PLC program. If there is an error, compiling will show this so we may correct it.

Download the Ladder Program to the Opta PLC

PLC Ethernet Communication
Select setup communication from the main menu | On-Line.
PLC Ethernet Communication
In the device link manager window, select Modbus TCP and then select activate.
PLC Ethernet Communication
Select properties.
We can now enter the IP address we established in the following post.
Programming the Arduino OPTA PLC – Ethernet Port
PLC Ethernet Communication
Our communication method with the OPTA PLC is now set.
PLC Ethernet Communication
Select the connect button. We will now see that our computer is connected to the Opta PLC controller.
PLC Ethernet Communication
Select the download icon on the main menu.
If we didn’t compile the project first, the PLC IDE would have prompted us before downloading. Select Yes.
The output window will display the status of the download operation. 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 Ladder Logic and Variables

Monitoring Variables
Select the live debug mode icon on the main menu.
This will highlight the inputs and outputs as the program operates. The visualization is a good way to ensure your program works correctly.
Monitoring Variables
Select the watch icon on the main menu. This will display the watch window.
Monitoring Variables
We can enter and select the variables (tags) we want to monitor.
Watch the video below to see how to create ladder 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 IDE – Ladder Diagram 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