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
This tutorial demonstrates the integration of Arduino Opta with Azure IoT. You will proceed to create a reliable and secure IoT environment, harnessing the power of these two technologies.
20
+
This tutorial demonstrates the integration of Opta™ with Azure IoT. You will proceed to create a reliable and secure IoT environment, harnessing the power of these two technologies.
23
21
24
22
## Goals
25
23
26
-
-**Initial Configuration:** Guide the user through the initial setup steps for Azure IoT and IoT Hub to establish a connection between Arduino Opta and Azure IoT.
24
+
-**Initial Configuration:** Guide the user through the initial setup steps for Azure IoT and IoT Hub to establish a connection between Opta™ and Azure IoT.
27
25
28
-
-**Reliable Transmission:** How to reliably transmit data from Arduino Opta to Azure IoT.
26
+
-**Reliable Transmission:** How to reliably transmit data from Opta™ to Azure IoT.
29
27
30
28
## Required Hardware and Software
31
29
@@ -67,7 +65,7 @@ Open the Library Manager from the menu **Sketch->Include Library->Manage Librari
67
65
68
66
Search for the "Azure SDK for C" library using the Library Manager's search feature.
Among the search results, the resource we're interested in, IoT Hub, will appear as the first result. Click on **Create** to start creating your IoT Hub.

110
108
111
109
After entering all the necessary information, you can click on **Review + create**, skipping the other configurations.
112
110
113
111
A final summary prompts you to check that the entered information is correct, after which you can click on **Create** to complete the Hub creation and move on to the next steps.
Now you can add a device to your Hub; the new device will allow the connection to your Arduino Opta. To add a new device, click on **Devices** under the **Device management** section on the left side of your Hub.
129
+
Now you can add a device to your Hub; the new device will allow the connection to your Opta™. To add a new device, click on **Devices** under the **Device management** section on the left side of your Hub.

148
146
149
-
Click on the name of the newly created device in the list of devices associated with your Hub. The device configuration page will be displayed. You don't need to make any changes to this page, but you will need to use the information provided on this page in the sketch to be uploaded to Arduino Opta.
147
+
Click on the name of the newly created device in the list of devices associated with your Hub. The device configuration page will be displayed. You don't need to make any changes to this page, but you will need to use the information provided on this page in the sketch to be uploaded to Opta™.
150
148
151
149
From the current page, the only information needed for the configuration is the **Device ID** and the **Primary key**. Once requested, you can easily copy them using the 'Copy' button next to each corresponding field.
The next step of the tutorial is dedicated to customizing and understanding the sample code.
158
154
159
155
## Sketch
160
156
161
157
### Introduction
162
158
163
-
In this section, some parts of the sample code provided by Microsoft are analyzed and explained, modified to be used correctly on Arduino Opta.
159
+
In this section, some parts of the sample code provided by Microsoft are analyzed and explained, modified to be used correctly on Opta™.
164
160
165
161
The original project example can be found in the official library repository, accessible from [this page](https://github.com/Azure/azure-sdk-for-c-arduino/blob/main/examples/Azure_IoT_Hub_PortentaH7/Azure_IoT_Hub_PortentaH7.ino).
166
162
167
-
The example modified for Arduino Opta is available [here](assets/opta-azure-iot-tutorial-sketch.zip).
163
+
The example modified for Opta™ is available [here](assets/opta-azure-iot-tutorial-sketch.zip).
168
164
169
165
### Sketch Configuration for Connection
170
166
171
-
To establish a connection to Azure IoT, you don't need to make many changes to your sketch. All the configurations necessary to make the transmission of data from Arduino Opta to the Microsoft cloud work are enclosed in a few lines of code.
167
+
To establish a connection to Azure IoT, you don't need to make any changes to your sketch. All the configurations necessary to make the transmission of data from Opta™ to the Microsoft cloud work are enclosed in a few lines of code.
172
168
173
169
In particular, the information to be customized for the connection is represented by various **#define** in the **iot_configs.h** file.
You will need some of the information present on the device configuration page on Azure. As mentioned earlier, you can copy the necessary information and modify the code accordingly:
178
174
179
-
```cpp
175
+
```arduino
180
176
// Wifi
181
177
#define IOT_CONFIG_WIFI_SSID "MyWifi" // Change it to your Wi-Fi network name
182
178
#define IOT_CONFIG_WIFI_PASSWORD "12345678" // Change it to your Wi-Fi network password
@@ -192,32 +188,32 @@ The **IOT_CONFIG_WIFI_SSID** definition assumes the value of your Wi-Fi network'
192
188
193
189
Note that **IOT_CONFIG_IOTHUB_FQDN** contains the hostname, easily obtainable by copying the name of your IoT Hub. In the context of this tutorial, the chosen name is **MyOptaHub**.
194
190
195
-
The hostname that facilitates the connection of Arduino Opta to Azure IoT is consistently **azure-devices.net**. You will need to add the name of your hub before this hostname as follows: **MyHubID.azure-devices.net**. Consequently, for this tutorial, it becomes **MyOptaHub.azure-devices.net**.
191
+
The hostname that facilitates the connection of Opta™ to Azure IoT is consistently **azure-devices.net**. You will need to add the name of your hub before this hostname as follows: **MyHubID.azure-devices.net**. Consequently, for this tutorial, it becomes **MyOptaHub.azure-devices.net**.
196
192
197
193
The **IOT_CONFIG_DEVICE_ID** definition specifies the device identifier, and for this tutorial, **MyOpta** was selected.
198
194
199
195
Finally, **IOT_CONFIG_DEVICE_KEY** requires entering the device's private key.
200
196
201
197
### Other Code Customizations
202
198
203
-
In the **iot_configs.h** file, you find a definition that allows indicating in milliseconds the time that must elapse between sending one telemetry message and the next. The relevant definition is **IOT_CONFIG_TELEMETRY_FREQUENCY_MS** at line 19.
199
+
In the **iot_configs.h** file, you find a definition that allows indicating in milliseconds the time that must elapse between sending one telemetry message and the next. The relevant definition is **IOT_CONFIG_TELEMETRY_FREQUENCY_MS**on line 19.
204
200
205
-
In the code, it is set to 300,000 milliseconds, or 5 minutes:
201
+
In the code, it is set to 300,000 milliseconds or 5 minutes:
You can customize the value in milliseconds to change the time interval between sending messages.
214
210
215
211
In the **Azure_IoT_Hub_Opta.ino** file, you find a portion of code represented by the **generateTelemetry()** function at line 329, which is called to allow sending the message to Azure IoT:
If the modifications made to the code meet your requirements, you can upload the code to your Arduino Opta and check if a message confirming the successful sending of telemetry data is displayed in the serial monitor:
246
+
If the modifications made to the code meet your requirements, you can upload the code to your Opta™ and check if a message confirming the successful sending of telemetry data is displayed in the serial monitor:

257
253
258
254
### Conclusion
259
255
260
-
In conclusion to this tutorial, we have explored and customized a sample sketch provided by Microsoft to enable the connection of Arduino Opta to Azure IoT. Here's a summary of the activities performed:
256
+
In conclusion to this tutorial, we have explored and customized a sample sketch provided by Microsoft to enable the connection of Opta™ to Azure IoT. Here's a summary of the activities performed:
261
257
262
258
-**Analysis of the Sample Sketch:** We examined a sample sketch provided by Microsoft for connecting to Azure IoT, available in the official library repository.
263
-
-**Modifications for Arduino Opta:** We made the necessary changes to the sketch to adapt it and use it correctly with Arduino Opta, customizing definitions and configurations.
259
+
-**Modifications for Opta™:** We made the necessary changes to the sketch to adapt it and use it correctly with Opta™, customizing definitions and configurations.
264
260
-**Azure IoT Configuration:** We explained how to obtain the necessary information from the device configuration on Azure IoT, including the hostname of your hub and the device key.
265
261
-**Integration with Azure IoT Hub:** We illustrated the process of configuring the definitions in the `iot_configs.h` file, which manages Wi-Fi connection and communication with Azure IoT Hub.
266
262
-**Code Customizations:** We provided guidance on further customizing the code, including adjusting the telemetry message sending interval and modifying the simulated data sent to Azure IoT.
267
263
268
-
The tutorial provides a detailed guide to connect Arduino Opta to Azure IoT, allowing the secure and reliable transmission of data. This is just a starting point, and further customizations can be made based on the specific needs of the project. Hoping that this tutorial has been helpful and has contributed to understanding the integration of Arduino Opta with Azure IoT.
264
+
The tutorial provides a detailed guide to connect Opta™ to Azure IoT, allowing the secure and reliable transmission of data. This is just a starting point, and further customizations can be made based on the specific needs of the project. In case you want to dig deeper into the Azure IoT technology, check the [Azure IoT official documentation](https://learn.microsoft.com/en-us/azure/iot/).fSA
0 commit comments