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
Copy file name to clipboardExpand all lines: content/arduino-cloud/00.guides/03.micropython/content.md
+18-3Lines changed: 18 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,8 +61,8 @@ Next step is to create some cloud variables, which we will later interact with v
61
61
4. Create another variable, name it `ledSwitch` and select it to be `int` type.
62
62
63
63
You should now have **two variables**:
64
-
-`test_switch`
65
-
-`test_value`
64
+
-`led` - boolean
65
+
-`ledSwitch` - boolean
66
66
67
67
It is important that they are named exactly like this, as we will be using them in the example script of this guide.
68
68
@@ -72,8 +72,23 @@ Your Thing should look something like this when you are finished:
72
72
73
73
***Learn more about how variables work in the [Variables documentation](/arduino-cloud/cloud-interface/variables)***
74
74
75
+
### Create Dashboard
76
+
77
+
When finished with creating your Thing, we also need to create a dashboard, a tool to monitor & interact with the cloud variables.
78
+
79
+
1. Go to the [dashboards](app.arduino.cc/dashboards) section, and **create a new dashboard.**
80
+
2. In the dashboard, first create a **LED** widget, and link it to the `led` variable we created earlier.
81
+
3. Create a **Switch** widget, and link it to `ledSwitch`.
82
+
4. You should now have two widgets, looking something like the image below:
83
+
84
+

85
+
86
+
We are now finished with the Arduino Cloud configuration, and we can proceed with the MicroPython setup.
87
+
75
88
## MicroPython Setup
76
89
90
+
In this section, we will install the [Arduino IoT Cloud Python](https://pypi.org/project/arduino-iot-cloud/) library on the Arduino board, and run a script that synchronizes the board with the Arduino Cloud.
91
+
77
92
### Create Secret.py File
78
93
79
94
During the [device configuration](#thing--device-configuration), you obtained a **device ID** and **secret key**. These details can be stored, along with your Wi-Fi® credentials, in a `secrets.py` file. Here is an example of how `secrets.py` should look like:
@@ -190,7 +205,7 @@ if __name__ == "__main__":
190
205
191
206
## Testing It Out
192
207
193
-
Open Arduino Lab for MicroPython and connect to your board. Pasting the above code and run the script. Then open your Arduino IoT Cloud dashboard. You should see the registered "ledSwitch" and "led" widgets. Toggle the "ledSwitch", and the LED on your Arduino board should light up accordingly. The state of the "led" variable should also change, mirroring the state of the physical LED.
208
+
Open Arduino Lab for MicroPython and connect to your board. Pasting the above code and run the script. Then open your Arduino Cloud dashboard. You should see the registered "ledSwitch" and "led" widgets. Toggle the "ledSwitch", and the LED on your Arduino board should light up accordingly. The state of the "led" variable should also change, mirroring the state of the physical LED.
Copy file name to clipboardExpand all lines: content/arduino-cloud/00.guides/04.python/python.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: 'Python'
3
-
description: 'Learn how to use the Python library to connect to the Arduino IoT Cloud.'
3
+
description: 'Learn how to use the Python library to connect to the Arduino Cloud.'
4
4
tags:
5
5
- IoT
6
6
- Python
@@ -45,6 +45,8 @@ To begin with, we need to create a manual device, and create a new [Thing](/ardu
45
45
3. Click on **"Set Up New Device"**, and select the bottom category (**"Manual Device"**). Click continue in the next window, and choose a name for your device.
46
46
4. Finally, you will see a new **Device ID** and a **Secret Key** generate. You can download them as a PDF. Make sure to save it as you cannot access your Secret Key again.
47
47
48
+

49
+
48
50
- Learn more about Things in the [Things documentation](/arduino-cloud/cloud-interface/things)
49
51
- Learn more about Devices in the [Devices documentation](/arduino-cloud/hardware/devices)
50
52
@@ -59,6 +61,8 @@ Next step is to create some cloud variables, which we will later interact with v
59
61
60
62
You should now have **two variables**, `test_switch` and `test_value`. It is important that they are named exactly like this, as we will be using them in the example script of this guide.
61
63
64
+

65
+
62
66
- Learn more about how variables work in the [Variables documentation](/arduino-cloud/cloud-interface/variables)
63
67
64
68
***Variables that we create here can also be synchronized with variables running on any other device in the platform. This makes it possible to link an Arduino boards with a Python or JavaScript project without writing any connection code!***
@@ -74,7 +78,7 @@ python3 --version
74
78
75
79
### Install Packages
76
80
77
-
To install the [arduino-iot-cloud] client, run the following command:
81
+
To install the Arduino IoT Cloud Python client, run the following command:
Copy file name to clipboardExpand all lines: content/arduino-cloud/00.guides/05.javascript/javascript.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,8 @@ To begin with, we need to create a manual device, and create a new [Thing](/ardu
37
37
3. Click on **"Set Up New Device"**, and select the bottom category (**"Manual Device"**). Click continue in the next window, and choose a name for your device.
38
38
4. Finally, you will see a new **Device ID** and a **Secret Key** generate. You can download them as a PDF. Make sure to save it as you cannot access your Secret Key again.
39
39
40
+

41
+
40
42
- Learn more about Things in the [Things documentation](/arduino-cloud/cloud-interface/things)
41
43
- Learn more about Devices in the [Devices documentation](/arduino-cloud/hardware/devices)
42
44
@@ -50,6 +52,8 @@ Next step is to create a cloud variable, which we will later interact with in ou
50
52
51
53
You should now have a variable named `test_value`. It is important that it is named exactly like this, as we will be using it in the example script of this guide.
52
54
55
+

56
+
53
57
- Learn more about how variables work in the [Variables documentation](/arduino-cloud/cloud-interface/variables)
54
58
55
59
***Variables that we create here can also be synchronized with variables running on any other device in the platform. This makes it possible to link an Arduino boards with a Python or JavaScript project without writing any connection code!***
Copy file name to clipboardExpand all lines: content/arduino-cloud/00.guides/06.node-red/nodered-intro.md
+20-20Lines changed: 20 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,17 +13,17 @@ author: 'Liam Aljundi'
13
13
14
14
Node-RED is a programming tool for connecting hardware devices such as Arduino with other hardware devices, APIs, and online services easily using a web-based flow editor. It allows you to connect those different devices and services by connecting a combination of nodes that create your desired flow.
15
15
16
-
In this tutorial, we will look into the applications of using Node-RED together with the Arduino IoT Cloud. The integration of the two platforms allows us to facilitate communications between the Arduino IoT Cloud and home automation devices, send and receive data from online services such as Email and SMS, and write JavaScript code to manipulate the data.
16
+
In this tutorial, we will look into the applications of using Node-RED together with the Arduino Cloud. The integration of the two platforms allows us to facilitate communications between the Arduino Cloud and home automation devices, send and receive data from online services such as Email and SMS, and write JavaScript code to manipulate the data.
17
17
18
-
***Note: this tutorial requires a [subscription to the Arduino IoT Cloud](https://cloud.arduino.cc/plans), all three subscriptions (Entry, Maker & Maker Plus) are valid.***
18
+
***Note: this tutorial requires a [subscription to the Arduino Cloud](https://cloud.arduino.cc/plans), all three subscriptions (Entry, Maker & Maker Plus) are valid.***
19
19
20
20
## Goals
21
21
22
-
- Set up Node-RED with the Arduino IoT Cloud.
22
+
- Set up Node-RED with the Arduino Cloud.
23
23
- Use simple Flows with Node-RED.
24
-
- Build a Node-RED Flow that pulls data from Arduino IoT Cloud.
25
-
- Manipulate data received from the Arduino IoT Cloud using JavaScript code.
26
-
- Send email notifications with data from the Arduino IoT Cloud.
24
+
- Build a Node-RED Flow that pulls data from Arduino Cloud.
25
+
- Manipulate data received from the Arduino Cloud using JavaScript code.
26
+
- Send email notifications with data from the Arduino Cloud.
27
27
28
28
## Hardware & Software Requirements
29
29
@@ -33,7 +33,7 @@ In this tutorial, we will look into the applications of using Node-RED together
33
33
34
34
For this tutorial, you will need a cloud compatible board. You will find all compatible boards in the link below:
@@ -107,7 +107,7 @@ You can run the simple flow shown below using Node-RED's default nodes:
107
107
108
108
Your message should be printed to the console on the right side.
109
109
110
-
In addition to the default nodes installed in node-RED, you can use the palette manager to install additional nodes that can be useful to creating more advanced flows. Follow the steps below to install the Arduino IoT Cloud nodes using the palette manager:
110
+
In addition to the default nodes installed in node-RED, you can use the palette manager to install additional nodes that can be useful to creating more advanced flows. Follow the steps below to install the Arduino Cloud nodes using the palette manager:
111
111
112
112
**1.** Click on the menu in the header bar in the top right corner.
113
113
@@ -119,17 +119,17 @@ In addition to the default nodes installed in node-RED, you can use the palette
119
119
120
120
**5.** From the results, install **"@arduino/node-red-contrib-arduino-iot-cloud"**.
121
121
122
-

122
+

123
123
124
-
Now, you should be able to use the Arduino IoT Cloud nodes from the palette on the left side of the editor. There are five IoT Cloud nodes: property in, property out, historic, periodic, and inject. Each of the nodes has a description of its function, which appears when you hover over the node.
124
+
Now, you should be able to use the Arduino Cloud nodes from the palette on the left side of the editor. There are five IoT Cloud nodes: property in, property out, historic, periodic, and inject. Each of the nodes has a description of its function, which appears when you hover over the node.
125
125
126
126
## Setting Up a Thing
127
127
128
128
The Thing we will create for this example is quite simple. It is a sketch to read humidity values from a **DHT11 humidity sensor**, any other values can be used alternatively, such as temperature, soil moisture, light etc. Keep in mind that the code and example below are specific to using the DHT11 humidity sensor.
129
129
130
130
Follow the steps below to set up the Thing:
131
131
132
-
- Go to the Arduino IoT Cloud -> Thing -> Create a Thing
132
+
- Go to the Arduino Cloud -> Thing -> Create a Thing
133
133
- Add your Device and your Network credentials
134
134
- Add an integer Variable, with the name humidity, and set permissions to Read Only
135
135
- Go to the **"Sketch"** tab and replace the code with the code below:
@@ -153,7 +153,7 @@ Follow the steps below to set up the Thing:
@@ -179,15 +179,15 @@ The final step is connecting the **DHT11 humidity sensor** to our Arduino MKR Wi
179
179
180
180
## Communicating with Node-RED
181
181
182
-
Use the steps below to use Node-RED with the Arduino IoT Cloud:
182
+
Use the steps below to use Node-RED with the Arduino Cloud:
183
183
184
184
**1.** Go to the [API keys section](app.arduino.cc/home/api-keys), and create a new API key.
185
185
186
186
**2.** Save the Client ID and Client Secret in a safe document
187
187
188
188
**3.** Go to Node-RED web page at [http://localhost:1880](http://localhost:1880)
189
189
190
-
**4.** Add the Arduino IoT Cloud "**property out**" node from the palette menu on the left side
190
+
**4.** Add the Arduino Cloud "**property out**" node from the palette menu on the left side
191
191
192
192
**5.** Double click on the node -> select "Add new Arduino-connection"
193
193
@@ -201,11 +201,11 @@ Use the steps below to use Node-RED with the Arduino IoT Cloud:
201
201
202
202
### Creating a Flow
203
203
204
-
Now that you have a node pulling data from the Arduino IoT Cloud, you need to use the *Inject* node in order to manipulate and send the data. All you need to do is dragging the *Inject* node and connect it to the property out node, then double-clicking on the inject node to ensure that the right Thing and property are selected.
204
+
Now that you have a node pulling data from the Arduino Cloud, you need to use the *Inject* node in order to manipulate and send the data. All you need to do is dragging the *Inject* node and connect it to the property out node, then double-clicking on the inject node to ensure that the right Thing and property are selected.
205
205
206
-
Finally, we will add a debug node from the top of the palette menu, to print the values coming from the Arduino IoT Cloud into the console. You will now be able to see the values from the humidity sensor printed into the Node-RED console.
206
+
Finally, we will add a debug node from the top of the palette menu, to print the values coming from the Arduino Cloud into the console. You will now be able to see the values from the humidity sensor printed into the Node-RED console.
207
207
208
-
The next step is adding a **function node** that processes the data coming from the Arduino IoT Cloud. This node is important when working with a constant flow of data, as it allows you to use JavaScript code to create customized triggers from the received values. After dragging the function node into the editor, double-click on the node and select **"on message"** tab, then insert the code below:
208
+
The next step is adding a **function node** that processes the data coming from the Arduino Cloud. This node is important when working with a constant flow of data, as it allows you to use JavaScript code to create customized triggers from the received values. After dragging the function node into the editor, double-click on the node and select **"on message"** tab, then insert the code below:
209
209
210
210
```js
211
211
let data =msg.payload;
@@ -233,7 +233,7 @@ This code will only send values when they are above 60, or when they change back
233
233
234
234
### Sending Email Notifications
235
235
236
-
Now that you are able to pull and manipulate data from the Arduino IoT Cloud, it's time to use this data. In this example, we will show how to send alarm notifications to your email, using the Arduino IoT Cloud. To achieve this, we need to add an email nodes following the steps below:
236
+
Now that you are able to pull and manipulate data from the Arduino Cloud, it's time to use this data. In this example, we will show how to send alarm notifications to your email, using the Arduino Cloud. To achieve this, we need to add an email nodes following the steps below:
237
237
238
238
- Click on the menu in the header bar in the top right corner.
239
239
- Select **"Manage palette"**.
@@ -245,8 +245,8 @@ Next, drag the email node from the palette menu on the left side into the editor
245
245
246
246

247
247
248
-
Now, all you need to do is replace the debug node with the email node to receive email notifications with the humidity data received from the Arduino IoT Cloud. You can customize the emails using the function node if you wish.
248
+
Now, all you need to do is replace the debug node with the email node to receive email notifications with the humidity data received from the Arduino Cloud. You can customize the emails using the function node if you wish.
249
249
250
250
## Further Applications
251
251
252
-
In this tutorial we demonstrated how you can use the [Arduino IoT Cloud](https://create.arduino.cc/iot/) together with [Node-RED](https://nodered.org/) to build a more complex automation applications. The email notification is only one of the many different use cases, other applications can be creating communication between the Arduino IoT Cloud to other home automation devices, sending customized SMS and WhatsApp messages, and many more.
252
+
In this tutorial we demonstrated how you can use the [Arduino Cloud](app.arduino.cc) together with [Node-RED](https://nodered.org/) to build a more complex automation applications. The email notification is only one of the many different use cases, other applications can be creating communication between the Arduino Cloud to other home automation devices, sending customized SMS and WhatsApp messages, and many more.
0 commit comments