Skip to content

Commit 89d971c

Browse files
ArduinoBotmarqdevxsebromeroaliphysFr4ng
authored
Arduino PLC IDE - Launch (Tutorials + Software Page) (#713)
* Software: Add PLC-IDE page [PC-1038] (#209) * Update paragraph (#228) Co-authored-by: sebromero <[email protected]> * 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]> * PLC IDE launch, fixes (#229) * Fix software metadata * Update CAN tutorial * Fix ModBus tutorial Co-authored-by: Pablo Marquínez Ferrándiz <[email protected]> Co-authored-by: Sebastian Romero <[email protected]> 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 d2526f9 commit 89d971c

File tree

69 files changed

+142646
-75
lines changed

Some content is hidden

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

69 files changed

+142646
-75
lines changed

content/hardware/05.pro-solutions/solutions-and-kits/portenta-machine-control/tutorials/can-setup/assets/PMC-CAN-pins.svg

Lines changed: 141731 additions & 0 deletions
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
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+
software:
11+
- plc-ide
12+
---
13+
14+
## Overview
15+
16+
The Arduino Portenta Machine Control has the **TJA1049T** CAN transceiver which allows to use the **Controller Area Network (CAN) protocol** communication.
17+
18+
### What Is CAN
19+
20+
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.
21+
22+
The main advantages of the CAN bus protocol are:
23+
24+
* **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.
25+
26+
* **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.
27+
28+
* **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.
29+
30+
Structure of a CAN network:
31+
* **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.
32+
* **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.
33+
34+
CAN has built-in error detection so the application can handle its own errors in case of data loss (like CRC).
35+
36+
## Goals
37+
38+
- Set up the Portenta Machine Control with the Arduino PLC IDE
39+
- Configure the CAN communication inside the IDE
40+
41+
## Required Hardware and Software
42+
43+
- [Arduino Portenta Machine Control](https://store.arduino.cc/products/arduino-portenta-machine-control) board
44+
- [Arduino PLC IDE](../../software/plc-ide) license
45+
46+
## Set Up
47+
48+
### Software
49+
50+
In order to configure the Portenta Machine Control you will need to connect to the device through the Arduino PLC IDE:
51+
52+
1. Connect the device to the computer through USB
53+
2. Click "Connects to the target" button on the PLC IDE
54+
55+
***The device needs to be activated with a license, check the steps on the [PLC IDE Set-up tutorial](./plc-ide-setup-license)***
56+
57+
### Hardware
58+
59+
In order to use the CAN communication, you will need to:
60+
1. Supply the board with 24V DC, through the 24VIn and GND
61+
2. Connecting the CANH, CANL, and GND with a CAN Device
62+
63+
![Header pinout for CAN communication](assets/PMC-CAN-pins.svg)
64+
65+
## Enable The CAN Communication
66+
67+
Inside the Arduino PLC IDE navigate to the left side panel and click on the "Resources" tab.
68+
69+
![Arduino PLC IDE Resources panel, -> CANopen CAN0](assets/CAN-configuration.png)
70+
71+
### CANopen Configuration
72+
73+
To configure in depth the settings you need to add the **Generic CANopen device** from the item's catalog.
74+
75+
![Add Items to CANopen's resource](assets/CAN-configuration-add.png)
76+
77+
![Item from the catalogue](assets/CAN-configuration-add-catalog.png)
78+
79+
Once the **Generic CANOpen device** has been added you can customize the configuration to comply your needs.
80+
81+
![CANopen configuration window](assets/CAN-configuration-general.png)
82+
83+
<!--
84+
Below, you will find an enumeration of the options located in each of the CAN configuration tabs and windows.
85+
86+
#### Network Settings Tabs
87+
88+
* Node number
89+
* Node Guard Period(ms)
90+
* Life time factor
91+
* Boot time elapsed
92+
* Wait boot-up message
93+
* Node heartbeat producer time
94+
* Node heartbeat consumer time
95+
* Master heartbeat consumer time
96+
* Mandatory
97+
* Identify Object Check
98+
99+
#### PDO Mapping
100+
101+
* PDO Auto Mapping
102+
103+
#### PDO Tx Communication Settings Tab
104+
Modes:
105+
* User Defined Mode
106+
* Sync Mode
107+
* Event mode
108+
* Cyclic mode
109+
110+
#### PDO Rx Communication Settings Tab
111+
Modes:
112+
* User Defined Mode
113+
* Sync Mode
114+
* Evemt Mode
115+
-->
116+
117+
### Parametrization Tab
118+
119+
![CANopen objects mapping table](assets/CAN-configuration-parametrization.png)
120+
121+
This window allows to create objects and set the addresses, this is called a mapped variable table.
122+
123+
### PDO Tables
124+
125+
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.
126+
127+
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.
128+
129+
#### PDO Tx Input Tab
130+
131+
![CANopen PDO Tx configuration](assets/CAN-configuration-pdo-tx.png)
132+
133+
#### PDO Rx Output Tab
134+
135+
![CANopen PDO Rx configuration](assets/CAN-configuration-pdo-rx.png)
136+
137+
### Next Steps
138+
139+
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:
140+
- Plug a CAN sensor to your device and get its data.
141+
- 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,161 @@
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+
To configure the ModBus communication click on the "RS485 Serialport" label, it will open a new window on the middle to customize:
47+
48+
![Arduino PLC IDE Resources panel, -> RS485 settings](assets/PLC-IDE-ModBus.png)
49+
50+
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**
51+
52+
![Modbus catalog add new item](assets/modBusCatalog-add.png)
53+
54+
![Modbus catalog select new item](assets/modbusCatalog-add-prompt.png)
55+
56+
#### Mode
57+
58+
* Not used
59+
* ModBus RTU Master
60+
* ModBus RTU Slave
61+
62+
#### Baud Rate
63+
64+
Bauds per second of the clock, options:
65+
* 600
66+
* 1200
67+
* 2400
68+
* 4800
69+
* 9600
70+
* 19200
71+
* 38400
72+
* 57600
73+
* 115200
74+
75+
#### Serial Mode
76+
77+
| Name | Parity | data bits | stop bits |
78+
| ------- | ----------- | --------- | ----------|
79+
| N, 8, 1 | No parity | 8 | 1 |
80+
| E, 8, 1 | Even parity | 8 | 1 |
81+
| O, 8, 1 | Odd parity | 8 | 2 |
82+
| N, 8, 2 | No parity | 8 | 2 |
83+
| O, 8, 2 | Odd parity | 8 | 2 |
84+
85+
#### Slave Settings
86+
87+
(Only available on slave mode)
88+
89+
* ModBus address
90+
Address of the device, from 1 to 247, it can not be repeated within the same ModBus net.
91+
92+
#### ModBus Node Configuration
93+
94+
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**
95+
![Modbus catalog](assets/modBusCatalog.png)
96+
97+
* Generic Modbus
98+
Configure the device name, Modbus address and the minimum polling time.
99+
100+
### ModBus TCP Configuration
101+
102+
***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***
103+
104+
Inside the Arduino PLC IDE navigate to the left side panel and click on the "Resources" tab.
105+
106+
To configure the ModBus communication click on the "Ethernet" label, it will open a new window on the middle to customize:
107+
108+
![Arduino PLC IDE Resources panel, -> Ethernet configuration](assets/modbusTCP-configuration.png)
109+
110+
* ModBus TCP Master: Enables the Master mode on the TCP bus (ModBus)
111+
* ModBus TCP Slave: Always enabled, address 255
112+
113+
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**
114+
115+
![ModBus catalog add new item](assets/modbusTCP-configurationAdd.png)
116+
117+
![ModBus catalog select new item](assets/modbusTCP-configurationCatalogAdd.png)
118+
119+
![ModBus TCP general configuration tab](assets/modbusTCP-configuration-general.png)
120+
121+
Settings:
122+
* Name
123+
* IP address
124+
* Minimum polling time
125+
126+
## ModBus Parametrization
127+
128+
On the Generic
129+
![Generic ModBus Parametrization Tab](assets/modbusParametrization.png)
130+
131+
## ModBus Devices Functions (Modbus FC)
132+
133+
* Modbus FC-01: This will read the status of the coils (digital outputs)
134+
* Modbus FC-02: Reads the discrete inputs
135+
* Modbus FC-03: Reads the holding registers
136+
* Modbus FC-04: Read the input registers
137+
* Modbus FC-05: Writes single coil state
138+
* Modbus FC-06: Write single register
139+
* Modbus FC-15: Write multiple coils
140+
* Modbus FC-16: Write multiple registers
141+
142+
To configure the block you can click on it and it will show the configuration panel on the main window.
143+
![ModBus item catalog](assets/genericModbus-catalog.png)
144+
145+
Inside each of the "devices" (functions) you can set its:
146+
**General**
147+
* Start address
148+
* Polling time
149+
* Time Out
150+
151+
![ModBus item general configuration](assets/genericModbus-catalog-setting-general.png)
152+
153+
**Coil/Register/Table**
154+
This is a table to link all the coils, registers or variables that the function is going to poll/write.
155+
156+
![ModBus item specific configuration](assets/genericModbus-catalog-setting-specific.png)
157+
158+
### Next Steps
159+
160+
- Configure it as a ModBus Master device and connect a ModBus sensor to get data from.
161+
- Interconnect two Portenta Machine Control boards and create a sketch to communicate between them.

0 commit comments

Comments
 (0)