Skip to content

Commit 5fe2ba7

Browse files
authored
Merge pull request #2691 from arduino/karlsoderby/unoq-cloud
[PXCT-1507] UNO Q with Arduino Cloud
2 parents 380bffc + bff3bb3 commit 5fe2ba7

File tree

9 files changed

+87
-0
lines changed

9 files changed

+87
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
title: Connect UNO Q to the Arduino Cloud
3+
description: Learn how to connect the UNO Q to the Arduino Cloud
4+
tags: [UNO Q, Arduino Cloud, IoT]
5+
author: Karl Söderby
6+
---
7+
8+
The [Arduino® UNO Q](https://store.arduino.cc/products/uno-q) is supported by the [Arduino Cloud](https://app.arduino.cc/), allowing it to send and receive data over the Internet. Note that the UNO Q requires the [Arduino App Lab](https://docs.arduino.cc/software/app-lab/) to be programmed, which includes the ready-made example that this tutorial is based on.
9+
10+
The communication with Arduino Cloud is enabled by the UNO Q's microprocessor (MPU) and Wi-Fi® module, and is programmed using Python. Data to and from the Microcontroller (MCU) is handled via the [Bridge](/software/app-lab/tutorials/getting-started/#bridge-tool) tool.
11+
12+
***Currently the UNO Q is set up using the "Manual Device" flow in the Arduino Cloud, using the `SECRET_KEY` and `DEVICE_ID` variables in a Python script running on the board.***
13+
14+
## Goals
15+
16+
In this tutorial, you will learn:
17+
- How to set up the Arduino Cloud.
18+
- How to create a manual device (representing the UNO Q).
19+
- How to turn on an LED on the UNO Q from a dashboard in the Arduino Cloud.
20+
21+
## Hardware & Software Needed
22+
23+
- [Arduino® UNO Q](https://store.arduino.cc/products/uno-q)
24+
- An [Arduino Cloud account](https://login.arduino.cc/login)
25+
- [Arduino App Lab](https://www.arduino.cc/en/software)
26+
27+
## Set up Arduino Cloud
28+
29+
First, we need to set up the Arduino Cloud part, including:
30+
- Creating a Device (manual device type)
31+
- Creating a Thing and a cloud variable
32+
- Creating a dashboard and a widget
33+
34+
To set this up, follow the instructions below:
35+
36+
1. Navigate to the [Arduino Cloud](https://app.arduino.cc/) page and log in / create an account.
37+
2. Go to the [devices](https://app.arduino.cc/devices) page and create a device, selecting the "manual device" type. Follow the instructions and take note of the **device_id** and **secret_key** provided in the setup.
38+
![Arduino Cloud credentials](assets/cloud-blink-device.png)
39+
3. Go to the [things](https://app.arduino.cc/things) page and create a new thing.
40+
4. Inside the thing, create a new **boolean** variable, and name it **"led"**. We also need to associate the device we created with this thing.
41+
![Arduino Cloud thing](assets/cloud-blink-thing.png)
42+
5. Finally, navigate to the [dashboards](https://app.arduino.cc/dashboards), and create a dashboard. Inside the dashboard, click on **"Edit"**, and select the thing we just created. This will automatically assign a switch widget to the **led** variable.
43+
![Arduino Cloud dashboard](assets/cloud-blink-dashboard.png)
44+
45+
## Program the UNO Q (Cloud Example)
46+
47+
To program the UNO Q, we need to use the Arduino App Lab. The example we are going to use is included in the Arduino App Lab.
48+
49+
***If you are new to the UNO Q, you can check out the [Getting Started with Arduino App Lab](https://docs.arduino.cc/software/app-lab/tutorials/getting-started/) guide***
50+
51+
1. Open the Arduino App Lab and connect (using USB / network option).
52+
2. Open the **"Examples"** tab in the left side menu. Here you will find the **"Blinking LED from Arduino Cloud"** example.
53+
3. Duplicate the example by clicking on **"Copy and edit app"** button in the top right corner
54+
![Duplicate example](assets/cloud-blink-duplicate.png)
55+
56+
4. On the App page, click on the **"Arduino Cloud"** Brick, then click on the **"Brick Configuration"** button.
57+
![Open Arduino Cloud Brick](assets/cloud-blink-creds.png)
58+
59+
5. Enter the cloud credentials (device ID and secret key), replacing the `<YOUR_DEVICE_ID>` and `<YOUR_SECRET>` values. These are the ones retrieved in the Arduino Cloud (previous section).
60+
61+
![Add cloud credentials](assets/cloud-blink-creds-2.png)
62+
63+
6. Launch the App by clicking on the "Play" button in the top right corner. Wait until the App has launched.
64+
![Launching an App](assets/launch-app-cloud-blink.png)
65+
66+
## Testing the Cloud Connection
67+
68+
The example works by establishing a connection between the Arduino Cloud and the UNO Q board. When interacting with the dashboard's switch widget (turn ON/OFF), the cloud updates the `led` variable.
69+
70+
The `main.py` script running on the Linux system listens for changes to this property using the `arduino_cloud` Brick. When a change is detected, the **Bridge** tool is used to send data to the microcontroller, and turn the LED ON.
71+
72+
The flow of the App is:
73+
1. The switch in the Arduino Cloud dashboard is changed.
74+
2. The Arduino Cloud updates the device's state.
75+
3. `main.py` receives the updated state, sends a message to the microcontroller which turns the LED to an ON/OFF state.
76+
77+
![How the Cloud interacts with UNO Q](assets/cloud-blink.png)
78+
79+
## Summary
80+
81+
In this tutorial, you learned how to connect the UNO Q with the Arduino Cloud. This connection is done by using the **Arduino Cloud Brick** in the Python script running on the UNO Q's MPU.
82+
83+
The data that the Python script receives is then sent to the MCU, which turns on the built-in LED on the board. For this, the [Bridge](/software/app-lab/tutorials/getting-started/#bridge-tool) tool is used.
84+
85+
You can read more about the Arduino Cloud & UNO Q through the links below:
86+
- [Arduino Cloud documentation](/arduino-cloud/)
87+
- [Arduino UNO Q documentation](/hardware/uno-q/)
229 KB
Loading
361 KB
Loading
288 KB
Loading
247 KB
Loading
346 KB
Loading
229 KB
Loading
314 KB
Loading
282 KB
Loading

0 commit comments

Comments
 (0)