Облако для arduino

An intro to the Arduino IoT Cloud

AUTHOR: Liam Aljundi

LAST REVISION: 10/05/2022, 01:00 PM

Using the Arduino IoT Cloud

With the Arduino IoT Cloud desktop or mobile platform, you can quickly connect, manage and monitor your devices from anywhere in the world.

Arduino IoT Cloud allows you to automatically create any code to program your device with — just add a couple of lines to customize it how you want. If you’re new to Arduino don’t worry there’s example code for hundreds of sensors and actuators.

The following steps will guide you to start using the Arduino IoT Cloud:

1. Install the Arduino Create Agent plugin.

2. Check if you have a cloud compatible board. The picture below shows all official Arduino boards that are compatible.

Arduino IoT Cloud compatible boards

Note: The MKR GSM 1400 and MKR NB 1500 require a SIM card to connect to the Cloud, as they communicate over the mobile networks. The MKR WAN 1300 and 1310 board requires a Arduino PRO Gateway LoRa to connect to the cloud.

3. Create an Arduino account by signing up to Arduino.

4. Access the Arduino IoT Cloud from any page on arduino.cc by clicking on the bento menu (9-dots) on the top right corner, or you can go directly to the Arduino IoT Cloud.

Opening the Arduino IoT Cloud

Creating a Thing

1. The user journey always begins by creating a new Thing. In the Thing overview, we can choose what device to use, what Wi-Fi network we want to connect to, and create variables that we can monitor and control.

Arduino IoT Cloud’s interface

2. Next we need to add a device by clicking on the «Select device» button on the Thing overview. Here, we choose from any board that we have already been configured, or select the Configure new device option.

Configuring a new device

3. Now we can add our first variable by clicking on the Add variable button. We can choose name, data type, update the setting and interaction mode for our variable. There are several data types we can choose from, such as int, float, boolean, long, char. There’s also special variables, such as Temperature, Velocity, and Luminance that can be used. The variables we create are automatically generated into a sketch file.

Adding a variable to your sketch

4. Finally, we need to connect to a Wi-Fi network by simply clicking the Configure button in the network section. Enter your network credentials and click Save. This information will also be generated into your sketch file!

Building the Sketch

Now that you are all set up, let’s have a look at the interface!

A special sketch file can now be found in the Sketch tab, which includes all of the configurations that you have made. When the sketch has been uploaded, it will work as a regular sketch, but it will also update the Cloud variables that we use!

Additionally, each time we create a variable that has the Interaction Mode enabled, a function will also be generated. Every time this variable is triggered from the Cloud, it will execute the code within this function! This means that we can leave most of the code out of the loop() and only run code when needed.

When we are happy with our sketch, we can upload it to our board, by clicking the upload button.

Editing a sketch in the cloud editor

After we have successfully uploaded the code, we can open the Serial Monitor tab to view information regarding our connection. If it is successful, it will print connected to network_name and connected to cloud.

If it fails to connect, it will print the errors here as well. Now that we have configured the device & network, created variables, completed the sketch and successfully uploaded the code, we can move on to the fun part, the dashboard!

Creating the dashboard

IoT CLoud Dashboards

Dashboards are visual user interfaces for interacting with your boards over the Cloud, and we can set up many different setups depending on what your IoT project needs.

We can access our dashboards by clicking on the Dashboards tab at the top of the Arduino IoT Cloud interface, where we can create new dashboards, and see a list of dashboards created for other Things.

Navigating to dashboards.

If we click on Create new dashboard, we enter a dashboard editor. Here, we can create something called widgets. Widgets are the visual representation of our variables we create, and there are many different ones to choose from. Below is an example using several types of widgets.

The different widgets available.

When we create widgets, we also need to link them to our variables. This is done by clicking on a widget we create, selecting a Thing, and selecting a variable that we want to link.

Once it is linked, we can either interact with it, for example a button, or we can monitor a value from a sensor. As long as our board is connected to the cloud, the values will update automatically!

Congratulations! Now you are ready to create your own IoT system. You can find more information about the Arduino IoT Cloud here.

Network Configuration

Note: that the Arduino IoT Cloud operates with different domains and ports, which means that if we want devices working with the Arduino IoT Cloud, they need to be allowed access to certain domains through your firewall.

If you are connected to your school or university networks, please provide your admin with the following instructions:

1. Whitelist the following domains and ports in your firewall:

Domain Port
mqtts-up.iot.arduino.cc 8884
mqtts-sa.iot.arduino.cc 8883
wss.iot.arduino.cc 8443

2. Provide NTP access to time.arduino.cc, note that the NTP port for time.arduino.cc is 123 UDP.

If you are having issues connecting to the Arduino IoT Cloud through your home network, follow these instructions:

For Windows users

1. Navigate to your firewall, go to Start > search firewall > open Windows Firewall.

2. Click on Allow a program/app or feature through Windows Firewall.

3. Then open Change Settings.

Источник

Arduino Cloud

Configure, program and connect your devices — all through the Arduino IoT Cloud service.

Getting Started

Getting Started With the Arduino IoT Cloud

The Arduino IoT Cloud is a online platform that makes it easy for you to create, deploy and monitor IoT projects.

Arduino Cloud IoT Cheat Sheet

Learn how to set up the Arduino Cloud IoT, get a quick overview of the compatible boards, the API, configuration, Things, variables and dashboards.

Getting started with the Web Editor

A step-by-step guide to set up your online development environment.

Configuring LoRaWANВ® devices in the Arduino Cloud

Connect your LoRaWANВ® devices to the Arduino Cloud platform via The Things Network.

Connecting ESP32 & ESP8266 to Arduino Cloud IoT

Learn how to send data between an ESP32 / ESP8266 development board and the Arduino Cloud IoT.

IoT Cloud Variables

Learn how to configure and use variables in your Arduino IoT Cloud sketches.

IoT Cloud Dashboards & Widgets

Learn about dashboards and the different widgets that can be used to monitor & control your board.

Arduino Cloud CLI

Get started with the Arduino Cloud CLI, a tool for the automation and mass-deployment of devices.

Arduino Cloud REST API & SDK

Learn how to authenticate with the Arduino IoT Cloud REST API to make requests using HTTP Client, JavaScript and Python.

Features

Arduino IoT Cloud Scheduler Feature

Learn how to use the scheduler feature to trigger repeating jobs during specific times.

Device to device with Arduino IoT Cloud

Learn how to connect two boards through the Arduino IoT Cloud, by syncing their variables.

Thing to Thing communication with Arduino IoT Cloud

Learn how two Things can communicate with each other through variable syncing.

Uploading sketches Over-The-Air (OTA)

Learn how to utilize Over-The-Air (OTA), a feature that allows you to upload sketches remotely.

Learn how to share your dashboards with other Arduino Cloud users.

Webhooks with Arduino IoT Cloud

Learn how to setup webhooks with the Arduino IoT Cloud to work with third party platforms such as IFTTT.

Node-RED with Arduino IoT Cloud

Learn how to use Node-RED together with the Arduino IoT Cloud to create advanced automation systems.

Historical Data on Arduino IoT Cloud

Learn how to download historical data from the Arduino IoT Cloud

Tutorials

Arduino IoT Cloud, MKR RGB Shield and Alexa integration

Learn how to build a smart lamp by integrating the Arduino IoT Cloud and Alexa.

Environmental data in the Arduino IoT Cloud

Learn how to collect environmental data from the MKR ENV Shield and display it in the Arduino IoT Cloud.

Controlling relays from the Arduino IoT Cloud

Learn how to control the relays onboard the MKR Relay Shield through the Arduino IoT Cloud dashboard.

Embedding your sketches into an HTML page

Learn about different methods when embedding your sketches in a website.

Importing files to the Web Editor

Learn how to import your local sketchbook and custom libraries to the Web Editor.

Monitor Your Energy Bill with Modbus and the Arduino IoT Cloud

Connect a Modbus energy meter to an ArduinoВ® MKR WiFi 1010 board and a MKR 485 Shield and monitor the power consumption of your home via an Arduino Cloud IoT dashboard.

Share Your Sketches on the Arduino Web Editor

Learn about different methods you can use to share your Arduino sketches with others.

Store your sensitive data safely when sharing a sketch

Learn how to share sketches without sharing the sensitive data such as Wi-Fi credentials and API keys.

Источник

Getting Started With the Arduino IoT Cloud

AUTHOR: Karl Söderby

LAST REVISION: 10/05/2022, 01:00 PM

Introduction

Connected devices around the world are increasing by billions every year. The Arduino IoT Cloud is a platform that allows anyone to create IoT projects, with a user friendly interface, and an all in one solution for configuration, writing code, uploading and visualization.

In this article, we will take a look at some different components of the Arduino IoT Cloud, and provide a general overview.

But if you’re itching to get started and explore the Arduino IoT Cloud yourself, that is also perfectly fine! You can always come back here for more information!

IoT Cloud Documentation

The Arduino IoT Cloud has several pages of documentation available. Below you will find a list of some popular pages:

To find all tutorials & articles, visit the Arduino IoT Cloud Documentation page.

For a technical overview, list of features, and API guide, visit the Arduino IoT Cloud Cheat Sheet.

For API & SDK Documentation, visit the developer reference at Arduino IoT Cloud API.

Features

Below is a list of Arduino IoT Cloud features.

  • Data Monitoring — learn how to easily monitor your Arduino’s sensor values through a dashboard.
  • Variable Synchronisation — variable synchronisation allows you to sync variables across devices, enabling communication between devices with minimal coding.
  • Scheduler — schedule jobs to go on/off for a specific amount of time (seconds, minutes, hours).
  • Over-The-Air (OTA) Uploads — upload code to devices not connected to your computer.
  • Webhooks — integrate your project with another service, such as IFTTT.
  • Amazon Alexa Support — make your project voice controlled with the Amazon Alexa integration.
  • Dashboard Sharing — share your data with other people around the world.

Compatible Hardware

To use the Arduino IoT Cloud, a cloud compatible board is required. You can choose between using an official Arduino board, or a board based on the ESP32 / ESP8266 microcontroller. The Arduino IoT Cloud currently supports connection via Wi-Fi, LoRaWANВ® (via The Things Network) and mobile networks.

All cloud-compatible Arduino boards come with a hardware secure element (such as the ECC508 cryptochip), where you can store your security keys.

Official Arduino boards only supports the 2.4GHz frequency band for transmitting data.

The following boards connect to the Arduino IoT Cloud via Wi-Fi.

Connection via Wi-Fi is an easy alternative, and your credentials can safely be entered during the configuration of a project. This type of connection is most suitable for low-range projects, where you connect your board to the cloud via your home/work/school router.

LoRaWANВ®

The following boards connect to the Arduino IoT Cloud via The Things Stack, a LoRaWANВ® Network Server connected to thousands of public LoRaВ® gateways.

Connection via LoRaWANВ® is recommended for low-power projects in both remote and urban areas, where Wi-Fi or other popular connectivity types are not available. The MKR WAN 1300/1310 boards are equipped with a LoRa radio module and has a slot for an antenna. With the right low-power configuration, the board can send data to the cloud for months on a single battery.

To learn more about setting up LoRaWANВ® devices, visit the Configuring LoRaWANВ® devices in the Arduino Cloud guide.

GSM / NB-IoT Boards

The MKR GSM 1400 and MKR NB 1500 require a SIM card to connect to the cloud, as they communicate over the mobile networks.

Connection through mobile networks can be considered in remote areas where there’s no Wi-Fi, or in mobile projects (such as cargo tracking).

For more information, visit the Arduino SIM page.

Note that a secured connection is a memory intense operation, so there’s not a lot of memory for the user application (e.g. around 2.6 kB on the MKR GSM 1400). Using a lot of IoT Cloud variables may cause the sketch to run out of memory on boards which don’t offload the SSL stack and make it crash.

ESP32 / ESP8266

The Arduino IoT Cloud supports a wide range of third party boards based on the ESP32 and ESP8266 microcontrollers with support for Wi-Fi. To set them up, simply choose the third party option in the device setup.

Configuring third party boards.

To learn more about ESP32/ESP8266 support and how to set it up, visit the Connecting ESP32 & ESP8266 to Arduino Cloud IoT guide.

Support

If you have any problems with the Arduino IoT Cloud, you can browse through common troubleshooting issues and find information on different features in the Arduino Help Center. If you don’t find the answer you are looking for, we are always happy to help you with any question regarding our products!

A Walk Through the Configuration

Setting up the Arduino IoT Cloud.

Setting up the Arduino IoT Cloud and accessing the different features available involves a few simple steps. So let’s take a look at how to go from start to finish!

1. Creating an Arduino Account

To starting using the Arduino IoT cloud, we first need to log in or sign up to Arduino.

2. Go to the Arduino IoT Cloud

After we have signed up, you can access the Arduino IoT Cloud from any page on arduino.cc by clicking on the four dots menu in the top right corner. You can also go directly to the Arduino IoT Cloud.

Navigating to the cloud.

3. Creating a Thing

The journey always begin by creating a new Thing. In the Thing overview, we can choose what device to use, what Wi-Fi network we want to connect to, and create variables that we can monitor and control. This is the main configuration space, where all changes we make are automatically generated into a special sketch file.

The Thing overview.

4. Configuring a Device

Devices can easily be added and linked to a Thing. The Arduino IoT Cloud requires your computer to have the Arduino Agent installed. The configuration process is quick and easy, and can be done by clicking on the “Select device” button in the Thing overview. Here, we can choose from any board that has been configured, or select the “Configure new device” option.

Configuring a device.

We can also get a complete overview of our devices by clicking the “Devices» tab at the top of the Arduino IoT Cloud interface. Here we can manage and add new devices.

The device tab.

5. Creating Variables

The variables we create are automatically generated into a sketch file. There are several data types we can choose from, such as int, float, boolean, long, char. There’s also special variables, such as Temperature, Velocity, Luminance that can be used. When clicking on the “Add variable” button, we can choose name, data type, update setting and interaction mode.

Creating variables.

6. Connecting to a Network

To connect to a Wi-Fi network, simply click the “Configure” button in the network section. Enter the credentials and click “Save”. This information is also generated into your sketch file!

Entering network credentials.

7. Editing the Sketch

Now that we have configured variables, devices and network settings, we can get to programming our devices!

An automatically generated sketch file can be found in the “Sketch” tab. It has the same structure as a typical file, but with some additional code to make the connection to your network and to the cloud.

A sketch that, for example, reads an analog sensor, and use the cloud variable to store it. When the sketch has been uploaded, it will work as a regular sketch, but it will also update the cloud variables that we use!

Additionally, each time we create a variable that has the Read & Write permission enabled, a function is also generated, at the bottom of your sketch file. Each time this variable changes, it will execute the code within this function! This means that we can leave most of the code out of the loop() and only run code when needed.

To upload the program to our board, simply click the «Upload» button.

Editing a sketch in the cloud editor.

The editor also has a Serial Monitor Tool, which can be opened by clicking the magnifying glass in the toolbar. Here you can view information regarding your connection, or commands printed via .

The Serial Monitor Tool.

After we have successfully uploaded the code, we can open the “Serial Monitor” tab to view information regarding our connection. If it is successful, it will print “connected to network_name” and “connected to cloud”. If it fails to connect, it will print the errors here as well.

The cloud editor is a mirrored «minimal» version of the Web Editor. Any changes you make will also be reflected in the Web Editor, which is more suitable for developing more advanced sketches.

8. Creating a Dashboard

Now that we have configured the device & network, created variables, completed the sketch and successfully uploaded the code, we can move on to the fun part: creating dashboards!

Visualize your data.

Dashboards are visual user interface for interacting with your boards over the cloud, and we can setup many different setups depending on what your IoT project needs. We can access our dashboards by clicking on the “Dashboards” tab at the top of the Arduino IoT Cloud interface, where we can create new dashboards, and see a list of dashboards created for other Things.

Navigating to dashboards.

If we click on “Create new dashboard”, we enter a dashboard editor. Here, we can create something called widgets. Widgets are the visual representation of our variables we create, and there are many different to choose from. Below is an example using several types of widgets.

The different widgets available.

When we create widgets, we also need to link them to our variables. This is done by clicking on a widget we create, select a Thing, and select a variable that we want to link. Once it is linked, we can either interact with it, for example a button, or we can monitor a value from a sensor. As long as our board is connected to the cloud, the values will update!

Let’s say we have a temperature widget that we want to link to the temperature variable inside the Cloud project thing.

Linking a variable to a widget.

Note that not all widgets and variables are compatible. A switch and an integer can for example not be linked, and will not be an option while setting up your dashboard.

We can also have several things running at once, depending on your Arduino IoT Cloud plan, which we can include in the same dashboard. This is a great feature for tracking multiple boards in for example a larger sensor network, where boards can be connected to different networks around the world, but be monitored from the same dashboard.

Congratulations

What will you build?

You are just a few easy steps from deploying your very own IoT project. Having a project connected to the Arduino IoT Cloud opens up many possibilities, such as tracking data in real time, triggering remote devices and building wireless systems.

What will you create?

More tutorials

You can find more tutorials in the Arduino IoT Cloud documentation page.

Источник

Облако для ардуино

Getting started with the Arduino IoT Cloud

Getting started with the Arduino IoT Cloud involves just a few simple steps that are quick and easy to follow! Further down this article, there is a section called A walk through the cloud configuration, which is there to guide you through the Arduino IoT Cloud. But first, let’s take a look at what we need in order to get started.

But if you’re itching to get started and explore the Arduino IoT Cloud yourself, that is also perfectly fine! You can always come back here for more information!

A cloud compatible board (required)

To use the Arduino IoT Cloud, all we need is a cloud compatible board. In the picture below, we can see the full list of boards that are compatible. All of the MKR family boards can be connected to the cloud, and we can also connect the Nano 33 IoT and the Portenta H7 boards to the cloud. If you have the maker plan, you can also configure third party devices through the Manager for Linux service.

Please note: The MKR GSM 1400 and MKR NB 1500 require a SIM card to connect to the cloud, as they communicate over the mobile networks.

Please note: The MKR WAN 1300 and 1310 board requires a LoRa Gateway to connect to the cloud.

Need any help?

If you have any problems with the Arduino IoT Cloud, you can browse through common troubleshooting issues and find information on different features in the Arduino Help Center. If you don’t find the answer you are looking for, we are always happy to help you with any question regarding our products!

A walk through the configuration

Setting up the Arduino IoT Cloud and accessing the different features available involves a few simple steps. So let’s take a look at how to go from start to finish!

1. Sign up to Create

The Arduino IoT Cloud is part of the Create environment which also includes the Web Editor, Digital Store and Manager for Linux. To use the cloud, we need to first sign up to Create.

2. Go to the Arduino IoT Cloud

You can access the Arduino IoT Cloud from any page on arduino.cc by clicking on the four dots menu in the top right corner. You can also go directly to the Arduino IoT Cloud.

3. Creating a thing

The journey always begin by creating a new Thing. In the Thing overview, we can choose what device to use, what Wi-Fi network we want to connect to, and create variables that we can monitor and control. This is the main configuration space, where all changes we make are automatically generated into a special sketch file.

4. Configuring a device

Devices can easily be added and linked to a Thing. The Arduino IoT Cloud requires your computer to have the Arduino Agent installed. The configuration process is quick and easy, and can be done by clicking on the “Select device” button in the Thing overview. Here, we can choose from any board that has been configured, or select the “Configure new device” option.

We can also get a complete overview of our devices by clicking the “Devices» tab at the top of the Arduino IoT Cloud interface. Here we can manage and add new devices.

5. Creating variables

The variables we create are automatically generated into a sketch file. There are several data types we can choose from, such as int, float, boolean, long, char. There’s also special variables, such as Temperature, Velocity, Luminance that can be used. When clicking on the “Add variable” button, we can choose name, data type, update setting and interaction mode.

6. Connecting to a network

To connect to a Wi-Fi network, simply click the “Configure” button in the network section. Enter the credentials and click “Save”. This information is also generated into your sketch file!

7. Editing the sketch

Now, while we have configured variables, devices and network settings we can get to the coding! A special sketch file can now be found in the “Sketch” tab, which includes all of these configurations. We can now create a sketch that, for example, reads an analog sensor, and use the cloud variable to store it. When the sketch has been uploaded, it will work as a regular sketch, but it will also update the cloud variables that we use!

Additionally, each time we create a variable that has the Interaction Mode enabled, a function will also be generated. Each time this variable is triggered from the cloud, it will execute the code within this function! This means that we can leave most of the code out of the loop() and only run code when needed.

When we are happy with our sketch, we can upload it to our board, by clicking the upload button.

After we have successfully uploaded the code, we can open the “Serial Monitor” tab to view information regarding our connection. If it is successful, it will print “connected to network_name” and “connected to cloud”. If it fails to connect, it will print the errors here as well.

8. Creating a dashboard

Now that we have configured the device & network, created variables, completed the sketch and successfully uploaded the code, we can move on to the fun part: creating dashboards!

Dashboards are visual user interface for interacting with your boards over the cloud, and we can setup many different setups depending on what your IoT project needs. We can access our dashboards by clicking on the “Dashboards” tab at the top of the Arduino IoT Cloud interface, where we can create new dashboards, and see a list of dashboards created for other Things.

If we click on “Create new dashboard”, we enter a dashboard editor. Here, we can create something called widgets. Widgets are the visual representation of our variables we create, and there are many different to choose from. Below is an example using several types of widgets.

When we create widgets, we also need to link them to our variables. This is done by clicking on a widget we create, select a Thing, and select a variable that we want to link. Once it is linked, we can either interact with it, for example a button, or we can monitor a value from a sensor. As long as our board is connected to the cloud, the values will update!

Let’s say we have a temperature widget that we want to link to the temperature variable inside the Cloud project thing.

Please note: Please note: Not all widgets can be linked to a variable. We can for example not link a switch widget to a int variable as the data types are different. The variables that a widget can’t link with will be greyed out, so we can’t accidentially link a widget to the wrong variable.

We can also have several things running at once, depending on your Arduino IoT Cloud plan, which we can include in the same dashboard. This is a great feature for tracking multiple boards in for example a larger sensor network, where boards can be connected to different networks around the world, but be monitored from the same dashboard.

Congratulations

These are the few simple steps needed to create our very own IoT project. Having a project connected to the cloud opens up many possibilities, such as tracking data in real time, trigger remote devices and building wireless systems.

What will you create?

Author: Karl Söderby

Reviewed by: JosГ© GarcГ­a

Источник

Начало работы с облаком Arduino (Cloud IoT) с помощью NodeMCU ESP8266

В 2019 году платформа Arduino представила мировому сообществу свое облачное хранилище данных Arduino Cloud IoT, которое значительно упрощает хранение данных и представляет полный комплекс услуг в рамках концепции интернета вещей (IoT). Оно включает в себя аппаратные и программные средства, облачные сервисы и базу знаний. Данное облачное хранилище данных позволяет пользователям собирать, анализировать и строить виде графиков данные от датчиков, обработчиков событий и т.д.

В данной статье мы рассмотрим подключение платы NodeMCU ESP8266 к облаку Arduino (Arduino Cloud IoT). В данное облако мы будем передавать данные, считываемые с датчика DHT11, также в этом облаке мы установим переключатель, с помощью которого мы будем управлять светодиодом, подключенным к NodeMCU.

Общие сведения об облачном хранилище Arduino

Платформа Arduino Cloud IoT позволяет пользователям писать коды своих программ, компилировать и загружать их в платы непосредственно из браузера, подключать устройства интернета вещей и использовать виртуальную приборную панель (dashboard) в режиме реального времени. Она автоматически формирует необходимый скетч при подключении к ней нового устройства. Платформа имеет следующие основные свойства.

Автоматически генерируемый код : платформа Arduino Cloud IoT автоматически генерирует скетч в соответствии с настройками, задаваемыми пользователем при подключении устройства к облаку и, таким образом, она устраняет барьеры для пользователей, которые не знакомы с программированием, и расширяет возможности разработчиков всех возрастов и опыта.

Поддержка технологии Plug & Play (подключи и играй) : используя облачную платформу интернета вещей Arduino, вы можете писать код, компилировать и загружать его прямо из своего браузера, подключать устройства Интернета вещей и создавать информационные панели в режиме реального времени. Таким образом, у вас не будет необходимости использовать Arduino IDE для программирования оборудования.

Мобильная панель мониторинга «На ходу (‘On-the-go’ )» : она позволяет пользователям получать доступ, проверять данные и управлять удаленным мониторингом датчиков из любого места с помощью доступных виджетов.

Интеграция с другими платформами : Arduino Cloud IoT может быть интегрирована с Amazon Alexa, Google Sheets, IFTTT и ZAPIER, что позволяет пользователям программировать и управлять устройствами с помощью голоса, электронных таблиц, баз данных и автоматизировать оповещения с помощью веб-хуков (webhooks). Платформа также позволяет разработчикам создавать собственные приложения с использованием API Интернета вещей Arduino с добавлением пользовательских веб-хуков в конечные точки для большей гибкости.

Обладая всеми этими функциями, облачный интернет вещей Arduino также имеет некоторые ограничения. Один из них заключается в том, что он работает только с определенными платами Arduino и модулями ESP. Все поддерживаемые платы перечислены ниже.

Платы Arduino:

  • Arduino NANO 33 IoT;
  • Arduino MKR Wi-Fi 1010;
  • Arduino MKR WAN 1310;
  • Arduino MKR WAN 1300;
  • Arduino MKR NB 1500;
  • Arduino MKR GSM 1400;
  • Arduino MKR1000;
  • Arduino Portenta H7 (M7 core);
  • Arduino Nano RP2040 Connect.

Модули ESP и другие платы:

При бесплатном использовании Arduino Cloud IoT вы можете добавлять в платформу только два устройства и при этом время компиляции для вас будет ограничено 200 секундами в день. Если вы хотите расширить возможности использования платформы, то вы можете выбрать один из платных тарифов, представленных на рисунке ниже.

Необходимые компоненты

  1. NodeMCU ESP8266 (купить на AliExpress).
  2. Датчик DHT11 (купить на AliExpress).
  3. Светодиод (5mm) (купить на AliExpress).

Схема проекта

Схема для передачи данных от датчика DHT11 в облако Arduino с помощью NodeMCU ESP8266 представлена на следующем рисунке.

Соединения в схеме очень просты. Датчик DHT11 получает питание через контакты 5V и GND платы NodeMCU ESP8266. Контакт данных датчика DHT11 подключен к контакту D0 платы, а положительный вывод светодиода – к контакту D7 платы.

Внешний вид собранной конструкции проекта показан на следующем рисунке.

Установка Arduino Cloud IoT

Для начала вам необходимо создать себе аккаунт (если у вас его еще нет) на платформе Arduino Cloud IoT. После этого выполните следующую последовательность шагов.

Шаг 1. После создания аккаунта добавьте в него новое устройство, а именно NodeMCU ESP8266. Для этого перейдите на вкладку «Devices» (устройства) и в ней нажмите «Add device».

Затем нажмите на «Set up a 3rd party device».

На следующем шаге выберите используемую нами плату разработки. Для этого сначала в качестве типа устройства (device type) выберите ESP8266, а потом в выпадающем меню выберите NodeMCU1.0.

Далее переименуйте устройство по своему усмотрению и нажмите на next. Появится всплывающее окно с идентификатором устройства (Device ID) и секретным ключом (Secret Key) для вашего устройства. Вы можете либо вручную сохранить эти данные в блокноте либо нажать на “download the PDF” чтобы сохранить их в формате PDF. Учтите, что если вы потеряете (забудете) секретный ключ (secret key), то его невозможно будет восстановить.

После этого нажмите на CONTINUE чтобы добавить устройство.

Шаг 2. После добавления устройства необходимо создать предмет/вещь (Thing). Для этого перейдите на вкладку «Things» и в ней нажмите на ‘Create Thing’.

Теперь, на вкладке Things, у нас есть три опции, которые необходимо настроить – это Variables (переменные), Device (устройство) и Network (сеть). Но сначала свяжем наше устройство с нашим предметом (Thing). Это можно сделать нажав иконку связывания (выделена красным прямоугольником на рисунке ниже) в секции «Device». После этого откроется окно, в котором ранее созданное вами устройство (Device) должно быть доступно для выбора.

После того как устройство будет связано, нам необходимо будет добавить некоторые переменные, которые будут использоваться в коде программы. Для этого нажмите на кнопку «Add variable». После этого откроется окно, в котором вам необходимо заполнить информацию по переменной. В нашем проекте мы будем использовать три переменные, одна из которых будет использоваться для управления светодиодом, а две другие – для хранения значений температуры и влажности.

Сначала создадим переключатель светодиода (led_switch). Тип данных у его будет целый (int), его значение можно будет только считывать (read-only), опция обновления (update policy) для него будет включена. После этого нажмите на кнопку «Add variable» (добавить переменную).

Аналогичным образом добавьте переменные для хранения значений температуры (‘temperature’) и влажности (‘humidity’). Тип данных для этих переменных будет float, их можно будет считывать и записывать (read & write), опция обновления для них также будет включена.

На следующем шаге необходимо ввести данные для доступа к вашей сети Wi-Fi (ее имя и пароль к ней) и секретный ключ (secret key), который был выдан вам во время установки вашего устройства. Для этого нажмите на кнопку ‘Configure’ в разделе «Network Section». Введите необходимую информацию и нажмите на ‘Save.’

Шаг 3. После того как мы добавили устройство и переменные мы можем приступать к созданию информационной панели (dashboard). Для этого перейдите на вкладку ‘Dashboard’ и в ней нажмите на кнопку ‘Build Dashboard’.

Для добавления виджетов на информационную панель (dashboard) нажмите на иконку с карандашом в верхнем левом углу, затем нажмите на кнопку ‘Add’, затем перейдите на «Things» и выберите предмет (Thing). После этого выберите все переменные и нажмите на «Add widgets» (добавить виджеты).

В результате на экране вы должны получить следующую картину:

Программирование NodeMCU ESP8266 для передачи данных в облако Arduino

После того как мы закончили с настройками платформы Arduino Cloud IoT следующим нашим шагом будет программирование платы NodeMCU ESP8266 для считывания данных с датчика DHT11 и передачи их в облако Arduino (Arduino Cloud). Чтобы сделать это перейдите на вкладку «Sketch».

Когда вы добавляете любую переменную в предметы (Things), скетч в облаке автоматически обновляется в соответствии с добавленными переменными. Большая часть кода программы (скетча) будет автоматически написана платформой, нам необходимо будет всего лишь добавить несколько строк для работы с датчиком DHT11. Полный код программы приведен в конце статьи.

Когда код программы будет готов, выберите плату (Board) и порт (Port) и нажмите кнопку загрузить (upload) в верхнем левом углу.

После этого вы сможете управлять светодиодом и мониторить данные с датчика DHT11 используя платформу (Arduino Cloud IoT).

Источник

Adblock
detector