Skip to content

Commit b9f4d72

Browse files
marqdevxaliphysFr4ngBenjaminDannegardjcarolinares
authored
PLC IDE Tutorials [PC-1041, PC-1003] (#219)
* PLC IDE setup guide [PC-974] (#172) Co-authored-by: Ali Jahangiri <[email protected]> Co-authored-by: Fr4ng <[email protected]> Co-authored-by: BenjaminDannegård <[email protected]> * Fix naming * PLC IDE: Programming with IEC standard languages introdution [PC-975] (#174) Co-authored-by: BenjaminDannegard <[email protected]> Co-authored-by: Fr4ng <[email protected]> * Move setup tutorial to correct folder * Fix and align metadata * Create Pin Mapping for PMC on the Arduino PLC IDE [PC-1002] (#189) Co-authored-by: Julián Caro Linares <[email protected]> * Empty-Commit * PLC IDE + PMC, Pin Map tutorial: Small tweaking [PC-1050] (#225) * Small tweaking * Minor rewording * Pin Map bold * Tweak explanation * map table bold * Update content/hardware/05.pro-solutions/solutions-and-kits/portenta-machine-control/tutorials/plc-ide-pin-mapping/content.md Co-authored-by: Julián Caro Linares <[email protected]> * Re-order, rename headings * Title case * Update content/hardware/05.pro-solutions/solutions-and-kits/portenta-machine-control/tutorials/plc-ide-pin-mapping/content.md Co-authored-by: Julián Caro Linares <[email protected]> * Requirements rewording Co-authored-by: Julián Caro Linares <[email protected]> * Add symlinks to the software page * Update license and PLC IDE links * Add 2 executables info * PLC-IDE CAN set up [PC-1000] (#227) * First commit * Lint and remove tags * Fix typo * Apply suggestions from code review Co-authored-by: Julián Caro Linares <[email protected]> * Fix typo, title case and next-step paragraph Co-authored-by: marqdevx <[email protected]> * Add paragraph from feedback * Hide settings list Co-authored-by: Julián Caro Linares <[email protected]> * PLC-IDE ModBus set up [PC-1001] (#215) * First commit * Add screenshot * MD fixes * Lint fix and added RTU naming * Lint fix * PLC IDE + PMC ModBus: tutorial fix (#226) * Added ModBus TCP * Add modbus node configration * MD fixes * assets fix * Empty-Commit * Fix overview * Add TCP and move Parametrization section * Add ethernet note * ModBus capitalization * Add software metadata Co-authored-by: canchebagur <[email protected]> * Add symlinks Co-authored-by: Ali Jahangiri <[email protected]> Co-authored-by: Fr4ng <[email protected]> Co-authored-by: BenjaminDannegård <[email protected]> Co-authored-by: Julián Caro Linares <[email protected]> Co-authored-by: canchebagur <[email protected]>
1 parent a2b7869 commit b9f4d72

File tree

64 files changed

+742
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+742
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
title: 'CAN Bus Setup with Arduino PLC IDE'
3+
description: 'This tutorial will show you how to set up the CAN bus communication with the Arduino PLC IDE.'
4+
tags:
5+
- PLC
6+
- CAN
7+
author: 'Pablo Marquínez'
8+
hardware:
9+
- hardware/05.pro-solutions/solutions-and-kits/portenta-machine-control
10+
---
11+
12+
## Overview
13+
14+
The Arduino Portenta Machine Control has the **TJA1049T** CAN transceiver which allows to use the **Controller Area Network (CAN) protocol** communication.
15+
16+
### What Is CAN
17+
18+
CAN is the acronym used for Controlled Area Network. This protocol was developed to be used on automotive and industrial applications to communicate with precise and critical demanding sensors.
19+
20+
The main advantages of the CAN bus protocol are:
21+
22+
* **Reduced wiring:** The CAN communication only uses two wires, creating a bus communication where all the devices of the network are connected. This is a huge advantage for industrial applications, like the automotive one, where we can connect all the electronic components of a car to the same network using only two wires, saving cost, materials, and simplifying the programming and manufacturing process.
23+
24+
* **Fast speed communication:** The CAN protocol is one of the most used communication protocols in the industry not only for its simplicity but also for its speed rates.
25+
26+
* **Strength and reliability:** Thanks to the twisted pair cables and the differential signal between them, the CAN bus protocol protects the data against electrical noise in industrial environments keeping the critical information safe and without data losses.
27+
28+
Structure of a CAN network:
29+
* **Main device:** Main controller or orchestrator of the communication. It interacts with the rest of the devices on the network, sending and receiving data from them. It usually is a controller device like the Portenta Machine control.
30+
* **Node or ECU (Electronic Control Unit):** Devices capable of interacting on the data bus. Although every device on the network can listen to the data that is being transferred on the bus each device has an unique number (ID) to communicate with that is included in every message, ignoring the messages that do not match their ID. However, all the nodes have access to the messages of the network, being possible for a node to read and use the data from another node if necessary.
31+
32+
CAN has built-in error detection so the application can handle its own errors in case of data loss (like CRC).
33+
34+
## Goals
35+
36+
- Set up the Portenta Machine Control with the Arduino PLC IDE
37+
- Configure the CAN communication inside the IDE
38+
39+
## Required Hardware and Software
40+
41+
- [Arduino Portenta Machine Control](https://store.arduino.cc/products/arduino-portenta-machine-control) board
42+
- [Arduino PLC IDE](../../software/plc-ide) license
43+
44+
## Set Up
45+
46+
In order to configure the Portenta Machine Control you will need to connect to the device through the Arduino PLC IDE:
47+
48+
1. Connect the device to the computer through USB
49+
2. Click "Connects to the target" button on the PLC IDE
50+
51+
***The device needs to be activated with a license, check the steps on the [PLC IDE Set-up tutorial](./plc-ide-setup-license)***
52+
53+
## Enable The CAN Communication
54+
55+
Inside the Arduino PLC IDE navigate to the left side panel and click on the "Resources" tab.
56+
57+
![Arduino PLC IDE Resources panel, -> CANopen CAN0](assets/CAN-configuration.png)
58+
59+
### CANopen Configuration
60+
61+
To configure in depth the settings you need to add the **Generic CANopen device** from the item's catalog.
62+
63+
![Add Items to CANopen's resource](assets/CAN-configuration-add.png)
64+
65+
![Item from the catalogue](assets/CAN-configuration-add-catalog.png)
66+
67+
Once the **Generic CANOpen device** has been added you can customize the configuration to comply your needs.
68+
69+
![CANopen configuration window](assets/CAN-configuration-general.png)
70+
71+
<!--
72+
Below, you will find an enumeration of the options located in each of the CAN configuration tabs and windows.
73+
74+
#### Network Settings Tabs
75+
76+
* Node number
77+
* Node Guard Period(ms)
78+
* Life time factor
79+
* Boot time elapsed
80+
* Wait boot-up message
81+
* Node heartbeat producer time
82+
* Node heartbeat consumer time
83+
* Master heartbeat consumer time
84+
* Mandatory
85+
* Identify Object Check
86+
87+
#### PDO Mapping
88+
89+
* PDO Auto Mapping
90+
91+
#### PDO Tx Communication Settings Tab
92+
Modes:
93+
* User Defined Mode
94+
* Sync Mode
95+
* Event mode
96+
* Cyclic mode
97+
98+
#### PDO Rx Communication Settings Tab
99+
Modes:
100+
* User Defined Mode
101+
* Sync Mode
102+
* Evemt Mode
103+
-->
104+
105+
### Parametrization Tab
106+
107+
![CANopen objects mapping table](assets/CAN-configuration-parametrization.png)
108+
109+
This window allows to create objects and set the addresses, this is called a mapped variable table.
110+
111+
### PDO Tables
112+
113+
This table customize the PDO (Process Data Object) dictionary, so you will set the variables for the information that you want to have usually cause they are time-critical, any device can overwrite those addresses, so it acts like shared variables.
114+
115+
You can edit the table by adding, removing new variables, you can also assign and unassign existing variables on your programs (Global Variables) to this table.
116+
117+
#### PDO Tx Input Tab
118+
119+
![CANopen PDO Tx configuration](assets/CAN-configuration-pdo-tx.png)
120+
121+
#### PDO Rx Output Tab
122+
123+
![CANopen PDO Rx configuration](assets/CAN-configuration-pdo-rx.png)
124+
125+
### Next Steps
126+
127+
Now that you have completed the setup of the Portenta Machine Control and its CAN bus communication with the Arduino PLC IDE, you can continue with:
128+
- Plug a CAN sensor to your device and get its data.
129+
- Expand your CAN bus network with more nodes sending and receiving messages from each one of them.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
---
2+
title: 'ModBus Setup with Arduino PLC IDE'
3+
description: 'This tutorial will show you how to set up the ModBus communication with the Arduino PLC IDE.'
4+
tags:
5+
- PLC
6+
- ModBus
7+
author: 'Pablo Marquínez'
8+
hardware:
9+
- hardware/05.pro-solutions/solutions-and-kits/portenta-machine-control
10+
software:
11+
- plc-ide
12+
---
13+
14+
## Overview
15+
16+
The Arduino Portenta Machine Control (PMC) is a fully-centralized, low-power, industrial control unit. For equipment and machinery control, industrial communication protocols, such as Modbus RTU over RS485 and Modbus TCP/IP over Ethernet, can be implemented in the PMC. In this tutorial, we will learn about how to get started on how to configure the ModBus communication with the Arduino PLC IDE.
17+
18+
## Goals
19+
20+
- Configure the ModBus communication (RTU and TCP)
21+
22+
## Required Hardware and Software
23+
24+
- [Arduino Portenta Machine Control](https://store.arduino.cc/products/arduino-portenta-machine-control) board
25+
- [Arduino PLC IDE](../../../../software/plc-ide) license
26+
27+
## Set Up
28+
29+
In order to configure the Portenta Machine Control you will need to connect to the device through the Arduino PLC IDE.
30+
31+
1. Connect the device to the computer through USB
32+
2. Click "Connects to the target" button on the PLC IDE
33+
34+
***The device needs to be activated with a license, check the steps on the [PLC IDE Set-up tutorial](./plc-ide-setup-license)***
35+
36+
***Both ModBus RTU and ModBus TCP can run at the same time in parallel***
37+
38+
## Configure The ModBus RTU Communication
39+
40+
***Important: Once you use the ModBus Mode to Master/Slave the RS485 ports will be only dedicated to ModBus, so the RS485 protocol is not accessible while using ModBus***
41+
42+
### ModBus RTU Configuration
43+
44+
Inside the Arduino PLC IDE navigate to the left side panel and click on the "Resources" tab.
45+
46+
![Arduino PLC IDE Resources panel, -> RS485 settings](assets/PLC-IDE-ModBus.png)
47+
48+
To configure the ModBus communication click on the "RS485 Serialport" label, it will open a new window on the middle to customize:
49+
50+
![ModBus configuration window](assets/ModBus-setup.png)
51+
52+
Then you can attach some functions to the Generic Modbus item, they will appear also in the **Catalog Tile Window**, you need to select first the **Generic Modbus_01**
53+
54+
![Modbus catalog add new item](assets/modBusCatalog-add.png)
55+
56+
![Modbus catalog select new item](assets/modbusCatalog-add-prompt.png)
57+
58+
#### Mode
59+
60+
* Not used
61+
* ModBus RTU Master
62+
* ModBus RTU Slave
63+
64+
#### Baud Rate
65+
66+
Bauds per second of the clock, options:
67+
* 600
68+
* 1200
69+
* 2400
70+
* 4800
71+
* 9600
72+
* 19200
73+
* 38400
74+
* 57600
75+
* 115200
76+
77+
#### Serial Mode
78+
79+
| Name | Parity | data bits | stop bits |
80+
| ------- | ----------- | --------- | ----------|
81+
| N, 8, 1 | No parity | 8 | 1 |
82+
| E, 8, 1 | Even parity | 8 | 1 |
83+
| O, 8, 1 | Odd parity | 8 | 2 |
84+
| N, 8, 2 | No parity | 8 | 2 |
85+
| O, 8, 2 | Odd parity | 8 | 2 |
86+
87+
#### Slave Settings
88+
89+
(Only available on slave mode)
90+
91+
* ModBus address
92+
Address of the device, from 1 to 247, it can not be repeated within the same ModBus net.
93+
94+
#### ModBus Node Configuration
95+
96+
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**
97+
![Modbus catalog](assets/modBusCatalog.png)
98+
99+
* Generic Modbus
100+
Configure the device name, Modbus address and the minimum polling time.
101+
102+
### ModBus TCP Configuration
103+
104+
***Important: Once you use the ModBus Mode, the ethernet port will be only dedicated to ModBus, so the ethernet protocol is not accessible while using ModBus***
105+
106+
Inside the Arduino PLC IDE navigate to the left side panel and click on the "Resources" tab.
107+
108+
To configure the ModBus communication click on the "Ethernet" label, it will open a new window on the middle to customize:
109+
110+
![Arduino PLC IDE Resources panel, -> Ethernet configuration](assets/modbusTCP-configuration.png)
111+
112+
* ModBus TCP Master: Enables the Master mode on the TCP bus (ModBus)
113+
* ModBus TCP Slave: Always enabled, address 255
114+
115+
Then you can attach some functions to the Generic Modbus item, they will appear also in the **Catalog Tile Window**, you need to select first the **Generic Modbus device**
116+
117+
![ModBus catalog add new item](assets/modbusTCP-configurationAdd.png)
118+
119+
![ModBus catalog select new item](assets/modbusTCP-configurationCatalogAdd.png)
120+
121+
![ModBus TCP general configuration tab](assets/modbusTCP-configuration-general.png)
122+
123+
Settings:
124+
* Name
125+
* IP address
126+
* Minimum polling time
127+
128+
## ModBus Parametrization
129+
130+
On the Generic
131+
![Generic ModBus Parametrization Tab](assets/modbusParametrization.png)
132+
133+
## ModBus Devices Functions (Modbus FC)
134+
135+
* Modbus FC-01: This will read the status of the coils (digital outputs)
136+
* Modbus FC-02: Reads the discrete inputs
137+
* Modbus FC-03: Reads the holding registers
138+
* Modbus FC-04: Read the input registers
139+
* Modbus FC-05: Writes single coil state
140+
* Modbus FC-06: Write single register
141+
* Modbus FC-15: Write multiple coils
142+
* Modbus FC-16: Write multiple registers
143+
144+
To configure the block you can click on it and it will show the configuration panel on the main window.
145+
![ModBus item catalog](assets/genericModbus-catalog.png)
146+
147+
Inside each of the "devices" (functions) you can set its:
148+
**General**
149+
* Start address
150+
* Polling time
151+
* Time Out
152+
153+
![ModBus item general configuration](assets/genericModbus-catalog-setting-general.png)
154+
155+
**Coil/Register/Table**
156+
This is a table to link all the coils, registers or variables that the function is going to poll/write.
157+
158+
![ModBus item specific configuration](assets/genericModbus-catalog-setting-specific.png)
159+
160+
### Next Steps
161+
162+
- Configure it as a ModBus Master device and connect a ModBus sensor to get data from.
163+
- Interconnect two Portenta Machine Control boards and create a sketch to communicate between them.

0 commit comments

Comments
 (0)