You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We will create a demo application from scratch, in which we will read the voltage from an analog sensor and control the expansion relay outputs based on the voltage level measured.
25
25
26
26
## Goals
27
27
28
-
- Learn how to use Opta™ Digital Expansions with the PLC IDE
28
+
- Learn how to use Opta™ Analog Expansion with the PLC IDE
29
29
- Learn how to enhance your Opta™ controller's capabilities using Opta™ expansions
30
30
- Leverage Arduino Pro products for real industrial applications
- The [Arduino PLC IDE](https://www.arduino.cc/pro/software-plc-ide)
43
42
44
-
## Instructions
43
+
## Initial Configuration
45
44
46
45
### Snapping the Expansion
47
46
@@ -55,18 +54,7 @@ Attach the expansions to the right side of your Opta™ controller. Ensure that
55
54
56
55
The expansions must be powered externally in order to be detected and properly work.
57
56
58
-

59
-
60
-
### Solution Wiring
61
-
62
-
The following wiring setup will be used for the solution explained in this tutorial.
63
-
64
-

65
-
66
-
- In the **Opta™**, connect the power supply to the respective inputs on the screw terminals.
67
-
- From the **Opta™** power screw terminals, wire the power to the Opta™ expansion.
68
-
- Connect the sensor output to the **I1** input of the Opta™ expansion, specifically the variable tap of the potentiometer.
69
-
- Power the sensor using its respective power source, which in this case is the power screw terminals of the expansion.
57
+

70
58
71
59
### Opta™ Micro PLC Setup
72
60
@@ -95,16 +83,20 @@ Next, click the **Connect** button in the upper left corner and wait for the bas
95
83
96
84
If the Opta™ status displays **No License**, click the **Activate PLC runtime** button to activate it. For more details, refer to this [guide](https://docs.arduino.cc/tutorials/portenta-machine-control/plc-ide-setup-license/#7-license-activation-with-pre-licensed-products-opta).
97
85
98
-
### Solution Setup
86
+
### Analog Expansion Setup
99
87
100
-
To enable the Opta™ Digital Expansion features in the PLC IDE, navigate to the **Resources** tab and select **I/O Expansions** in the configuration tree. Then click **Scan** to allow the IDE to search for connected expansions.
88
+
To enable the Opta™ Analog Expansion features in the PLC IDE, navigate to the **Resources** tab and select **I/O Expansions** in the configuration tree. Then click **Scan** to allow the IDE to search for connected expansions.
101
89
102
90

103
91
104
92
Once the available expansion appears in the **Detected config** column, enable it by clicking on **Apply detect config**. Verify that the **Project config** column is updated.
105
93
106
94

107
95
96
+
## Programmable Inputs
97
+
98
+
99
+
108
100
To set up the sensor input for the potentiometer, navigate to **Programmable Inputs** under your desired expansion in the left resources menu. Define a **variable** name, **sensor** in this case, and set the **IOType** to **Analog**.
109
101
110
102

@@ -135,51 +127,42 @@ Copy and paste the following sketch to the **Main code** text editor:
135
127
136
128
```
137
129
VSTEP := VCC/8;
138
-
139
130
VIN := sensor*1.733E-3;
140
-
141
131
IF VIN >= VSTEP*1 THEN
142
132
out_1 := TRUE;
143
133
ELSE
144
134
out_1 := FALSE;
145
135
END_IF;
146
-
147
136
IF VIN >= VSTEP*2 THEN
148
137
out_2 := TRUE;
149
138
ELSE
150
139
out_2 := FALSE;
151
140
END_IF;
152
-
153
141
IF VIN >= VSTEP*3 THEN
154
142
out_3 := TRUE;
155
143
ELSE
156
144
out_3 := FALSE;
157
145
END_IF;
158
-
159
146
IF VIN >= VSTEP*4 THEN
160
147
out_4 := TRUE;
161
148
ELSE
162
149
out_4 := FALSE;
163
150
END_IF;
164
-
165
151
IF VIN >= VSTEP*5 THEN
166
152
out_5 := TRUE;
167
153
ELSE
168
154
out_5 := FALSE;
169
155
END_IF;
170
-
171
156
IF VIN >= VSTEP*6 THEN
172
157
out_6 := TRUE;
173
158
ELSE
174
159
out_6 := FALSE;
175
160
END_IF;
176
-
177
161
IF VIN >= VSTEP*7 THEN
178
162
out_7 := TRUE;
179
163
ELSE
180
164
out_7 := FALSE;
181
165
END_IF;
182
-
183
166
IF VIN >= VSTEP*8 THEN
184
167
out_8 := TRUE;
185
168
ELSE
@@ -214,4 +197,4 @@ Extend your knowledge about the Opta™ controller and the PLC IDE by following
214
197
-[Arduino PLC IDE Setup & Device License Activation](https://docs.arduino.cc/tutorials/portenta-machine-control/plc-ide-setup-license/)
215
198
-[Programming Introduction with Arduino PLC IDE](https://docs.arduino.cc/tutorials/portenta-machine-control/plc-programming-introduction/)
216
199
-[Tank Level Monitoring with the Opta™](https://docs.arduino.cc/tutorials/opta/tank-level-app-note/)
217
-
-[Modbus TCP with Portenta Machine Control & Opta™](https://docs.arduino.cc/tutorials/portenta-machine-control/pmc-opta-modbus-tcp/)
200
+
-[Modbus TCP with Portenta Machine Control & Opta™](https://docs.arduino.cc/tutorials/portenta-machine-control/pmc-opta-modbus-tcp/)
0 commit comments