Skip to content

Commit e38a9b3

Browse files
Merge pull request #1405 from ackPeng/docusaurus-version
add modbus rtu for recomputer_r1000_with_fin_use_modbus
2 parents 898d51d + c016eba commit e38a9b3

File tree

3 files changed

+209
-8
lines changed

3 files changed

+209
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
description: This article will show you how to use the Logic Builder of FIN Framwork
3+
4+
title: reComputer R1000 with FIN Logic Builder
5+
keywords:
6+
- Edge Controller
7+
- reComputer R1000
8+
- FIN
9+
- ModbusTCP
10+
- LOGIC
11+
image: https://files.seeedstudio.com/wiki/reComputer-R1000/recomputer_r_images/01.png
12+
slug: /reComputer_r1000_fin_logic_builder
13+
last_update:
14+
date: 07/16/2024
15+
author: ShuishengPeng
16+
---
17+
18+
## Introduction
19+
FIN Framework (FIN) is a software framework with application suites that can integrate, control, manage, analyze, visualize and connect. Its capabilities can be integrated by OEMs into a range of products and services.
20+
21+
This article will show you how to use the `Logic Builder` of FIN Framwork, and to implement an alarm using the `Logic Builder`.We monitor the value of a Modbus device. When the value exceeds the critical value, FIN will alarm.
22+
23+
## Getting Start
24+
25+
Before you start this project, you may need to prepare your hardware and software in advance as described here.
26+
27+
### Hardware Preparation
28+
29+
<div class="table-center">
30+
<table class="table-nobg">
31+
<tr class="table-trnobg">
32+
<th class="table-trnobg">reComputer R1000</th>
33+
</tr>
34+
<tr class="table-trnobg"></tr>
35+
<tr class="table-trnobg">
36+
<td class="table-trnobg"><div style={{textAlign:'center'}}><img src="https://files.seeedstudio.com/wiki/reComputer-R1000/recomputer_r_images/01.png" style={{width:300, height:'auto'}}/></div></td>
37+
</tr>
38+
<tr class="table-trnobg"></tr>
39+
<tr class="table-trnobg">
40+
<td class="table-trnobg"><div class="get_one_now_container" style={{textAlign: 'center'}}><a class="get_one_now_item" href="https://www.seeedstudio.com/reComputer-R1025-10-p-5895.html">
41+
<strong><span><font color={'FFFFFF'} size={"4"}> Get One Now 🖱️</font></span></strong>
42+
</a></div></td>
43+
</tr>
44+
</table>
45+
</div>
46+
47+
### Software Preparation
48+
* Regarding how to install FIN Framwork, you can refer to this [wiki](https://wiki.seeedstudio.com/reComputer_r1000_install_fin/).
49+
* About reComputer R1000 using FIN for Modbus communication, you can refer to this [wiki](https://wiki.seeedstudio.com/reComputer_r1000_use_rs485_modbus_rtu/).
50+
* Using [modbusmechanic](https://modbusmechanic.scifidryer.com/) on W10 PC.You can also use other modbus testing tools.
51+
### Hardware Configuration
52+
53+
For ModbusTCP, we use Ethernet cables to connect the W10 PC and reComputer R1000 to a switch to ensure that they are on the same network segment.
54+
55+
<div align="center"><img src="https://files.seeedstudio.com/wiki/reComputer-R1000/fuxa/r1000_connection.png" alt="pir" width="500" height="auto" /></div>
56+
57+
## Steps of implement an alarm
58+
### Create new Logic Builder program
59+
**Step 1**: First click the directory bar at the top to switch the system directory to the desired target location.
60+
61+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/Logic_path_location.png" /></center>
62+
63+
**Step 2**: Click `Logic Builder => new` on the setting interface, and the following pop-up window will appear:
64+
65+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/Logic_create_logic.png" /></center>
66+
67+
To fill in the following parameters:
68+
- **Name** - Name of the program
69+
- **Description** - Description for what the program is for/does
70+
- **Program On** - Used to specify what the program will run on
71+
- **Points** - Able to choose points from the equip to use
72+
- **Tags** - Find tags used on equip or refs
73+
- **Project Variables** - If other project variables exist on other programs, it provides a list of variables that can be used in the new program being create
74+
- **Absolute Points** - Able to add hardcoded points based on their id
75+
76+
`Points` can enter multiple points, but we only entered one here. After filling in the information, click `OK` and click `Edit` in the pop-up window on the right to enter the Logic editing interface.
77+
78+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/LOGIC_1.gif" /></center>
79+
80+
### Configure Block logic
81+
**Step 1**: Add an `if` block. There are two ways to add blocks in the workspace. The first is to click on the port of a block to add it, as shown in the figure:
82+
83+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/LOGIC_2.gif" /></center>
84+
85+
The second way is to add through the search box in the lower left corner, as shown in the figure:
86+
87+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/LOGIC_3.gif" /></center>
88+
89+
**Step 2**: Add the data points to be judged. On the left, you can see the data points we introduced when we created the Logic Builder program. It has two functions: `get` and `set`. Our logic is to determine whether the sensor value exceeds the critical value, so we choose `get` here. . Click `get` and drag it into the workspace, and a `sensor` block will appear.
90+
91+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/LOGIC_4.gif" /></center>
92+
93+
**Step 3**: Add the `>=` block. We need to determine whether the sensor value exceeds the critical value, so we need to add a `>=` block, which will output a result to the `if` block. The `if` block determines the next step by judging the result of the `>=` block. action. Here we set the critical value to `23`.
94+
95+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/LOGIC_5.gif" /></center>
96+
97+
**Step 4**: Add a delay block. Sometimes we need to make the system more anti-interference, we can add a delay module, and the alarm will only occur after a certain condition is met for a certain period of time. We set the delay time to 3s and connect the output of the module to the `if` block.
98+
99+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/LOGIC_6.gif" /></center>
100+
101+
**Step 5**: Create variables. When the sensor value exceeds the critical value, we can set a flag to mark the sensor value as abnormal. This flag can be implemented by creating a `variable`. `variable` has the following types:
102+
103+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/Logic_variable_type.png" /></center>
104+
105+
As shown in the figure, we added a variable named `Alarm_bool`, which also has `set` and `get` function blocks. We connect the `set` block of `Alarm_bool` after the `if` block. When the sensor value exceeds the critical value, it is set to `True`. When the sensor does not exceed the critical value, it is set to `False`.
106+
107+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/LOGIC_7.gif" /></center>
108+
109+
**Step 6**: Click `alarm` at the top to enter the `alarm` configuration interface. Type `alarm` in the lower left corner to find `alarmBlock` and drag it into the workspace. We need to select the `Alarm_bool` variable we created for `alarmBlock`. When the `Alarm_bool` variable is `True`, the alarm will be triggered, and when the `Alarm_bool` variable is `False`, the alarm will not be triggered.
110+
111+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/LOGIC_8.gif" /></center>
112+
113+
### Alarm demonstration
114+
115+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/LOGIC_9.gif" /></center>
116+
117+
118+
## Tech Support & Product Discussion
119+
120+
Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.
121+
122+
<div class="button_tech_support_container">
123+
<a href="https://forum.seeedstudio.com/" class="button_forum"></a>
124+
<a href="https://www.seeedstudio.com/contacts" class="button_email"></a>
125+
</div>
126+
127+
<div class="button_tech_support_container">
128+
<a href="https://discord.gg/eWkprNDMU7" class="button_discord"></a>
129+
<a href="https://github.com/Seeed-Studio/wiki-documents/discussions/69" class="button_discussion"></a>
130+
</div>
Lines changed: 77 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
description: This article introduces how to use the `Modbus Connector` of `FIN Framwork`.
33

4-
title: reComputer R1000 with FIN to use modbus TCP
4+
title: reComputer R1000 with FIN to use modbus TCP/RTU
55
keywords:
66
- Edge Controller
77
- reComputer R1000
88
- FIN
9-
- ModbusTCP
9+
- ModbusTCP/RTU
1010
image: https://files.seeedstudio.com/wiki/reComputer-R1000/recomputer_r_images/01.png
11-
slug: /reComputer_r1000_fin_modbus_tcp
11+
slug: /reComputer_r1000_fin_modbus_tcp_and_rtu
1212
last_update:
1313
date: 07/15/2024
1414
author: ShuishengPeng
@@ -17,7 +17,7 @@ last_update:
1717
## Introduction
1818
FIN Framework (FIN) is a software framework with application suites that can integrate, control, manage, analyze, visualize and connect. Its capabilities can be integrated by OEMs into a range of products and services.
1919

20-
This article introduces how to use the `Modbus Connector` of `FIN Framwork`, which mainly includes three aspects: creating a `FIN Framwork` project, configuring the `Modbus Connector`, and adding data points to `Equip`.
20+
This article introduces how to use the `Modbus Connector` of `FIN Framwork`, the use of Modbus TCP/RTU in FIN Framwork was explained in detail. which mainly includes three aspects: creating a `FIN Framwork` project, configure `serial port number`, configuring the `Modbus Connector`, and adding data points to `Equip`.
2121

2222
## Getting Start
2323

@@ -45,13 +45,19 @@ Before you start this project, you may need to prepare your hardware and softwar
4545

4646
### Software Preparation
4747
* Regarding how to install FIN Framwork, you can refer to this [wiki](https://wiki.seeedstudio.com/reComputer_r1000_install_fin/).
48+
* Regarding how to use the modbus function of reComputer R1000, you can refer to this [wiki](https://wiki.seeedstudio.com/reComputer_r1000_use_rs485_modbus_rtu/).
4849
* Using [modbusmechanic](https://modbusmechanic.scifidryer.com/) on W10 PC.You can also use other modbus testing tools.
4950
### Hardware Configuration
5051

5152
For ModbusTCP, we use Ethernet cables to connect the W10 PC and reComputer R1000 to a switch to ensure that they are on the same network segment.
5253

5354
<div align="center"><img src="https://files.seeedstudio.com/wiki/reComputer-R1000/fuxa/r1000_connection.png" alt="pir" width="500" height="auto" /></div>
5455

56+
For ModbustRTU, we used an rs485 to USB module to connect the reComuputer R1000 with the W10 pc.
57+
58+
<div align="center"><img src="https://files.seeedstudio.com/wiki/reComputer-R1000/RS485_fix/hardwareconnection.png" alt="pir" width="700" height="auto" /></div>
59+
60+
5561
### Create New Project
5662
**Step 1**: Click the `Create` button in the lower left corner of the homepage, and a new pop-up window will appear. The pop-up window mainly has three attributes that need to be filled in:
5763
- NAME: the name of the new project
@@ -64,7 +70,7 @@ For ModbusTCP, we use Ethernet cables to connect the W10 PC and reComputer R1000
6470

6571
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/modbus_tcp_2.gif" /></center>
6672

67-
### Configure `Modbus Connector`
73+
### Configure `Modbus Connector` for Modbus TCP
6874

6975
**Step 1**: Open `Modbus Connector`. Click `Settrings => Ext` and find `Modbus`. At this time, `Modbus` is marked in red. Click `Enable` and you can see that the `Modbus` mark turns green, indicating that the `Modbus Connector` has been successfully opened. Enter `DB Builder` again and you can see that there is already a `Modbus` option.
7076

@@ -75,8 +81,17 @@ For ModbusTCP, we use Ethernet cables to connect the W10 PC and reComputer R1000
7581
- ModbusSlave: this would be the slave of the modbus device being connected (default is 1)
7682
- Existing Register Map: If the user already configured a Modbus connector, they would see available registers here to choose from or create a new one with the next property ModbusRegMapUri.
7783
- ModbusRegMapUri: this is where the user would specify the name of the register map to link with this connector. Replace "xxx" with whatever the name of the register map is.
78-
- Uri: this is where the uri of the modbus connector would be specified.
79-
84+
- Uri: this is where the uri of the modbus connector would be specified.The format of URI is as shown in the table:
85+
<div class="table-center">
86+
87+
| Protocol | URI setup | Example | Notes |
88+
| ------------------------------------------------------------ | ----------- | -------------- | --------- |
89+
| TCP/IP | `modbus-tcp://host:port/` | `modbus-tcp://10.0.0.17/` | Default port is 502, can be omitted if standard |
90+
| RTU over TCP/IP | `modbus-rtutcp://host:port/` | `modbus-rtutcp://192.168.1.120:9001/` | Default port is 502, can be omitted if standard |
91+
| RTU over RS-485 | `modbus-rtu://<port>-<baud>-<dataBits>-<parity>` | `modbus-rtu://serial0-9600-8n1-none` | |
92+
93+
</div>
94+
8095
In our example, we specified "r1000_demo" as our register map. Then added our IP to the device in the Uri.
8196

8297
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/modbus_tcp_4.gif" /></center>
@@ -148,6 +163,61 @@ The system will create a new `r1000_demo.csv` file in the `opt/finFramework_5.1.
148163

149164
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/modbus_tcp_7.gif" /></center>
150165

166+
167+
### Configure `Modbus Connector` for Modbus RTU
168+
#### Configure serial port
169+
The script that needs to be executed is as follows:
170+
```shell
171+
## Turn off FIN service
172+
sudo systemctl stop fin
173+
## After downloading the config file, place it in /opt/finFramework_5.1.6.55/etc/finStackSerial/
174+
sudo cp ~/config.props /opt/finFramework_5.1.6.55/etc/finStackSerial/
175+
## Modify the config.props file to: serialPorts=/dev/ttyAMA30, /dev/ttyAMA31, /dev/ttyAMA32
176+
sudo nano /opt/finFramework_5.1.6.55/etc/finStackSerial/config.props
177+
## Restart the FIN service, wait for a while and then use a browser to open FIN
178+
sudo systemctl restart fin
179+
180+
```
181+
**Step 1**: Turn off FIN service, then download [config file](https://drive.google.com/file/d/1j1aGGSsGPjGCYfUGcXTqL2XGP2EuqFw2/view?usp=share_link) and save it to `/opt/finFramework_5.1.6 .55/etc/finStackSerial/` directory
182+
183+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/RTU_1.gif" /></center>
184+
185+
**Step 2**: Modify config.props to:
186+
```shell
187+
serialPorts=/dev/ttyAMA30, /dev/ttyAMA31, /dev/ttyAMA32
188+
```
189+
After the modification is completed, restart the FIN service
190+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/RTU_2.gif" /></center>
191+
192+
**Step 3**:Click on `Folio => launch`,and insert the following query:`serialPorts()`, The result will show which name has to be used for your specific port.The port is not the name of the physical port, but there is a match between the physical ports of the device and the name of the port to be used like `serial0`, `serial1` ...
193+
194+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/RTU_3.gif" /></center>
195+
196+
#### Configure Modbus RTU
197+
198+
**Step 1**: Open `Modbus Connector`. Click `Settrings => Ext` and find `Modbus`. At this time, `Modbus` is marked in red. Click `Enable` and you can see that the `Modbus` mark turns green, indicating that the `Modbus Connector` has been successfully opened. Enter `DB Builder` again and you can see that there is already a `Modbus` option.
199+
200+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/modbus_tcp_3.gif" /></center>
201+
202+
**Step 2**: Add a new Modbus connection. Click `Modbus => Add`.In our example, we specified "r1000_demo_rtu" as our register map. Then added our serial port to the device in the Uri.
203+
204+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/RTU_4.gif" /></center>
205+
206+
**Step 3**: Add a new `Register Maps`. Click `Register Maps => Add`, enter `Name`, which needs to be consistent with the name of `ModbusRegMapUri` in the second step, and finally click `ADD`.
207+
208+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/RTU_5.gif" /></center>
209+
210+
The system will create a new `r1000_demo_rtu.csv` file in the `opt/finFramework_5.1.6.55/var/proj/recomputer_R1000_demo/data/modbus/` directory. This file describes the Modbus register information we need to read.
211+
212+
**Step 4**: Add the register information to be read. `Modbus Connector` exists as a Modbus master. It will read the registers of the slave. We need to configure the register information to be read. Click `r1000_demo_rtu`, you can see that there is a description of `ping` by default, this is a must. We continue to add new register information and click `Register Maps => r1000_demo_rtu => Add`.
213+
214+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/RTU_6.gif" /></center>
215+
216+
**Step 5**: Communication test. After adding the description information of the register, communication can be carried out. Here we use `ModbusMechanic` as the Modbus slave. Click `Modbus => Ping` and you can see that `Status` changes to `OK`, indicating that the communication is normal.
217+
218+
<center><img width={600} src="https://files.seeedstudio.com/wiki/reComputer-R1000/fin/RTU_7.gif" /></center>
219+
220+
151221
### Add data points to `Equip Tree`
152222

153223
**Step 1**: add `Equip`. Click `Equip Tree => + => Add site`, enter `Name`, here I enter `Tower`, it can add a `site` named `Tower`; then click `Equip Tree => Tower => + => Add Floor`, enter `Name`, here I enter `Floor1`, it can add a `Floor` named `Floor1`; click `Equip Tree again => Tower => Floor1 => + => Add Equip`, enter `Name`, here I enter `ModbusEquip` to add a new `Equip`.

sidebars.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2972,7 +2972,8 @@ const sidebars = {
29722972
label: 'FIN',
29732973
items: [
29742974
'Edge/Raspberry_Pi_Devices/reComputer_R1000/Applications/Fin/recomputer_r1000_install_fin',
2975-
'Edge/Raspberry_Pi_Devices/reComputer_R1000/Applications/Fin/recomputer_r1000_with_fin_use_modbus_tcp',
2975+
'Edge/Raspberry_Pi_Devices/reComputer_R1000/Applications/Fin/recomputer_r1000_with_fin_use_modbus',
2976+
'Edge/Raspberry_Pi_Devices/reComputer_R1000/Applications/Fin/recomputer_r1000_with-_fin_use_logic_to_alarm',
29762977

29772978
],
29782979
},

0 commit comments

Comments
 (0)