Skip to content

[PC-1405] PLC IDE: Documentations QoL Updates #1359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ software:
---

## Introduction

RTDs (Resistance Temperature Detectors) and Thermocouples are used for temperature measurement in various industrial fields. **RTDs** are sensors that change resistance in response to temperature variation. They are used regularly in industries that require precise temperature measurements, such as food processing and pharmaceuticals.

On the other hand, **Thermocouples** are transducers that provide a voltage proportional to the temperature difference between two junctions. They are widely used in industrial applications such as HVAC systems, diesel engines, and power plants.
Expand All @@ -30,26 +31,32 @@ Both RTDs and thermocouples have unique characteristics, which make them suitabl
In this tutorial, we will use a two-wire **PT100** RTD to obtain temperature measurements. We will also briefly discuss how to connect a three-wire RTD and a thermocouple.

## Goals

The goals of this tutorial are:

- Learn about the differences between RTD and thermocouples
- Learn how to connect an RTD or thermocouple to the Portenta Machine Control
- Understand the operation of the Portenta Machine Control's Temperature Probe inputs
- Learn about PLC IDE functions and variables
- Read the temperature values using the Arduino PLC IDE

## Hardware and Software Requirements

### Hardware Requirements

- [Portenta Machine Control](https://store.arduino.cc/products/arduino-portenta-machine-control) (x1)
- Micro-USB cable (x1)
- PT100 RTD (x1)

### Software Requirements

- The [Arduino PLC IDE](https://www.arduino.cc/pro/software-plc-ide) (Including Arduino PLC IDE Tools)
- If you have not done so, set up and activate the Portenta Machine Control license following the steps of [this tutorial](https://docs.arduino.cc/tutorials/portenta-machine-control/plc-ide-setup-license)

## Temperature Sensors

### RTD

A **Resistance Temperature Detector**, or **RTD**, is a temperature sensor that works by measuring the variation in the electrical resistance of a metallic element as a function of the temperature changes. The most commonly used metal for RTDs is platinum: one common type of RTD sensor is the PT100, where PT stands for platinum and 100 refers to the nominal resistance of the sensor at 0°C.

As the temperature increases, the resistance of the metal element in the RTD increases predictably and linearly. The resistance variation can be measured using an external circuit or measuring instrument and converted into a temperature reading, using a calibration curve or formula putting into relation the resistance value with the temperature.
Expand All @@ -69,6 +76,7 @@ Thermocouples are used in a wide range of applications where temperature measure
Depending on the sensor you use, you will need to perform different connection settings. Find below three tables showing how to connect a two-wire RTD (PT100), a three-wire RTD (PT100) or a thermocouple.

### Two Wires RTD Connection

The 2-wire RTD configuration is the simplest of the RTD circuit designs, but is more prone to errors.

| Channel 0 | Channel 1 | Channel 2 |
Expand All @@ -82,6 +90,7 @@ In this tutorial, we will use a two-wire RTD, so we will configure **channel 0**
![Two Wires Connection to Channel 0](./assets/two-wire-connection.png)

### Three Wires RTD Connection

The 3-wire RTD configuration is the most commonly used RTD circuit design. In this configuration, two wires link the sensing element to the monitoring device on one side of the sensing element, and one links it on the other side.

| Channel 0 | Channel 1 | Channel 2 |
Expand All @@ -97,7 +106,9 @@ The 3-wire RTD configuration is the most commonly used RTD circuit design. In th
### Thermocouples Connection

Connect **only non-grounded thermocouples** (grounded thermocouples are not supported). Do not connect both a thermocouple and a PT100 to a single same channel.

The thermocouples supported by the Portenta Machine Control are:

- Thermocouple Type K, non-grounded
- Thermocouple Type J, non-grounded

Expand All @@ -106,7 +117,6 @@ The thermocouples supported by the Portenta Machine Control are:
| Connect the positive pin to TP0 | Connect the positive pin to TP1 | Connect the positive pin to TP2 |
| Connect the negative pin to TN0 | Connect the negative pin to TN1 | Connect the negative pin to TN2 |


***Do not connect any pin to GND***

![Thermocouple Connection to Channel 0](./assets/thermocouple-connection.png)
Expand Down Expand Up @@ -181,6 +191,7 @@ Now that we have created the variables, we have to make it work by defining the
TP00 := sysTempProbes[0];
temp0:= systempProbes[0].temperature;
```

Next, plug in your device, make sure it is connected to the Arduino PLC IDE and click the compile button to make sure there are no errors in the code.

If you are not sure about how to connect your device, you can check it on [the setup tutorial](https://docs.arduino.cc/tutorials/portenta-machine-control/plc-ide-setup-license#5-connect-to-the-device).
Expand All @@ -198,13 +209,15 @@ To visualize the values once we have downloaded the code into the Portenta Machi
![Watch Variables](./assets/watch-variables.gif)

## Conclusion

RTDs are best for high-accuracy temperature measurements within a narrow range of up to 600°C. Thermocouples are better for high-temperature applications up to 2300°C, fast response times, and harsh environments. RTDs are used in laboratories and industrial process control, while thermocouples are used in industrial applications like furnaces and aerospace.

We have learned how to connect RTD and Thermocouple sensors to a Portenta Machine Control and how to monitor the temperature values through the Arduino PLC IDE.

We have also learned that there are many different types of RTDs and thermocouples and that we have to choose one according to our needs.

## Next Steps

Now that we know how to use these temperature sensors, we can implement them in a real industrial or domestic environment, such as an ambient temperature monitoring project.

- For more information on programming in the Arduino PLC IDE using IEC-61131-3 languages, please refer to the tutorial [Introduction to Programming with the Arduino PLC IDE](https://docs.arduino.cc/tutorials/portenta-machine-control/plc-programming-introduction) tutorial.
Expand Down
6 changes: 6 additions & 0 deletions content/software/plc-ide/tutorials/modbus-setup/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,15 @@ Then you can attach some functions to the Generic Modbus item, they will appear
![Modbus catalog select new item](assets/modbusCatalog-add-prompt.png)

#### Mode
<br></br>

* Not used
* Modbus RTU Master
* Modbus RTU Slave

#### Baud Rate
<br></br>


Baud rate, options:
* 600
Expand All @@ -73,6 +76,7 @@ Baud rate, options:
* 115200

#### Serial Mode
<br></br>

| Name | Parity | data bits | stop bits |
| ------- | ----------- | --------- | ----------|
Expand All @@ -83,13 +87,15 @@ Baud rate, options:
| O, 8, 2 | Odd parity | 8 | 2 |

#### Slave Settings
<br></br>

(Only available on slave mode)

* Modbus address
Address of the device: from 1 to 247. It can not be repeated within the same Modbus net.

#### Modbus Node Configuration
<br></br>

Once you have configured your device as a **Modbus Master** you can attach some blocks to configure it, you can see them while you have the **RS485 SerialPort** on the **Catalog Tile Window**
![Modbus catalog](assets/modBusCatalog.png)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ The PLC IDE configuration will play an important role in establishing successful
Thus, you will learn to configure the 'Shared variables' based on the peripherals and tasks you may assign to Opta™.

#### Shared Variables Configuration
<br></br>

The successful communication between Opta™ configured with PLC IDE and Arduino IoT Cloud relies on the 'Shared variables'. The 'Shared variables' is defined by heading to `Resources > Opta > Shared variables`. It will then offer two additional tabs: 'Inputs' and 'Outputs'.

Expand Down Expand Up @@ -238,6 +239,7 @@ Depending on the project's development requirements, you can add all the variabl
We will now configure Opta™ device's features to link all these shared variables.

#### Analog Port Configuration
<br></br>

The analog port is configured using the following properties under: `Resources > Opta > Local IO Mapping > Programmable Inputs`.

Expand All @@ -254,6 +256,7 @@ The 'Programmable inputs mapping' table should look as the following image:
You can also change the analog resolution if needed between 12, 14, or 16 bits.

#### User Programmable LED Configuration
<br></br>

The user programmable LED of Opta™ is configurable under `Resources > Opta > Local IO Mapping > LED Outputs`. To use the user programmable LED, you will need to assign a variable that will represent the 'LB' row as it can be seen in the following image:

Expand All @@ -262,6 +265,7 @@ The user programmable LED of Opta™ is configurable under `Resources > Opta > L
In this case, the `userLed` is assigned as the variable that will represent the user programmable LED of Opta™ that emits blue light. The `userLed` is a boolean type variable as well as the `in_cloudButton`. It will be matched inside the PLC program to pass the boolean state per the command sent from the Arduino IoT Cloud dashboard.

#### Library Components
<br></br>

The Library section would be where you could find various pre-written codes or functions specific to PLC operations. It could include libraries for handling several industrial protocols, dealing with specific types of I/O, or even specialized functions for certain control systems. It makes the development process more efficient by providing ready-to-use codes, saving time and effort.

Expand All @@ -285,6 +289,7 @@ These libraries are indexed, thus they are certified guaranteeing optimized perf
***For more information about managing libraries inside PLC IDE, please have a look at ["Library Management"](https://docs.arduino.cc/software/plc-ide/tutorials/plc-programming-introduction#library-management) section from the [Programming Introduction with Arduino PLC IDE](https://docs.arduino.cc/software/plc-ide/tutorials/plc-programming-introduction).***

#### Arduino Sketch
<br></br>

We can now build the Arduino sketch that will be used to establish communication with the Arduino IoT Cloud and manage data traffic. The base sketch will be needed and can be found as discussed in the ['Setting Up the Arduino IoT Cloud'](#setting-up-the-iot-cloud) section.

Expand Down Expand Up @@ -386,6 +391,7 @@ void onCloudButtonChange() {
The `NETWORK_SSID` and `NETWORK_PASS` requires to be manually defined. Please replace these parameters to establish a connection with the desired network. Also, the parameters must be defined in between the quotation marks, replacing `NETWORK_SSID` and `NETWORK_PASS` fields.

#### PLC Program
<br></br>

The Arduino sketch is ready and now we need a PLC program that will control the onboard features of Opta™ and data readings.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ To create a variable for a **pin map** you have two options:
***By default they are not available as variables, in any case, you can get the values by accessing their memory registers, which is not as easy as having variables with the data.***

#### Single Variable
<br></br>

Double-click the **Pin Map** that you want to edit, for example, the **Digital Output table**.

Expand All @@ -85,6 +86,7 @@ digitalOut01 := 1;
```

#### Array
<br></br>

Go to your project tile window, and right-click on the **Global Variable** element.

Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ To get the Arduino PLC IDE software, go to the [official software website of the
* Arduino PLC IDE Tools
* Arduino PLC IDE

![Arduino IDE Download page](assets/IdeDownloadPage.png)
![Arduino IDE Download page](assets/IdeDownloadPage.svg)

The software requires **Windows 10** or a newer operating system version for the x64 architecture.

Expand All @@ -73,9 +73,9 @@ Once the installation has finished, all the required drivers, libraries, and Ard

When you download the Arduino PLC IDE executable, the file naming scheme is as follows:

`Setup_Arduino PLC IDE_X.X.X.X_20230329`
`Setup_Arduino PLC IDE_X.X.X.X_{ReleaseDate}`

If you have got the correct IDE software, it should follow the previous naming scheme with the `X.X.X` that represents the version of the IDE software and its latest version release date.
If you have the correct IDE software, its name should include the version format `X.X.X.X`, with the associated release date in the `{ReleaseDate}` field. For instance, a release date might look like `20230329`.

Run the Arduino PLC IDE installer after you have installed the Arduino PLC IDE Tools. If you have not installed the PLC IDE tools, please check [Arduino® PLC IDE Tools Setup section](#1-arduino-plc-ide-tools-setup) before proceeding as it needs to have the tools set before IDE software installation.

Expand Down Expand Up @@ -134,6 +134,7 @@ Click OK to save the settings and press the connect button on **On-line > Connec
If the communication is successful the main panel will show the license section to be filled in and a status indicator.

#### Online Activation
<br></br>

To use your product license, paste the key in the blank next to **Product Key** and press the **Activate** button.

Expand All @@ -146,6 +147,7 @@ After you click the **Activate** button, the IDE will bind the license to the ha
Once the product has been activated, it is recommended to get the **Hardware-ID** of your device.

#### Offline Activation
<br></br>

To activate the product **Offline**, deselect the "Online" slider and the scenario below will show up:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ There are 2 types of variables:
* Local variables: Only one program has access to it.

#### Global Variable
<br></br>

Click inside the **Project** tab and click the **Global_vars** section, a table is available to see the full list of global variables on your project.

Expand All @@ -53,6 +54,7 @@ You will see a list with all the global variables in the **Global_vars** section
![Using a global variable inside a program](assets/usingGlobalVariable.png)

#### Local Variable
<br></br>

Go inside the **Project** tab and select a program by double-clicking it, once it has been opened you will see a **Local Variables** table on the top panel.
![Default Ladder Diagram Program](assets/default_LD_program.png)
Expand All @@ -78,6 +80,7 @@ Once you drag and drop it on your canvas it will generate a block with some inpu
Once you have your programs you can attach them to a task inside the runtime.

There are 4 Tasks:

* Init: Single execution of the assigned programs, done on the initialization
* Fast: Loop that executes the attached programs, every 10ms by default (it can be changed)
* Slow: Loop that executes the attached programs, every 100ms, can not be changed
Expand Down Expand Up @@ -183,6 +186,7 @@ This is how a counter program looks:
![Ladder Diagram counter program](assets/LDprogram.png)

Here is a video doing that from scratch:

<iframe width="100%" height="415" src="https://www.youtube.com/embed/0EdATSgIc9o" title="YouTube video player" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

### Sequential Function Chart
Expand All @@ -192,6 +196,7 @@ This language approaches the script in a similar way as a flowchart, meaning you
SFC language can not interact directly with the machine, meaning you can not make an output be OFF directly, to do so you will need to create **actions**

#### Actions
<br></br>

An action is a script in another language (i.e. structured text) that performs the work, this will get triggered depending on the chart.

Expand All @@ -200,6 +205,7 @@ To create one go to your project tree, right-click the SFC script and click the
![Creating new action](assets/newAction.png)

#### SFC Program
<br></br>

You have blocks available by right-clicking inside the canvas or on the top bar, you can drag and drop them.

Expand All @@ -213,6 +219,7 @@ The counter program should look like the following picture. Note the action insi
![Sequential Function Chart counter program](assets/SFCprogram.png)

Here is a video doing that from scratch:

<iframe width="100%" height="415" src="https://www.youtube.com/embed/olQooS4bX4A" title="YouTube video player" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

### Functional Block Diagram
Expand All @@ -225,13 +232,15 @@ This is how the counter program looks:
![Functional Block Diagram](assets/FBDprogram.png)

Here is a video doing that from scratch:

<iframe width="100%" height="415" src="https://www.youtube.com/embed/l1L4jzDVKyE" title="YouTube video player" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

***In the previous programs, we used local variables, remember to select the program's specific variables to be watched, or you will not see any data***

## Conclusion

You have:

* Created a simple counter with each language
* Learned how to watch live variable's value
* Attached a program to a task
Expand Down