Skip to content

Commit 08b6b09

Browse files
Changes from review
1 parent 941ae00 commit 08b6b09

File tree

2 files changed

+37
-41
lines changed

2 files changed

+37
-41
lines changed

content/hardware/05.pro-solutions/solutions-and-kits/opta/tutorials/getting-started/content.md

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ hardware:
1818

1919
Opta is a robust micro PLC solution with many engaging features. In this tutorial we will go through the setup of Opta with the Arduino IDE and explain how to use its basic features, showing through examples how to program the LEDs on the device, how to use the programmable button, as well as controlling its inputs and outputs.
2020

21+
![The Arduino Opta](assets/opta-device.png)
22+
2123
## Goals
2224

2325
- Putting Opta to work with the Arduino IDE
@@ -49,20 +51,18 @@ Now you are ready to upload sketches to the Opta via the Arduino IDE.
4951

5052
Once the IDE and the core are installed, let's warm up by uploading a first sketch to your Opta. We will be using a modified version of the classical Arduino blink sketch to put your device to work and test if everything is set properly.
5153
Let's create a simple blink sketch that will blink the four STATUS LEDs on the Opta, highlighted in the image below.
52-
All the STATUS LEDs on the device are defined in the core of the PLC.
53-
Hereafter you can see the correspondence between each of them as identified in the core and their labeling on the front panel of the product:
54-
55-
LED_D0 --> STATUS 1
5654

57-
LED_D1 --> STATUS 2
58-
59-
LED_D2 --> STATUS 3
60-
61-
LED_D3 --> STATUS 4
55+
![The blinking LEDs on the Opta](assets/opta-device-LED.png)
6256

63-
LED_RESET --> LED above the reset button
57+
All the STATUS LEDs on the device are defined in the core of the PLC.
58+
Hereafter you can see the correspondence between each of them as identified in the core and their labeling on the front panel of the product:
6459

65-
LED_USER --> LED above the user button (only available on Opta WiFi (AFX00002))
60+
- `LED_D0`: STATUS 1
61+
- `LED_D1`: STATUS 2
62+
- `LED_D2`: STATUS 3
63+
- `LED_D3`: STATUS 4
64+
- `LED_RESET`: LED above the reset button
65+
- `LED_USER`: LED above the user button (only available on Opta WiFi (AFX00002))
6666

6767
Select the correct **board** and **port** in the **Tools** section.
6868
Copy the sketch below into the Arduino IDE sketch editor, then upload it to Opta.
@@ -97,16 +97,15 @@ void loop() {
9797
digitalWrite(LED_D3, LOW);
9898
delay(500);
9999
}
100-
101-
![The blinking LEDs on the Opta](assets/opta-device-LED.png)
100+
```
102101

103102
### Configuring the Programmable Button on the Opta
104103

105-
Opta has a programmable button, shown on the image below and identified as USER. It can be programmed using the Arduino IDE to fit your needs.
106-
To show how much simple is to use it, let's create a sketch and program the button as a trigger to modify the status of the STATUS LEDs.
107-
The button is defined in the core as `BTN_USER`: 'HIGH' as default (not pressed), and 'LOW' when pressed.
108-
The new sketch will turn on one by one the LEDs when the button is pressed, and then start over when all the lights have been turned on.
109-
Below you can find the entire sketch, where a simple [Switch (case) Statement](https://www.arduino.cc/reference/en/language/structure/control-structure/switchcase/) is used, and an image highlighting where the USER button is located on the device.
104+
Opta has a programmable button, shown on the image below and identified as USER. It can be programmed using the Arduino IDE to fit your needs. To show how much simple is to use it, let's create a sketch and program the button as a trigger to modify the status of the STATUS LEDs.
105+
106+
![The button and LEDs that will light up on the Opta](assets/opta-device-button.png)
107+
108+
The button is defined in the core as `BTN_USER`: 'HIGH' as default (not pressed), and 'LOW' when pressed. The new sketch will turn on one by one the LEDs when the button is pressed, and then start over when all the lights have been turned on. Below you can find the entire sketch, where a simple [Switch (case) Statement](https://www.arduino.cc/reference/en/language/structure/control-structure/switchcase/) is used, and an image highlighting where the USER button is located on the device.
110109

111110
```arduino
112111
int buttonState = 0;
@@ -159,40 +158,36 @@ void changeLights() {
159158
}
160159
delay(100);
161160
}
162-
163-
![The button and LEDs that will light up on the Opta](assets/opta-device-button.png)
161+
```
164162

165163
Once the sketch is uploaded, you can see that an additional LED is turned on each time you press the button, following the sequence:
166164

167-
First press --> LED 1 ON.
168-
169-
Second press --> LEDs 1 and 2 ON.
170-
171-
Third press --> LEDS 1, 2 and 3 ON.
172-
173-
Fourth press --> LEDS 1, 2, 3 and 4 ON.
174-
175-
Fifth press --> All leds off and back.
165+
| Interaction | Result |
166+
| ------------ | ---------------------- |
167+
| First press | LED 1 ON. |
168+
| Second press | LEDs 1 and 2 ON. |
169+
| Third press | LEDS 1, 2 and 3 ON. |
170+
| Fourth press | LEDS 1, 2, 3 and 4 ON. |
171+
| Fifth press | All leds off and back. |
176172

177173

178174
### Using Out Relays
179175

180-
Opta has 4 outputs, consisting of 4 electromechanical relays NO (SPST) with a capacity of 10 A at 250 V AC (considering a resistive load). They are identified as OUTPUTS and located on the bottom of Opta as shown in the image. They correspond to pins D0 to D3 as follows:
181-
The outputs correspond to pins D0 to D3 as follows:
182-
OUTPUT 1 --> D0
176+
Opta has 4 outputs, consisting of 4 electromechanical relays NO (SPST) with a capacity of 10A at 250V AC (considering a resistive load). They are identified as OUTPUTS and located on the bottom of Opta as shown in the image below.
183177

184-
OUTPUT 2 --> D1
185-
186-
OUTPUT 3 --> D3
178+
![Out relays on the Opta](assets/opta-out-relays.png)
187179

188-
OUTPUT 4 --> D4
180+
The outputs correspond to pins D0 to D3 as follows:
189181

190-
![Out relays on the Opta](assets/opta-out-relays.png)
182+
| Output | Pin |
183+
| -------- | --- |
184+
| OUTPUT 1 | D0 |
185+
| OUTPUT 2 | D1 |
186+
| OUTPUT 3 | D3 |
187+
| OUTPUT 4 | D4 |
191188

192189
The OPTA output contacts are "clean" contacts, which means they are contacts that are not alive in a "non-connection" situation. This type of contact can be used in any system and with any type of voltage. To properly function, the outputs must therefore be connected by bringing for example a power cable to one of the terminals and connecting the load to the exit of the other terminal.
193190

194-
![Clean contact on the Opta](assets/opta-clean-contact.png)
195-
196191
This way, when the contact is closed by the logic set in the programming, the power supply signal will cross the contact carring the signal up to the reference load.
197192

198193
The “clean” contact also allows carrying a different power system or type of load for each output contact, being possible to control multiple devices or signals that use different voltage levels.
@@ -331,19 +326,20 @@ void loop() {
331326
332327
delay(1000);
333328
}
329+
```
334330

335331
Once you have uploaded the code, open the serial monitor to see the values read in each analog input. Ig you have connected a device with an analog voltage value in I1, I2, and/or I3 you will see the voltage or analog value of each of the signals. In case you did not connect anything to the analog inputs, you will see how the values oscillate between 0V and a very small value because the pins are floating.
336332

337333
You may notice from the output values that when the maximum value of 10V is reached, the corresponding numerical value is not 4095 as the maximum value with 12 bits resolution should be. The reason is that there is a precautional margin taken on the maximum voltage level applicable to the inputs to preserve the integrity of the microcontroller.
338334

339335
### Connecting Opta to the Cloud
340336

341-
It is possible to use the Opta with the Arduino Cloud. To set up the Opta to the cloud go to the [Arduino Cloud](https://cloud.arduino.cc/). For help with how to get started with the cloud, go to our [Getting started with the cloud tutorial](https://docs.arduino.cc/arduino-cloud/getting-started/iot-cloud-getting-started). We also have a number of other helpful tutorials for [the Arduino cloud](https://docs.arduino.cc/arduino-cloud/).
337+
It is possible to use the Opta with the Arduino Cloud. To set up the Opta to the cloud go to the [Arduino Cloud](https://cloud.arduino.cc/). For help with how to get started with the cloud, go to our [Getting started with the cloud](https://docs.arduino.cc/arduino-cloud/getting-started/iot-cloud-getting-started) tutorial. We also have a number of other helpful tutorials for [the Arduino cloud](https://docs.arduino.cc/arduino-cloud/).
342338

343339
## Conclusion
344340

345341
This tutorial went through the basics of the Opta. Now you should know how to program the LEDs on the board. We also showed how to program the programmable button on the device. The analog inputs and the out relays were also covered. After going through this tutorial you should be ready to go into the other Opta tutorials and learn more about the device and its features.
346342

347343
### Next Steps
348344

349-
Now that you know the basics of the Opta it could be a good idea to combine these features with other features on the Opta. For example, if you want to add connectivity to your solution, take a look at the [Getting started with connectivity on the Opta tutorial]().
345+
Now that you know the basics of the Opta it could be a good idea to combine these features with other features on the Opta. For example, if you want to add connectivity to your solution, take a look at the [Getting started with connectivity on the Opta tutorial](/tutorials/opta/getting-started-connectivity).

0 commit comments

Comments
 (0)