Update bunch of articles to fit with the IoT Workbench (#405)

Deprecate some articles which were written for old installation package.
Unified the board name to "IoT DevKit".
Update the FAQ file.
This commit is contained in:
Arthur Ma 2018-08-04 12:39:08 +08:00 коммит произвёл GitHub
Родитель 2bebedf79f
Коммит aa46504ac2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
36 изменённых файлов: 426 добавлений и 1439 удалений

Просмотреть файл

@ -1,7 +1,7 @@
---
title: "Pixelcraft - A DevKit Painter"
title: "Pixelcraft - A IoT DevKit Painter"
link: "http://pixelcraft.cc/"
excerpt: "Paint the pixels or import an image to modify on DevKit screen, all within browser now."
excerpt: "Paint the pixels or import an image to modify on IoT DevKit screen, all within browser now."
header:
image: /assets/images/communities-pixelcraft.jpg
teaser: /assets/images/communities-pixelcraft-th.jpg
@ -13,4 +13,4 @@ difficulty: EASY
last_modified_at: 2018-02-02
---
This article describes how to use Pixcelcraft tool to paint or modify an imported image to display on DevKit screen. Kudos to Zhe Li.
This article describes how to use Pixcelcraft tool to paint or modify an imported image to display on IoT DevKit screen. Kudos to Zhe Li.

Просмотреть файл

@ -11,7 +11,7 @@ sidebar:
image_alt: "logo"
text: "IoT Maker, Tinker, Developer"
- title: "Responsibilities"
text: "Your coolest ideas that can make the DevKit rock 'n roll."
text: "Your coolest ideas that can make the IoT DevKit rock 'n roll."
---
Don't hesitate to let us know the next best and coolest ideas you come up with for the DevKit. Let us make it even a better IoT development kit.
Don't hesitate to let us know the next best and coolest ideas you come up with for the IoT DevKit. Let us make it even a better IoT development kit.

Просмотреть файл

@ -4,12 +4,12 @@ Liya Du:
name : "Liya Du"
email : "liydu@microsoft.com"
bio : "Cogito, ergo sum."
avatar : "/assets/images/bio-photo.jpg"
avatar : "/assets/images/photo-liki.jpg"
twitter : "likidu"
Arthur Ma:
name : "Arthur Ma"
email : "arthma@microsoft.com"
bio : "Engine behind DevKit"
avatar : "/assets/images/bio-photo.jpg"
bio : "Engine behind IoT DevKit"
avatar : "/assets/images/photo-arthur.jpg"
twitter : "arthurma1978"

Просмотреть файл

@ -25,18 +25,14 @@ docs:
url: /docs/projects/
- title: How-to Guides
children:
- title: "Manual installation"
url: /docs/installation/
- title: "Firmware upgrading"
url: /docs/firmware-upgrading/
- title: "Use configure mode"
url: /docs/use-configuration-mode/
- title: "Understand security chip"
url: /docs/understand-security-chip
- title: "Customize device ID"
url: /docs/customize-device-id/
- title: "Disable data collection"
url: /docs/disable-data-collection/
- title: "Manual installation"
url: /docs/installation/
- title: API Reference
children:
- title: "Arduino"

Просмотреть файл

@ -1,7 +1,7 @@
---
title: "Get started"
permalink: /docs/get-started/
excerpt: "How to quickly install and set up your development environment to use the DevKit."
excerpt: "How to quickly install and set up your development environment to use the IoT DevKit."
variable:
- platform: windows
name: Windows
@ -10,12 +10,12 @@ variable:
last_modified_at: 2018-03-12
---
**Notice:** [Azure IoT Workbench](https://aka.ms/iot-workbench) is the new tool for developing on DevKit. If you are looking for old experiences by using the installer, you can find it [here](https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-arduino-iot-devkit-az3166-get-started)
**Notice:** [Azure IoT Workbench](https://aka.ms/iot-workbench) is the new tool for developing on IoT DevKit. If you are looking for old experiences by using the installer, you can find it [here](https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-arduino-iot-devkit-az3166-get-started).
{: .notice--warning}
For first-time users of the MXChip IoT DevKit (a.k.a. DevKit), follow these quick steps to:
- Prepare your development environment.
- Send temperature and humidity data from built-in DevKit sensors to the Azure IoT Hub.
- Send temperature and humidity data from built-in IoT DevKit sensors to the Azure IoT Hub.
If you have already done this, you can try more samples from the [Projects Catalog]({{"/docs/projects/" | absolute_url }}) or build your own IoT application.
@ -23,11 +23,11 @@ If you have already done this, you can try more samples from the [Projects Catal
## What you learn
* How to connect the DevKit to a wireless access point.
* How to connect the IoT DevKit to a wireless access point.
* How to install the development environment.
* How to create an IoT Hub and register a device for the DevKit.
* How to collect sensor data by running a sample application on the DevKit.
* How to send the DevKit sensor data to your IoT hub.
* How to create an IoT Hub and register a device for the IoT DevKit.
* How to collect sensor data by running a sample application on the IoT DevKit.
* How to send the IoT DevKit sensor data to your IoT hub.
## What you need
@ -39,9 +39,9 @@ If you have already done this, you can try more samples from the [Projects Catal
## Prepare your hardware
To connect the DevKit to your computer:
To connect the IoT DevKit to your computer:
1. Connect the Micro-USB end to the DevKit.
1. Connect the Micro-USB end to the IoT DevKit.
2. Connect the USB end to your computer.
3. The green LED for power confirms the connection.
@ -49,21 +49,21 @@ To connect the DevKit to your computer:
## Configure Wi-Fi
IoT projects rely on internet connectivity. Use AP Mode on the DevKit to configure and connect to Wi-Fi.
IoT projects rely on internet connectivity. Use AP Mode on the IoT DevKit to configure and connect to Wi-Fi.
1. Hold down button B, push and release the reset button, and then release button B. Your DevKit enters AP mode for configuring the Wi-Fi connection. The screen displays the service set identifier (SSID) of the DevKit and the configuration portal IP address:
1. Hold down button B, push and release the reset button, and then release button B. Your IoT DevKit enters AP mode for configuring the Wi-Fi connection. The screen displays the service set identifier (SSID) of the IoT DevKit and the configuration portal IP address:
![Reset button, button B, and SSID]({{"/assets/images/getting-started/wifi-ap.jpg" | absolute_url }})
2. Use a Web browser on a different Wi-Fi enabled device (computer or mobile phone) to connect to the DevKit SSID displayed in the previous step. If it asks for a password, leave it empty.
2. Use a Web browser on a different Wi-Fi enabled device (computer or mobile phone) to connect to the IoT DevKit SSID displayed in the previous step. If it asks for a password, leave it empty.
![Network info and Connect button]({{"/assets/images/getting-started/connect-ssid.png" | absolute_url }})
3. Open **192.168.0.1** in the browser. Select the Wi-Fi network that you want the DevKit to connect to, type the password for the Wi-Fi conection, and then click **Connect**.
3. Open **192.168.0.1** in the browser. Select the Wi-Fi network that you want the IoT DevKit to connect to, type the password for the Wi-Fi conection, and then click **Connect**.
![Password box and Connect button]({{"/assets/images/getting-started/wifi-portal.png" | absolute_url }})
4. The DevKit reboots in a few seconds. You then see the Wi-Fi name and assigned IP address on the screen of the DevKit:
4. The IoT DevKit reboots in a few seconds. You then see the Wi-Fi name and assigned IP address on the screen of the IoT DevKit:
![Wi-Fi name and IP address]({{"/assets/images/getting-started/wifi-ip.jpg" | absolute_url }})
**Note:** After asuccessful Wi-Fi connection, the currently-installed and latest available version of the DevKit's firmware is displayed on the DevKit screen. If the DevKit is not running on the latest available version, follow the [firmware upgrading guide]({{"/docs/firmware-upgrading/" | absolute_url }}) to install the latest version.
**Note:** After asuccessful Wi-Fi connection, the currently-installed and latest available version of the IoT DevKit's firmware is displayed on the IoT DevKit screen. If the IoT DevKit is not running on the latest available version, follow the [firmware upgrading guide]({{"/docs/firmware-upgrading/" | absolute_url }}) to install the latest version.
{: .notice--info}
## Install development environment
@ -136,7 +136,7 @@ Now you are all set with preparing and configuring your development environment.
## Build your first project
1. Make sure your DevKit is **not connected** to your computer. Start VS Code first, and then connect the DevKit to your computer.
1. Make sure your IoT DevKit is **not connected** to your computer. Start VS Code first, and then connect the IoT DevKit to your computer.
1. In the bottom right status bar, check the **MXCHIP AZ3166** is shown as selected board and serial port with **STMicroelectronics** is used.
![Select board and serial port]({{"/assets/images/getting-started/select-board.png" | absolute_url }})
@ -153,13 +153,13 @@ Now you are all set with preparing and configuring your development environment.
1. Click `F1` to open the command palette, type and select **IoT Workbench: Device**, then select **Config Device Settings > Select IoT Hub Device Connection String**.
1. On IoT DevKit, hold down button **A**, push and release the **reset** button, and then release button **A**. Your DevKit enters configuration mode and saves the connection string.
1. On IoT DevKit, hold down button **A**, push and release the **reset** button, and then release button **A**. Your IoT DevKit enters configuration mode and saves the connection string.
![Set connection string]({{"/assets/images/getting-started/connection-string.png" | absolute_url }})
1. Click `F1` again, type and select **IoT Workbench: Device**, then select **Device Upload**.
![Verification and upload of the Arduino sketch]({{"/assets/images/getting-started/arduino-upload.png" | absolute_url }})
The DevKit reboots and starts running the code.
The IoT DevKit reboots and starts running the code.
**Note:** If there is errors or interruptions, you can always recover by running the command again.
{: .notice--info}
@ -204,4 +204,4 @@ If you encounter problems, you can refer to [FAQs]({{"/docs/faq/" | absolute_url
## Next Steps
You have successfully connected an MXChip IoT DevKit to your IoT hub, and you have sent the captured sensor data to your IoT hub.
Check our [Projects Catalog]({{"/docs/projects/" | absolute_url }}) for more samples you can build with the DevKit and Azure multiple services.
Check our [Projects Catalog]({{"/docs/projects/" | absolute_url }}) for more samples you can build with the IoT DevKit and Azure multiple services.

Просмотреть файл

@ -7,9 +7,32 @@ last_modified_at: 2017-05-05T10:16:34-04:00
{% include toc icon="columns" %}
**Notice:** [Azure IoT Workbench](https://aka.ms/iot-workbench) is the new tool for developing on IoT DevKit. If you are looking for FAQ for old experiences by using the installer, you can try the [old one]({{"/docs/legacy/faq" | absolute_url}}) .
{: .notice--warning}
## General
### Is the DevKit Microsoft hardware?
### GDPR and IoT DevKit
Microsoft collects data to operate effectively and provide you the best experiences.
Participation is voluntary and when you choose to participate, your device automatically sends data to Microsoft about how you use the IoT DevKit.
If you choose to participate, you can stop at any time as described [here](https://code.visualstudio.com/docs/supporting/faq#_how-to-disable-telemetry-reporting).
**Notice:** [Azure IoT Workbench](https://aka.ms/iot-workbench) is the tool for developing on IoT DevKit. If you are looking for disable the data collection for old installation package, please follow the steps in [this document]({{"/docs/legacy/disable-data-collection" | absolute_url}}) .
{: .notice--warning}
### Is the IoT DevKit Microsoft hardware?
No. The hardware manufacturer is [MXChip](http://www.mxchip.com), an established player for IoT hardware. Through a partnership between MXChip and Microsoft, we rapidly iterated on the design and engineering of an Arduino compatible board with rich pre-installed sensors. Microsoft's goal is to boost productivity for developers creating and prototyping IoT applications with awesome Visual Studio Code tooling that leverages the power of Microsoft Azure.
@ -29,41 +52,6 @@ You can purchase the kit from our hardware partner's product page: [https://aka.
## Installation
### Command window seems stuck and there is no progress update for a while.
This could be due to putting the Windows command window in "Selection" mode. To verify, check the command window title:
![Window select mode]({{"/assets/images/faq/window-select.png" | absolute_url }})
If you see **select** on the title, this means you are in Selection mode. It prevents refresh of the output, that is why you cannot see any progress.
To resolve, press any key within the command window area and you see **select** disappear in the title.
### Homebrew permission error on macOS.
When you run `install.sh` to install development environment on macOS. You may get a Homebrew permission error:
![Homebrew permission error]({{"/assets/images/faq/brew-permission-error.png" | absolute_url }})
To resolve, follow the instruction of Homebrew by running:
```bash
brew doctor
```
![Homebrew doctor]({{"/assets/images/faq/brew-doctor.png" | absolute_url }})
### Inconsistency between node versions of npm and Yarn.
When you run `install.sh` to install development environment on macOS, you may get a node incompatible error:
```
The engine "node" is incompatible with this module. Expected version ">= 8".
Found incompatible module
```
To resolve, please upgrade node to the latest version.
### Windows Defender SmartScreen prevented an unrecognized app error.
Sometimes SmartScreen prevents applications you know are not bad – for example, its a CMD or VBS script.
@ -82,7 +70,7 @@ To resolve, try to use Wi-Fi with normal WPA/WPA2 authentication.
### Cannot connect to 5 GHz Wi-Fi.
Currently, DevKit only can connect to 2.4 GHz Wi-Fi, 5 GHz is not supported due to hardware restrictions.
Currently, IoT DevKit only can connect to 2.4 GHz Wi-Fi, 5 GHz is not supported due to hardware restrictions.
## Cloud Provisioning
@ -100,14 +88,6 @@ To resolve the issue, please clear the browser's cache and cookies.
For more details please check [I can't sign in to manage my Azure subscription](https://docs.microsoft.com/en-us/azure/billing/billing-cannot-login-subscription).
### Creating new Azure IoT Hub fails.
You may encounter the error message as the screen below:
![Only one IoT Hub]({{"/assets/images/faq/iothub.png" | absolute_url }})
This is because Azure IoT Hub only allows [one free hub per Azure subscription](https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-create-through-portal). In this case, you may select the existing IoT Hub instead of trying to create a new one.
## Development
### Visual Studio Code cannot find Arduino IDE.
@ -116,19 +96,6 @@ Occasionally, when you launch Visual Studio Code, you are prompted with an error
To resolve, close Visual Studio Code, then launches the actual Arduino IDE once. Subsequently, when you open Visual Studio Code it should correctly locate the Arduino IDE path.
### Get "Error: AZ3166: Unknown package" when using `task device-upload`.
This is a known issue caused by the platform index of the board AZ3166 is not refreshed.
To solve this problem, we need to refresh the platform index:
1. Open Arduino IDE, find **Tools > Board: 'local board name' > Boards Manager...**.
![Open Arduino Board Manager]({{"/assets/images/faq/unknown-package.png" | absolute_url }})
2. Wait until all platforms index is refreshed and then close Arduino IDE.
3. Re-open VS Code to run `task device-upload` again.
### Additional warnings during compilation.
In certain environment, lots of warnings message pops up in the VS Code OUTPUT windows when you invoke `Arduino Verify`, `Arduino Upload` or `task device-upload` to compile the project.
@ -137,7 +104,7 @@ It is caused by the incorrect warning handling between Visual Studio Code Arduin
### Compilation error for Azure Function.
When the mini solution of Shake-Shake and DevKit Translator do not work, in Azure portal, you got the following error for the Azure Function you deployed:
When the mini solution of Shake-Shake and IoT DevKit Translator do not work, in Azure portal, you got the following error for the Azure Function you deployed:
```
2017-11-15T03:24:23.426 Function compilation error
@ -152,19 +119,12 @@ Here is the workaround:
2. Add a new Application setting named `WEBSITE_USE_PLACEHOLDER` with value 0.
3. Save and Restart the Function App.
### Get "serialport.node" error when using `task device-upload`
If the Node.js installed on your machine is not a LTS one, you might get below error when using the `task device-upload`:
![Node.js not LTS]({{"/assets/images/faq/node-lts.png" | absolute_url }})
To resolve, please uninstall the existing Node.js and then re-install [the package](https://microsoft.github.io/azure-iot-developer-kit/docs/get-started/#step-5-prepare-the-development-environment).
### Get "Error Presented: #include errors detected" when opening a project
The error message is **Error Presented: #include errors detected. Please update your includePath.**
This is an issue coming from the [Microsoft C/C++ extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools).
Switch the IntelliSense engine to "**Tag Parser**" can fix this issue:
Switch the IntelliSense engine to "**Tag Parser**" can workaround this issue:
* Press F1 and key in 'settings' and select the `Preference: Open User Settings`
@ -184,35 +144,6 @@ Switch the IntelliSense engine to "**Tag Parser**" can fix this issue:
You can get more detail from [C/C++ for VS Code](https://code.visualstudio.com/docs/languages/cpp).
### Customize device ID
The default device ID in IoT Hub for DevKit is AZ3166, you can change it if you need in your own scenario.
To customize device ID, open `.bin/config.json` in the mini-solution project, and add `device` field. For example:
```json
{
"sketch": "../GetStarted.ino",
"config": "deviceConnectionString",
"provision_iot_hub": true,
"provision_azure_function": false,
"tasks": {
"provision": ["subscription", "iothub", "armtemplatedeployment", "device"],
"deploy": []
},
"device": "CUSTOMIZED_DEVICE_ID"
}
```
Notice: The device ID is hardcoded now in the project catalog samples. We will improve the development experience to resolve this issue. However, if you need to change the default **AZ3166** to other, here's the list of files you need to modify for each sample:
* DevKitTranslator - [azurefunction/devkit-translator/run.csx](https://github.com/Microsoft/devkit-sdk/blob/master/AZ3166/src/libraries/AzureIoT/examples/DevKitTranslator/azurefunction/devkit-translator/run.csx#L42)
* GetStarted - [config.h](https://github.com/Microsoft/devkit-sdk/blob/master/AZ3166/src/libraries/AzureIoT/examples/GetStarted/config.h#L9)
* RemoteMonitoring - [RemoteMonitoring.ino](https://github.com/Microsoft/devkit-sdk/blob/master/AZ3166/src/libraries/AzureIoT/examples/RemoteMonitoring/RemoteMonitoring.ino#L23)
* ShakeShake - [azureFunction/shakeshake-cs/run.csx](https://github.com/Microsoft/devkit-sdk/blob/master/AZ3166/src/libraries/AzureIoT/examples/ShakeShake/azureFunction/shakeshake-cs/run.csx#L91) & [azureFunction/shakeshake-node/index.js](https://github.com/Microsoft/devkit-sdk/blob/master/AZ3166/src/libraries/AzureIoT/examples/ShakeShake/azureFunction/shakeshake-node/index.js#L29)
* DevKitDPS - [config.h](https://github.com/DevKitExamples/DevKitDPS/blob/master/config.h#L9)
* DevKitState - [azureFunction/devkit-state/run.csx](https://github.com/DevKitExamples/DevKitState/blob/master/azureFunction/devkit-state/run.csx#L60) & [web/js/main.js](https://github.com/DevKitExamples/DevKitState/blob/master/web/js/main.js#L7)
### Arduino upload return Error: STLinkMethod: Invalid option for "upload_method" option for board "MXCHIP_AZ3166"
In Visual Studio Code, when trying to invoke "Arduion:Board Config" to configure MXChip board ,the Upload Method selection wasnt visible:

Просмотреть файл

@ -9,7 +9,7 @@ author_profile: false
**Notice:** [Azure IoT Workbench](https://aka.ms/iot-workbench) is the new tool for developing on DevKit. If you are looking for old experience, you can still find it by clicking "**Previous version**".
**Notice:** [Azure IoT Workbench](https://aka.ms/iot-workbench) is the new tool for developing on IoT DevKit. If you are looking for old experience, you can still find it by clicking "**Previous version**".
{: .notice--warning}

Просмотреть файл

@ -9,173 +9,23 @@ variable:
name: macOS
- platform: ubuntu
name: Ubuntu
last_modified_at: 2017-10-23
last_modified_at: 2018-8-4
---
We suggest you use the [installation package]({{"/docs/get-started/#a-download-latest-package" | absolute_url}}) to install everything automatically. If you have problems on using the one-click install experience, follow these steps to manually install tools and packages for DevKit development.
{% include switch.html content = page.variable %}
## Windows
## Installation
### Step 1. Install Azure CLI 2.0 MSI
**Notice:** [Azure IoT Workbench](https://aka.ms/iot-workbench) is the new tool for developing on IoT DevKit. If you are looking for old experiences by using the installer, you can find it [here]({{"/docs/legacy/installation" | absolute_url}}).
{: .notice--warning}
Follow the [official guide](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli#windows){:target="_blank"} to install Azure CLI 2.0 with MSI:
Download and run MSI for the Windows command line from: [https://aka.ms/InstallAzureCliWindows](https://aka.ms/InstallAzureCliWindows){:target="_blank"}
### Step 2. Install Arduino IDE
Please follow this [tutorial]({{"/docs/get-started/#install-development-environment" | absolute_url}}) to setup the development environment for developing on IoT DevKit.
The Visual Studio Code Arduino extension relies on the Arduino IDE. Download and install the [Arduino IDE for Windows](https://www.arduino.cc/en/Main/Software){:target="_blank"}. Make sure you download the **Windows Installer** version.
### Step 3. Install Visual Studio Code
Download and install [Visual Studio Code for Windows](https://code.visualstudio.com/){:target="_blank"}. This is the primary development tool for building DevKit IoT applications.
### Step 4. Download the latest package
1. Download [Windows Installer](https://nodejs.org/en/download/){:target="_blank"} to install Node.js.
2. Download the .zip file that contains required task scripts for DevKit development in VS Code.
[<i class='fa fa-download'></i> Download](https://aka.ms/devkit/prod/installpackage/tasks/latest){: .click-download-tracker .btn .btn--success .btn--large}
Locate the .zip and extract it to your Windows user folder (`C:\Users\{your name}\azure-board-cli`). Then launch **Command Prompt** (`cmd`) and run the following commands to configure:
```
cd C:\Users\{your name}\azure-board-cli
npm install
```
### Step 5. Install the VS Code extension for Arduino
You can install Azure Marketplace extensions directly in Visual Studio Code. Select the extensions icon in the left pane, search for **Arduino**, and then select **Install**:
![installation-extensions]({{"/assets/images/installation-extensions-win.png" | absolute_url}})
### Step 6. Install the DevKit board package
Add the DevKit board by using Board Manager in Visual Studio Code.
1. Use `Ctrl+Shift+P` to open the command palette, type **Arduino**, and then find and select **Arduino: Board Manager**.
2. Select **Additional URLs** at the lower right.
![installation-additional-urls]({{"/assets/images/installation-additional-urls-win.png" | absolute_url}})
3. In the `settings.json` file, add a line at the bottom of the **USER SETTINGS** pane and save.
```json
"arduino.additionalUrls": "https://raw.githubusercontent.com/VSChina/azureiotdevkit_tools/master/package_azureboard_index.json"
```
![installation-settings-json]({{"/assets/images/installation-settings-json-win.png" | absolute_url}})
4. In Board Manager, search for **az3166** and install the [latest version]({{"/versions" | absolute_url }}).
![installation-az3166]({{"/assets/images/installation-az3166-win.png" | absolute_url}})
### Step 7. Install ST-Link drivers
[ST-Link/V2](http://www.st.com/en/development-tools/st-link-v2.html){:target="_blank"} driver is required to communicate with the DevKit.
1. Download the driver from [STMicro product page](http://www.st.com/en/embedded-software/stsw-link009.html){:target="_blank"}.
2. Extract the .zip file and double click `stlink_winusb_install.bat` to install:
![installation-st-link]({{"/assets/images/installation-st-link-win.png" | absolute_url}})
You now have all the necessary tools and packages installed for Windows.
## macOS
### Step 1. Install Azure CLI 2.0
Follow the [official guide](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli#macos){:target="_blank"} to install Azure CLI 2.0. We recommend install with [Homebrew](https://brew.sh/){:target="_blank"}:
1. If you don't have it already, install Homebrew by following the [Homebrew installation instructions](https://docs.brew.sh/Installation.html){:target="_blank"}.
2. If you have previously installed the CLI manually, follow the [manual uninstall](manual uninstall){:target="blank"} instructions.
3. Update your local Homebrew repositories.
```bash
brew update
```
4. Install the `azure-cli` package.
```bash
brew install azure-cli
```
### Step 2. Install Arduino IDE
The Visual Studio Code Arduino extension relies on the Arduino IDE.
1. Download the [Arduino IDE for macOS](https://www.arduino.cc/en/Main/Software){:target="_blank"}.
2. Extract downloaded .zip file.
3. Drag and drop `Arduino.app` into Applications folder to install.
### Step 3. Install Visual Studio Code
Download and install [Visual Studio Code for macOS](https://code.visualstudio.com/){:target="_blank"}. This is the primary development tool for building DevKit IoT applications.
### Step 4. Download the latest package
1. Install Node.js. You can use popular macOS package manager [Homebrew](https://brew.sh/){:target="_blank"} or [pre-built installer](https://nodejs.org/en/download/){:target="_blank"} to install it.
2. Download the .zip file that contains required task scripts for DevKit development in VS Code.
[<i class='fa fa-download'></i> Download](https://aka.ms/devkit/prod/installpackage/mac/latest){: .click-download-tracker .btn .btn--success .btn--large}
Locate the .zip file and extract it. Then start the **Terminal** app and run the following commands:
a. Move extracted folder to your macOS user folder:
```bash
mv [.zip extracted folder] ~/azure-board-cli
cd ~/azure-board-cli
```
b. Install npm packages:
```
npm install
```
### Step 5. Install the VS Code extension for Arduino
You can install Azure Marketplace extensions directly in Visual Studio Code.
1. Select the extensions icon in the left pane, search for **Arduino**, and then select **Install**:
![installation-extensions]({{"/assets/images/installation-extensions-mac.png" | absolute_url}})
2. Open **Preference > Settings**, add a line within the **USER SETTINGS** pane and save:
```json
"arduino.path": "/Applications"
```
**Note:** Make sure the Arduino path is set the right location you have installed your Arduino IDE.
{: .notice}
### Step 6. Install the DevKit board package
Add the DevKit board by using Board Manager in Visual Studio Code.
1. Use `Cmd+Shift+P` to open the command palette, type **Arduino**, and then find and select **Arduino: Board Manager**.
2. Select **Additional URLs** at the lower right.
![installation-additional-urls]({{"/assets/images/installation-additional-urls-mac.png" | absolute_url}})
3. In the `settings.json` file, add a line within the **USER SETTINGS** pane and save:
```json
"arduino.additionalUrls": "https://raw.githubusercontent.com/VSChina/azureiotdevkit_tools/master/package_azureboard_index.json"
```
![installation-settings-json]({{"/assets/images/installation-settings-json-mac.png" | absolute_url}})
4. In Board Manager, search for **az3166** and install the [latest version]({{"/versions" | absolute_url }}).
![installation-az3166]({{"/assets/images/installation-az3166-mac.png" | absolute_url}})
You now have all the necessary tools and packages installed for macOS.
## Ubuntu
The DevKit development environment can be installed and ran on Linux such as Ubuntu with manual configurations. Here is a detailed instructions from [Noel Bundick](https://twitter.com/acanthamoeba) about it: [Using the Azure IoT DevKit with Linux](https://www.noelbundick.com/2018/01/28/Using-the-Azure-IoT-DevKit-with-Linux/).
We suggest you use the [installation package]({{"/docs/get-started/#a-download-latest-package" | absolute_url}}) to install everything automatically. If you have problems on using the one-click install experience, follow these steps to manually install tools and packages for IoT DevKit development.
## Next Steps

Просмотреть файл

@ -24,7 +24,7 @@ Once the IoT DevKit is connected, in Windows you see a new USB mass storage devi
2. Drag & drop the `.bin` file you downloaded to `AZ3166` device.
3. Wait until the file is copied, then the DevKit will reboot to the latest firmware.
3. Wait until the file is copied, then the IoT DevKit will reboot to the latest firmware.
After done, you will see the firmware version on the screen of the kit if it has connected with Internet.

Просмотреть файл

@ -1,7 +1,7 @@
---
title: "Use configuration mode"
permalink: /docs/use-configuration-mode/
excerpt: "Get into DevKit Configuration Mode to configure your device."
excerpt: "Get into IoT DevKit Configuration Mode to configure your device."
variable:
- platform: windows
name: Windows
@ -12,11 +12,11 @@ last_modified_at: 2018-01-08
{% include toc icon="columns" %}
DevKit has the configuration model that you can configure settings like WiFi, IoT Hub connection string and security feature for it.
IoT DevKit has the configuration model that you can configure settings like WiFi, IoT Hub connection string and security feature for it.
## Before you begin
* Connect DevKit to the computer.
* Connect IoT DevKit to the computer.
* Download SSH and Telnet client like [Putty](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html) for Windows.
{% include switch.html content = page.variable %}
@ -47,14 +47,14 @@ DevKit has the configuration model that you can configure settings like WiFi, Io
2. Type `terminal` and select **Terminal** app.
3. List DevKit device.
3. List IoT DevKit device.
```bash
ls /dev/cu.usbmodem*
```
4. In the list of connected devices, the device name is like **/dev/cu.usbmodem1433**
5. Connect to the DevKit using the Terminal screen utility.
5. Connect to the IoT DevKit using the Terminal screen utility.
```bash
screen /dev/cu.usbmodemXXXX 115200 –L
```
@ -70,7 +70,7 @@ DevKit has the configuration model that you can configure settings like WiFi, Io
## Commands
Commands for the DevKit Configuration Mode.
Commands for the IoT DevKit Configuration Mode.
### help

Просмотреть файл

@ -17,7 +17,7 @@ IoT security is the area of endeavor concerned with safeguarding connected devic
The STSAFE-A100 consists of a full turnkey solution with a secure operating system running on the latest generation of secure microcontrollers.
![STSAFE on DevKit]({{"/assets/images/how-to/stsafe/stsafe-on-devkit.png" | absolute_url }})
![STSAFE on IoT DevKit]({{"/assets/images/how-to/stsafe/stsafe-on-devkit.png" | absolute_url }})
On the chip, it employs data partitions to be used to store critical data such as Wi-Fi SSID, Wi-Fi password and IoT hub connection string safely. Credential data can be isolated in those partitions. To read and write those partitions, a developer uses `dataZoneIndex` for operating on specific partition. See [API Reference](http://microsoft.github.io/azure-iot-developer-kit/docs/apis/eeprom-interface/) to learn about using it on Arduino.
@ -28,7 +28,7 @@ By default, the security chip is not enabled. It means the data you store on EEP
1. Use `enable_secure 1` command in [Configurition Mode]({{"/docs/use-configuration-mode/" | absolute_url }}).
2. Call `enableHostSecurityChannel()` function in Arduino. see [API reference]({{"/docs/apis/eeprom-interface/" | absolute_url }}).
After enabled, the DevKit will negotiate a key with secure chip. The key will be stored at both DevKit and secure chip side. All data as well as the read / write operations on I2C will then be encrypted.
After enabled, the IoT DevKit will negotiate a key with secure chip. The key will be stored at both IoT DevKit and secure chip side. All data as well as the read / write operations on I2C will then be encrypted.
**Notice:** **Enable the security chip with caution.** Using drag and drop to upgrade firmware will make data saved in EEPROM will no longer be readable immediately after enabling the security channel. This is a design with the security chip to ensure data can not be breached.
{: .notice--warning}
@ -37,9 +37,9 @@ The status between enabling and disabling the security channel.
![STSAFE status]({{"/assets/images/how-to/stsafe/stsafe-status.png" | absolute_url }})
The difference of the data commuinication between DevKit and the security chip (EEPROM).
The difference of the data commuinication between IoT DevKit and the security chip (EEPROM).
![STSAFE communication with DevKit]({{"/assets/images/how-to/stsafe/communication.png" | absolute_url }})
![STSAFE communication with IoT DevKit]({{"/assets/images/how-to/stsafe/communication.png" | absolute_url }})
## Problems and feedback

Просмотреть файл

@ -5,7 +5,7 @@ excerpt: "Library for EEPROMInterface on AZ3166"
last_modified_at: 2018-01-04T05:16:34-04:00
---
EEPROMInterface class is used to store critical data like passwords, keys and other configurations need encrypted. Data is stored on the STSAFE secure chip on DevKit. Security feature is not enabled by default. To enable it, refer to `enableHostSecureChannel()`. And our EEPROM supports secure channel between our MCU and secure chip after function called.
EEPROMInterface class is used to store critical data like passwords, keys and other configurations need encrypted. Data is stored on the STSAFE secure chip on IoT DevKit. Security feature is not enabled by default. To enable it, refer to `enableHostSecureChannel()`. And our EEPROM supports secure channel between our MCU and secure chip after function called.
## Assembly

Просмотреть файл

@ -5,7 +5,7 @@ excerpt: "Library for FileSystem on AZ3166"
last_modified_at: 2018-01-09T05:16:34-04:00
---
The FATFileSystem class implemented on mbed OS APIs, provides the core API for file system operations on DevKit. The SFlashBlockDevice class provides the underlying API for representing block-based storage that can be used to back a file system.
The FATFileSystem class implemented on mbed OS APIs, provides the core API for file system operations on IoT DevKit. The SFlashBlockDevice class provides the underlying API for representing block-based storage that can be used to back a file system.
For more information about File System, please visit [MbedOS](https://docs.mbed.com/docs/mbed-os-api-reference/en/latest/APIs/storage/filesystem/){:target="_blank"}
## Assembly

Просмотреть файл

@ -1,13 +1,13 @@
---
title: "Customize device ID"
permalink: /docs/customize-device-id/
title: "[Obsoleted] Customize device ID"
permalink: /docs/legacy/customize-device-id/
excerpt: "Customize device ID in IoT Hub"
last_modified_at: 2018-01-08
last_modified_at: 2018-08-04
---
## Customize device ID
The default device ID in IoT Hub for DevKit is **AZ3166**, you can change it if you need it in your own scenario.
The default device ID in IoT Hub for IoT DevKit is **AZ3166**, you can change it if you need it in your own scenario.
To customize the device ID, open `.bin/config.json` in the mini-solution project, and add `device` field. For example:
@ -25,4 +25,4 @@ To customize the device ID, open `.bin/config.json` in the mini-solution project
}
```
Then can go through the steps in tutorial again to register your DevKit with this new device ID.
Then can go through the steps in tutorial again to register your IoT DevKit with this new device ID.

Просмотреть файл

@ -1,15 +1,22 @@
---
title: "Disable data collection"
permalink: /docs/disable-data-collection/
title: "[Obsoleted] Disable data collection"
permalink: /docs/legacy/disable-data-collection/
excerpt: "Instructions for disable data collection."
variable:
- platform: windows
name: Windows
- platform: macos
name: macOS
last_modified_at: 2018-03-27
last_modified_at: 2018-08-4
---
**Notice:** We strongly recommend you to use [Azure IoT Workbench](https://aka.ms/iot-workbench) for developing on IoT DevKit.
{: .notice--warning}
Microsoft collects data to operate effectively and provide you the best experiences.
Participation is voluntary and when you choose to participate, your device automatically sends data to Microsoft about how you use the IoT DevKit.

122
docs/_docs/legacy/faq.md Normal file
Просмотреть файл

@ -0,0 +1,122 @@
---
title: "[Obsoleted] Frequently asked questions"
permalink: /docs/legacy/faq/
excerpt: "Frequently asked questions"
last_modified_at: 2018-08-04
---
{% include toc icon="columns" %}
**Notice:** [Azure IoT Workbench](https://aka.ms/iot-workbench) is the new tool for developing on IoT DevKit, and we strongly recommend you use this tool for developing that can avoid below problems if still use the old tools installed by the all-in-one installation package.
{: .notice--warning}
## Installation
### Command window seems stuck and there is no progress update for a while.
This could be due to putting the Windows command window in "Selection" mode. To verify, check the command window title:
![Window select mode]({{"/assets/images/faq/window-select.png" | absolute_url }})
If you see **select** on the title, this means you are in Selection mode. It prevents refresh of the output, that is why you cannot see any progress.
To resolve, press any key within the command window area and you see **select** disappear in the title.
### Homebrew permission error on macOS.
When you run `install.sh` to install development environment on macOS. You may get a Homebrew permission error:
![Homebrew permission error]({{"/assets/images/faq/brew-permission-error.png" | absolute_url }})
To resolve, follow the instruction of Homebrew by running:
```bash
brew doctor
```
![Homebrew doctor]({{"/assets/images/faq/brew-doctor.png" | absolute_url }})
### Inconsistency between node versions of npm and Yarn.
When you run `install.sh` to install development environment on macOS, you may get a node incompatible error:
```
The engine "node" is incompatible with this module. Expected version ">= 8".
Found incompatible module
```
To resolve, please upgrade node to the latest version.
## Cloud Provisioning
### Creating new Azure IoT Hub fails.
You may encounter the error message as the screen below:
![Only one IoT Hub]({{"/assets/images/faq/iothub.png" | absolute_url }})
This is because Azure IoT Hub only allows [one free hub per Azure subscription](https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-create-through-portal). In this case, you may select the existing IoT Hub instead of trying to create a new one.
## Development
### Get "Error: AZ3166: Unknown package" when using `task device-upload`.
This is a known issue caused by the platform index of the board AZ3166 is not refreshed.
To solve this problem, we need to refresh the platform index:
1. Open Arduino IDE, find **Tools > Board: 'local board name' > Boards Manager...**.
![Open Arduino Board Manager]({{"/assets/images/faq/unknown-package.png" | absolute_url }})
2. Wait until all platforms index is refreshed and then close Arduino IDE.
3. Re-open VS Code to run `task device-upload` again.
### Get "serialport.node" error when using `task device-upload`
If the Node.js installed on your machine is not a LTS one, you might get below error when using the `task device-upload`:
![Node.js not LTS]({{"/assets/images/faq/node-lts.png" | absolute_url }})
To resolve, please uninstall the existing Node.js and then re-install [the package](https://microsoft.github.io/azure-iot-developer-kit/docs/get-started/#step-5-prepare-the-development-environment).
### Customize device ID
The default device ID in IoT Hub for IoT DevKit is AZ3166, you can change it if you need in your own scenario.
To customize device ID, open `.bin/config.json` in the mini-solution project, and add `device` field. For example:
```json
{
"sketch": "../GetStarted.ino",
"config": "deviceConnectionString",
"provision_iot_hub": true,
"provision_azure_function": false,
"tasks": {
"provision": ["subscription", "iothub", "armtemplatedeployment", "device"],
"deploy": []
},
"device": "CUSTOMIZED_DEVICE_ID"
}
```
Notice: The device ID is hardcoded now in the project catalog samples. We will improve the development experience to resolve this issue. However, if you need to change the default **AZ3166** to other, here's the list of files you need to modify for each sample:
* DevKitTranslator - [azurefunction/devkit-translator/run.csx](https://github.com/Microsoft/devkit-sdk/blob/master/AZ3166/src/libraries/AzureIoT/examples/DevKitTranslator/azurefunction/devkit-translator/run.csx#L42)
* GetStarted - [config.h](https://github.com/Microsoft/devkit-sdk/blob/master/AZ3166/src/libraries/AzureIoT/examples/GetStarted/config.h#L9)
* RemoteMonitoring - [RemoteMonitoring.ino](https://github.com/Microsoft/devkit-sdk/blob/master/AZ3166/src/libraries/AzureIoT/examples/RemoteMonitoring/RemoteMonitoring.ino#L23)
* ShakeShake - [azureFunction/shakeshake-cs/run.csx](https://github.com/Microsoft/devkit-sdk/blob/master/AZ3166/src/libraries/AzureIoT/examples/ShakeShake/azureFunction/shakeshake-cs/run.csx#L91) & [azureFunction/shakeshake-node/index.js](https://github.com/Microsoft/devkit-sdk/blob/master/AZ3166/src/libraries/AzureIoT/examples/ShakeShake/azureFunction/shakeshake-node/index.js#L29)
* DevKitDPS - [config.h](https://github.com/DevKitExamples/DevKitDPS/blob/master/config.h#L9)
* DevKitState - [azureFunction/devkit-state/run.csx](https://github.com/DevKitExamples/DevKitState/blob/master/azureFunction/devkit-state/run.csx#L60) & [web/js/main.js](https://github.com/DevKitExamples/DevKitState/blob/master/web/js/main.js#L7)
{% include social-share.html %}
[![Back to Top]({{"/assets/images/faq-back-to-top.png" | absolute_url }})](#){: .faq-back-to-top}

Просмотреть файл

@ -0,0 +1,185 @@
---
title: "[Obsoleted] Manual installation"
permalink: /docs/legacy/installation/
excerpt: "[] Instructions for manually install tools and packages."
variable:
- platform: windows
name: Windows
- platform: macos
name: macOS
- platform: ubuntu
name: Ubuntu
last_modified_at: 2018-8-4
---
**Notice:** We strongly recommend you to use [Azure IoT Workbench](https://aka.ms/iot-workbench) for developing on IoT DevKit.
{: .notice--warning}
We suggest you use the [installation package]({{"/docs/get-started/#a-download-latest-package" | absolute_url}}) to install everything automatically. If you have problems on using the one-click install experience, follow these steps to manually install tools and packages for IoT DevKit development.
{% include switch.html content = page.variable %}
## Windows
### Step 1. Install Azure CLI 2.0 MSI
Follow the [official guide](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli#windows){:target="_blank"} to install Azure CLI 2.0 with MSI:
Download and run MSI for the Windows command line from: [https://aka.ms/InstallAzureCliWindows](https://aka.ms/InstallAzureCliWindows){:target="_blank"}
### Step 2. Install Arduino IDE
The Visual Studio Code Arduino extension relies on the Arduino IDE. Download and install the [Arduino IDE for Windows](https://www.arduino.cc/en/Main/Software){:target="_blank"}. Make sure you download the **Windows Installer** version.
### Step 3. Install Visual Studio Code
Download and install [Visual Studio Code for Windows](https://code.visualstudio.com/){:target="_blank"}. This is the primary development tool for building IoT DevKit applications.
### Step 4. Download the latest package
1. Download [Windows Installer](https://nodejs.org/en/download/){:target="_blank"} to install Node.js.
2. Download the .zip file that contains required task scripts for IoT DevKit development in VS Code.
[<i class='fa fa-download'></i> Download](https://aka.ms/devkit/prod/installpackage/tasks/latest){: .click-download-tracker .btn .btn--success .btn--large}
Locate the .zip and extract it to your Windows user folder (`C:\Users\{your name}\azure-board-cli`). Then launch **Command Prompt** (`cmd`) and run the following commands to configure:
```
cd C:\Users\{your name}\azure-board-cli
npm install
```
### Step 5. Install the VS Code extension for Arduino
You can install Azure Marketplace extensions directly in Visual Studio Code. Select the extensions icon in the left pane, search for **Arduino**, and then select **Install**:
![installation-extensions]({{"/assets/images/installation-extensions-win.png" | absolute_url}})
### Step 6. Install the IoT DevKit board package
Add the IoT DevKit board by using Board Manager in Visual Studio Code.
1. Use `Ctrl+Shift+P` to open the command palette, type **Arduino**, and then find and select **Arduino: Board Manager**.
2. Select **Additional URLs** at the lower right.
![installation-additional-urls]({{"/assets/images/installation-additional-urls-win.png" | absolute_url}})
3. In the `settings.json` file, add a line at the bottom of the **USER SETTINGS** pane and save.
```json
"arduino.additionalUrls": "https://raw.githubusercontent.com/VSChina/azureiotdevkit_tools/master/package_azureboard_index.json"
```
![installation-settings-json]({{"/assets/images/installation-settings-json-win.png" | absolute_url}})
4. In Board Manager, search for **az3166** and install the [latest version]({{"/versions" | absolute_url }}).
![installation-az3166]({{"/assets/images/installation-az3166-win.png" | absolute_url}})
### Step 7. Install ST-Link drivers
[ST-Link/V2](http://www.st.com/en/development-tools/st-link-v2.html){:target="_blank"} driver is required to communicate with the IoT DevKit.
1. Download the driver from [STMicro product page](http://www.st.com/en/embedded-software/stsw-link009.html){:target="_blank"}.
2. Extract the .zip file and double click `stlink_winusb_install.bat` to install:
![installation-st-link]({{"/assets/images/installation-st-link-win.png" | absolute_url}})
You now have all the necessary tools and packages installed for Windows.
## macOS
### Step 1. Install Azure CLI 2.0
Follow the [official guide](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli#macos){:target="_blank"} to install Azure CLI 2.0. We recommend install with [Homebrew](https://brew.sh/){:target="_blank"}:
1. If you don't have it already, install Homebrew by following the [Homebrew installation instructions](https://docs.brew.sh/Installation.html){:target="_blank"}.
2. If you have previously installed the CLI manually, follow the [manual uninstall](manual uninstall){:target="blank"} instructions.
3. Update your local Homebrew repositories.
```bash
brew update
```
4. Install the `azure-cli` package.
```bash
brew install azure-cli
```
### Step 2. Install Arduino IDE
The Visual Studio Code Arduino extension relies on the Arduino IDE.
1. Download the [Arduino IDE for macOS](https://www.arduino.cc/en/Main/Software){:target="_blank"}.
2. Extract downloaded .zip file.
3. Drag and drop `Arduino.app` into Applications folder to install.
### Step 3. Install Visual Studio Code
Download and install [Visual Studio Code for macOS](https://code.visualstudio.com/){:target="_blank"}. This is the primary development tool for building IoT DevKit applications.
### Step 4. Download the latest package
1. Install Node.js. You can use popular macOS package manager [Homebrew](https://brew.sh/){:target="_blank"} or [pre-built installer](https://nodejs.org/en/download/){:target="_blank"} to install it.
2. Download the .zip file that contains required task scripts for IoT DevKit development in VS Code.
[<i class='fa fa-download'></i> Download](https://aka.ms/devkit/prod/installpackage/mac/latest){: .click-download-tracker .btn .btn--success .btn--large}
Locate the .zip file and extract it. Then start the **Terminal** app and run the following commands:
a. Move extracted folder to your macOS user folder:
```bash
mv [.zip extracted folder] ~/azure-board-cli
cd ~/azure-board-cli
```
b. Install npm packages:
```
npm install
```
### Step 5. Install the VS Code extension for Arduino
You can install Azure Marketplace extensions directly in Visual Studio Code.
1. Select the extensions icon in the left pane, search for **Arduino**, and then select **Install**:
![installation-extensions]({{"/assets/images/installation-extensions-mac.png" | absolute_url}})
2. Open **Preference > Settings**, add a line within the **USER SETTINGS** pane and save:
```json
"arduino.path": "/Applications"
```
**Note:** Make sure the Arduino path is set the right location you have installed your Arduino IDE.
{: .notice}
### Step 6. Install the IoT DevKit board package
Add the IoT DevKit board by using Board Manager in Visual Studio Code.
1. Use `Cmd+Shift+P` to open the command palette, type **Arduino**, and then find and select **Arduino: Board Manager**.
2. Select **Additional URLs** at the lower right.
![installation-additional-urls]({{"/assets/images/installation-additional-urls-mac.png" | absolute_url}})
3. In the `settings.json` file, add a line within the **USER SETTINGS** pane and save:
```json
"arduino.additionalUrls": "https://raw.githubusercontent.com/VSChina/azureiotdevkit_tools/master/package_azureboard_index.json"
```
![installation-settings-json]({{"/assets/images/installation-settings-json-mac.png" | absolute_url}})
4. In Board Manager, search for **az3166** and install the [latest version]({{"/versions" | absolute_url }}).
![installation-az3166]({{"/assets/images/installation-az3166-mac.png" | absolute_url}})
You now have all the necessary tools and packages installed for macOS.
## Ubuntu
The IoT DevKit development environment can be installed and ran on Linux such as Ubuntu with manual configurations. Here is a detailed instructions from [Noel Bundick](https://twitter.com/acanthamoeba) about it: [Using the Azure IoT DevKit with Linux](https://www.noelbundick.com/2018/01/28/Using-the-Azure-IoT-DevKit-with-Linux/).
## Next Steps
You are all set! It's time to build your first IoT application by following instructions in [Projects Catalog]({{"/docs/projects/" | absolute_url }}).

Просмотреть файл

@ -65,7 +65,7 @@ projects: "2, 5, 6"
---
<div class="landing-page-video">
{% include whatsnew.html news = "The DevKit is now using Azure IoT Workbench, an integrated tool on Visual Studio Code to develop IoT application." link = "Learn more about Azure IoT Workbench" url="https://aka.ms/iot-workbench" %}
{% include whatsnew.html news = "The IoT DevKit is now using Azure IoT Workbench, an integrated tool on Visual Studio Code to develop IoT application." link = "Learn more about Azure IoT Workbench" url="https://aka.ms/iot-workbench" %}
</div>
{% include feature_row id="part1" type="right" %}

Просмотреть файл

@ -21,7 +21,7 @@ last_modified_at: 2017-06-28
{% include toc icon="columns" %}
In this project, you will create an Azure IoT Hub, connect DevKit to it, and collect the temperature and humidity data from sensors and send the data to the IoT hub.
In this project, you will create an Azure IoT Hub, connect IoT DevKit to it, and collect the temperature and humidity data from sensors and send the data to the IoT hub.
## What you learn
@ -33,7 +33,7 @@ In this project, you will create an Azure IoT Hub, connect DevKit to it, and col
Finish the [Getting Started Guide]({{"/docs/get-started/" | absolute_url }}) to:
* Have your DevKit connected to Wi-Fi
* Have your IoT evKit connected to Wi-Fi
* Prepare the development environment
An active Azure subscription. If you do not have one, you can register via one of the methods:
@ -49,7 +49,7 @@ Visual Studio Code is the primary development tool for IoT DevKit. If this is th
### A. Start VS Code
Make sure your DevKit is not connected. Start VS Code first and connect the DevKit to your computer. VS Code automatically finds the DevKit and opens an introduction page:
Make sure your IoT DevKit is not connected. Start VS Code first and connect the IoT DevKit to your computer. VS Code automatically finds the IoT DevKit and opens an introduction page:
![Introduction page]({{"/assets/images/mini-solution/vscode_start.png" | absolute_url }})

Просмотреть файл

@ -3,176 +3,5 @@ title: "Shake, shake"
permalink: /docs/projects/shake-shake-macos/
---
**Notice:** This manual steps for running **'Shake, shake'** project on macOS is subject to change.
**Notice:** This page has been obsolted, please refer the [new one]({{"/docs/projects/shake-shake" | absolute_url }}).
{: .notice--warning}
{% include toc icon="columns" %}
### Step 1. Create Azure IoT Hub
1. Sign in to [Azure portal](https://portal.azure.com/).
2. Click **New > Internet of Things > IoT Hub** or search for 'IoT Hub' and click **Create**:
![shake-shake-mac-create-iothub]({{"/assets/images/shake-shake-mac-create-iothub.png" | absolute_url }})
3. In the **IoT hub** pane, enter the following information for your IoT hub:
![shake-shake-mac-hub-details]({{"/assets/images/shake-shake-mac-hub-details.png" | absolute_url }})
> * **Name**: It is the name for your IoT hub. If the name you enter is valid, a green check mark appears.
> * **Pricing and scale tier**: Select the free F1 tier. This option is sufficient for this demo. See [pricing and scale tier](https://azure.microsoft.com/pricing/details/iot-hub/){:target="_blank"}.
> * **Resource group**: Create a resource group to host the IoT hub or use an existing one. See Using [resource groups to manage your Azure resources](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-portal){:target="_blank"}.
> * **Location**: Select the closest location to you where the IoT hub is created.
> * **Pin the dashboard**: Check this option for easy access to your IoT hub from the dashboard.
4. Click **Create**. It could take a few minutes for your IoT hub to be created. You can see progress in the **Notifications** pane:
![shake-shake-mac-notification]({{"/assets/images/shake-shake-mac-notification.png" | absolute_url }})
5. After your IoT hub is created, click it from the Resource groups. Make a note of the IoT Hub name:
![shake-shake-mac-iothub-name]({{"/assets/images/shake-shake-mac-iothub-name.png" | absolute_url }})
6. Click on the IoT Hub name, in the **Shared access policies** pane, click the **iothubowner** policy, and then make a note of the **Connection string** value for your IoT hub:
![shake-shake-mac-iothub-connection-string]({{"/assets/images/shake-shake-mac-iothub-connection-string.png" | absolute_url }})
### Step 2. Register a device in the IoT hub for the your device
1. In the [Azure portal](https://portal.azure.com/){:target="_blank"}, open your IoT hub.
2. Click **Device Explorer**.
3. In the Device Explorer pane, click **Add** to add a device with name "**AZ3166**" to your IoT hub:
![shake-shake-mac-create-device]({{"/assets/images/shake-shake-mac-create-device.png" | absolute_url }})
> * **Device ID**: The ID of the new device.
> * **Authentication type**: Select Symmetric Key.
> * **Auto generate keys**: Check this field.
> * **Connect device to IoT Hub**: Click Enable.
4. Click **Save**.
5. After the device is created, open the device in the **Device Explorer** pane.
6. Make a note of the primary key of the connection string.
![shake-shake-mac-connection-string]({{"/assets/images/shake-shake-mac-connection-string.png" | absolute_url }})
### Step 3. Configure device connection string to DevKit
1. With your DevKit connected to computer, open the terminal.
2. List relevant serial port:
```bash
ls -l /dev/cu.*
```
You get following outputs like:
```bash
crw-rw-rw- 1 root wheel 20, 1 May 17 18:36 /dev/cu.Bluetooth-Incoming-Port
crw-rw-rw- 1 root wheel 20, 33 May 18 18:11 /dev/cu.usbmodem1423
```
The later one ended with `usbmodem1423` is the actual serial port of the DevKit.
3. Open serial monitor:
```bash
screen /dev/cu.usbmodem1423 115200
```
4. Get into configuration mode:
Hold down button A, then push and release the reset button.
5. In the prompt of the serial port with `#`, configure your connection string you get from previous step:
```bash
set_az_iothub [your connection string]
```
You will see the information once configuration is successful:
```bash
INFO: Set Azure Iot hub connection string successfully.
```
Now exit the serial monitor by first type `Ctrl+A` and then `Ctrl+\` and type 'y'.
### Step 4. Deploy Azure Functions
#### A. Create Azure Functions
1. Click **New > Everything** and search for **Function App**:
![shake-shake-mac-create-function-app]({{"/assets/images/shake-shake-mac-create-function-app.png" | absolute_url }})
2. Specify the Name and Resource Group of the function:
![shake-shake-mac-function-app-name]({{"/assets/images/shake-shake-mac-function-app-name.png" | absolute_url }})
3. Go to the Function App you just created and create a new custom function:
![shake-shake-mac-custom-function]({{"/assets/images/shake-shake-mac-custom-function.png" | absolute_url }})
4. Choose **EventHubTrigger-Javascript** from the template list and type the IoT Hub name you noted in **Event Hub name** field:
![shake-shake-mac-eventhub-trigger]({{"/assets/images/shake-shake-mac-eventhub-trigger.png" | absolute_url }})
5. Click **New** to create Event Hub connection:
![shake-shake-mac-new-eventhub-connection]({{"/assets/images/shake-shake-mac-new-eventhub-connection.png" | absolute_url }})
6. Select **IoT Hub** tab, confirm it selects the right IoT Hub and click **Select**:
![shake-shake-mac-function-connection-string]({{"/assets/images/shake-shake-mac-function-connection-string.png" | absolute_url }})
7. Click **Create** to finish creating a new function.
#### B. Upload the Azure Functions files of the project
1. Click **[my function name] > View Files > Upload**:
![shake-shake-mac-function-upload]({{"/assets/images/shake-shake-mac-function-upload.png" | absolute_url }})
2. Press `Cmd+Shift+G`, and then click **Go**.
3. Continue to navigate to the following folder:
```bash
~/Library/Arduino15/packages/AZ3166/hardware/stm32f4/0.8.1/libraries/AzureIotHub/examples/ShakeShake/azureFunction
```
4. Upload `index.js` and `package.json`.
5. Click `index.js` again to refresh the code:
![shake-shake-mac-function-refresh]({{"/assets/images/shake-shake-mac-function-refresh.png" | absolute_url }})
6. Select **Platform features** and click **Console** to launch the console:
![shake-shake-mac-open-console]({{"/assets/images/shake-shake-mac-open-console.png" | absolute_url }})
7. In the console, run the following commands:
```bash
cd [your function name]
npm install
```
![shake-shake-mac-npm-install]({{"/assets/images/shake-shake-mac-npm-install.png" | absolute_url }})
#### C. Configure and run Azure Functions
1. Select **Platform features** and click **Application settings**:
![shake-shake-mac-app-settings]({{"/assets/images/shake-shake-mac-app-settings.png" | absolute_url }})
2. Add a new Key / Value pair in **App settings** section and click **Save**:
- Key: **iotHubConnectionString**
- Value: **[your IoT Hub connection string]**
![shake-shake-mac-eventhub-connection-string]({{"/assets/images/shake-shake-mac-eventhub-connection-string.png" | absolute_url }})
3. Go to your Azure Function code and click **Run**:
![shake-shake-mac-function-run]({{"/assets/images/shake-shake-mac-function-run.png" | absolute_url }})
### Step 5. Build and upload Arduino sketch
#### A. Open the Arduino Examples folder in VS Code:
Make sure your DevKit is not connected. Start VS Code first and connect the DevKit to your computer. VS Code will automatically find it and pops up introduction page. Switch to **'Arduino Examples'** tab, navigate to `Examples for MXCHIP AZ3166 > AzureIoTHub` and click on `ShakeShake`.
![shake-shake-example]({{"/assets/images/shake-shake-example.png" | absolute_url }})
**Notice:** Occasionally, when you launch VS Code, you will be prompted with error that cannot find Arduino IDE or related board package. Close VS Code, launch Arduino IDE once and VS Code should locate Arduino IDE path correctly.
{: .notice--warning}
#### B. Modify the #hashtag
Open `ShakeShake.ino` and look for the line of code:
```cpp
static const char* iot_event = "{\"topic\":\"iot\"}";
```
Replace the string `iot` in the curly brace with your preferred hashtag.
#### C. Build and upload Arduino sketch
Use `Cmd+Shift+P` to open the command palette, type **Arduino**, and then find and select **Arduino: Upload**. Then it will start compiling and uploading the Arduino sketch. After it is done, the DevKit reboots and starts running the code.
## Test the project
Check how to [test the result]({{"/docs/projects/shake-shake/#test-the-project" | absolute_url }}).

Просмотреть файл

@ -92,7 +92,7 @@ last_modified_at: 2018-01-09
* Add [Watchdog Timer API](https://microsoft.github.io/azure-iot-developer-kit/docs/apis/watchdog-timer/).
* Add [External Interrupts API](https://microsoft.github.io/azure-iot-developer-kit/docs/apis/external-interrupts/).
* Fix MQTT client reconnect issue.
* Filter out DevKit hotspot in the WiFi configuration page.
* Filter out IoT DevKit hotspot in the WiFi configuration page.
* Fix bugs.
* Mini Solution
@ -178,7 +178,7 @@ During the past 2 weeks, we got chance to revisit our code and did some minor ch
* Fix memory leak issue in IoT Hub MQTT client when there was a long drop on Wi-Fi.
* Development Tools
* Improve the stability for DevKit Windows/Mac installation.
* Improve the stability for IoT DevKit Windows/Mac installation.
* Support customized IoT Hub Device ID in configuring device connection string.
### Downloads
@ -195,11 +195,11 @@ Happy new year 2018! Let us talk about the fundamentals of IoT this time: the se
### Release Summary
* Firmware
* Upgrade the DevKit firmware to enable DPS feature.
* Upgrade the IoT DevKit firmware to enable DPS feature.
* New tool `set_dps_uds` is added in the configuration mode, which help to save the **Unique Device Secret (UDS)** into the STSAFE chip, for more detail please check [this topic]({{"/docs/projects/dps/#save-unique-device-secret-on-stsafe-security-chip" | absolute_url }}).
* SDK
* Open source [DevKit SDK](https://github.com/Microsoft/devkit-sdk), you are welcome to contribute :)
* Open source [IoT DevKit SDK](https://github.com/Microsoft/devkit-sdk), you are welcome to contribute :)
* Upgrade the Azure IoT C SDK to [1.1.28]( https://github.com/Azure/azure-iot-sdk-c/releases/tag/2017-11-17).
* Archive the Azure IoT C SDK in the Arduino board package, greatly reduce the compile time.
* Enable the secure channel, protecting confidentiality and integrity of data with STSAFE chip on IoT DevKit.
@ -259,7 +259,7 @@ The new Audio library gives the ability to continuous recording voice through th
## Version 1.2.0 (October 24, 2017)
No more manual steps to prepare your DevKit development environment on macOS! The time saving one-click installation now support macOS as well. And yes, we love bash.
No more manual steps to prepare your IoT DevKit development environment on macOS! The time saving one-click installation now support macOS as well. And yes, we love bash.
### Release Summary
@ -271,7 +271,7 @@ No more manual steps to prepare your DevKit development environment on macOS! Th
* Bug fix: Enable HttpClient response callback when handling large response body.
* Project Catalog
* New mini solution: DeviceStates. Use Azure IoT Hub device twins to monitor DevKit state and control the user LED.
* New mini solution: DeviceStates. Use Azure IoT Hub device twins to monitor IoT DevKit state and control the user LED.
* Fix gyroscope values and added acceleration sensor in SensorStatus sample.
* Use MQTT Client wrapper for GetStarted, RemoteMonitoring and ShakeShake mini solutions.
* Improve telemetry logics in mini solutions on macOS.
@ -311,12 +311,12 @@ No more manual steps to prepare your DevKit development environment on macOS! Th
## Version 1.1.0 (September 4, 2017)
DevKit now officially has full support for [ST-SAFE](http://www.st.com/en/secure-mcus/stsafe-a100.html){:target="_blank"}, the security chip that provides secure authentication and data management for IoT solutions. Since it's enabled on bootloader level, a [firmware upgrade]({{"/docs/firmware-upgrading" | absolute_url}}) is mandatory to make the DevKit work properly.
IoT DevKit now officially has full support for [ST-SAFE](http://www.st.com/en/secure-mcus/stsafe-a100.html){:target="_blank"}, the security chip that provides secure authentication and data management for IoT solutions. Since it's enabled on bootloader level, a [firmware upgrade]({{"/docs/firmware-upgrading" | absolute_url}}) is mandatory to make the IoT DevKit work properly.
### Release Summary
* Firmware
* Upgrade the DevKit firmware to enable STSAFE.
* Upgrade the IoT DevKit firmware to enable STSAFE.
* SDK
* Bug fix: Under bad network environment, the Device SDK in mbed OS occasionally crashes.
@ -354,7 +354,7 @@ Summer does not mean slow down. We further enriched our project catalog and tune
* Add support for audio playback API.
* Project Catalog
* Add 'DevKit Translator' example for DevKit to understand more languages :robot:.
* Add 'DevKit Translator' example for IoT DevKit to understand more languages :robot:.
* Add 'Door Monitor' example uses third party email service to send notifications.
* Replace manual steps with VS Code tasks for 'Connect to Azure IoT Hub' example.
* Improve Azure Functions stability and performance used by examples.
@ -423,7 +423,7 @@ After a month work of stabilizing the code, fixing bugs and adding more samples,
* Project Catalog
* Add 'Connect to Azure IoT Hub' example and documentation that align with other [Azure IoT Hub get started tutorials](https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-get-started){:target="_blank"}.
* Add 'Remote Monitoring' example and documentation that make DevKit connect to [Azure IoT Suite](https://www.azureiotsuite.com){:target="_blank"}.
* Add 'Remote Monitoring' example and documentation that make IoT DevKit connect to [Azure IoT Suite](https://www.azureiotsuite.com){:target="_blank"}.
* Add 'MQTT Client' example and documentation that send MQTT messages to public free MQTT broker.
* Shake, Shake: Use testing Twitter bearer token as default, developer can replace it with her own by following the tutorial.
* Shake, Shake: Add delay and retry logic when not receiving any message due to function delay.
@ -436,7 +436,7 @@ After a month work of stabilizing the code, fixing bugs and adding more samples,
## Version 0.8.1 (May 21, 2017)
Some bug fixes before DevKit debut on [//Build](https://build.microsoft.com/){:target="_blank"} and [Maker Faire Bay Area](http://makerfaire.com/){:target="_blank"}.
Some bug fixes before IoT DevKit debut on [//Build](https://build.microsoft.com/){:target="_blank"} and [Maker Faire Bay Area](http://makerfaire.com/){:target="_blank"}.
## Version 0.8.0 (May 5, 2017)

Просмотреть файл

@ -1,5 +1,5 @@
---
title: "DevKit OTA updates"
title: "IoT DevKit OTA updates"
permalink: /docs/projects/devkit-ota/
redirect_to:
- https://github.com/Microsoft/vscode-iot-workbench/blob/master/docs/iot-devkit/devkit-ota.md

Просмотреть файл

@ -3,7 +3,7 @@ title: "Remote Monitoring"
permalink: /docs/projects/remote-monitoring/
redirect_to:
- https://github.com/Microsoft/vscode-iot-workbench/blob/master/docs/iot-devkit/devkit_remote_monitoringv2.md
excerpt: "Visualize sensors status on DevKit using Azure IoT Suite Remote Monitoring."
excerpt: "Visualize sensors status on IoT DevKit using Azure IoT Suite Remote Monitoring."
PreviousVersionUrl: https://docs.microsoft.com/en-us/azure/iot-accelerators/iot-accelerators-arduino-iot-devkit-az3166-devkit-remote-monitoringv2
header:
overlay_image: /assets/images/projects-remote-monitoring.jpg
@ -31,140 +31,3 @@ variable:
name: macOS
last_modified_at: 2017-06-28
---
In this tutorial, you learn how to run a sample app on your DevKit to send sensor data to your Azure IoT Suite.
{% include toc icon="columns" %}
## What you need
Finish the [Getting Started Guide]({{"/docs/get-started/" | absolute_url }}) to:
* Have your DevKit connected to Wi-Fi
* Prepare the development environment
An active Azure subscription. If you do not have one, you can register via one of these two methods:
* Activate a [free 30-day trial Microsoft Azure account](https://azure.microsoft.com/en-us/free/){:target="_blank"}
* Claim your [Azure credit](https://azure.microsoft.com/en-us/pricing/member-offers/msdn-benefits-details/){:target="_blank"} if you are MSDN or Visual Studio subscriber
## Step 1. Create an Azure IoT Suite
1. Go to [Azure IoT Suite site](https://www.azureiotsuite.com/) and click **Create a new solution**.
![remote-monitoring-azure-iot-suite-solution-types]({{"/assets/images/mini-solution/remote-monitoring/azure-iot-suite-solution-types.png" | absolute_url }})
**Notice:** By default, this creates an S2 IoT Hub after it creates one IoT Suite. If this IoT hub will not be used with massive number of devices, we highly recommend you downgrade it from S2 to S1, and delete the IoT Suite--the IoT Hub will also be deleted--when you no longer need it. This will save you money:).
{: .notice--warning}
2. Select **Remote monitoring**.
3. Enter a solution name, select a subscription and a region, and then click **Create solution**. The solution may take a while to be provisioned.
![remote-monitoring-azure-iot-suite-new-solution]({{"/assets/images/mini-solution/remote-monitoring/azure-iot-suite-new-solution.png" | absolute_url }})
4. After the provision is completed, click **Launch**. Some simulated devices are created for the solution during the provision process. Click **DEVICES** to check them out.
![remote-monitoring-azure-iot-suite-new-solution-created]({{"/assets/images/mini-solution/remote-monitoring/azure-iot-suite-new-solution-created.png" | absolute_url }})
![remote-monitoring-azure-iot-suite-console]({{"/assets/images/mini-solution/remote-monitoring/azure-iot-suite-console.png" | absolute_url }})
5. Click **ADD A DEVICE**.
6. Click **Add New** for **Custom Device**.
![remote-monitoring-azure-iot-suite-add-new-device]({{"/assets/images/mini-solution/remote-monitoring/azure-iot-suite-add-new-device.png" | absolute_url }})
7. Click **Let me define my own Device ID**, enter `AZ3166`, and then click **Create**.
![remote-monitoring-azure-iot-suite-new-device-configuration]({{"/assets/images/mini-solution/remote-monitoring/azure-iot-suite-new-device-configuration.png" | absolute_url }})
8. Make a note of **IoT Hub Hostname**, and click **Done**.
## Step 2. Open the RemoteMonitoring sample
1. Disconnect the DevKit from your computer, if it is connected.
2. Start VS Code.
3. Connect the DevKit to your computer. VS Code automatically detects your DevKit and opens the following pages:
* The DevKit introduction page.
* Arduino Examples: Hands-on samples to get started with DevKit.
4. Expand left side **ARDUINO EXAMPLES** section, browse to **Examples for MXCHIP AZ3166 > AzureIoT**, and select **RemoteMonitoring**. This will open a new VS Code window with a project folder in it.
![mini-solution-vscode]({{"/assets/images/mini-solution/vscode_start.png" | absolute_url }})
If you happen to close the pane, you can reopen it. Use `Ctrl+Shift+P` (macOS: `Cmd+Shift+P`) to open the command palette, type **Arduino**, and then find and select **Arduino: Examples**.
## Step 3. Provision required Azure services
In the solution window, run your task through `Ctrl+P` (macOS: `Cmd+P`) by entering `task cloud-provision` in the provided text box:
In the VS Code terminal, an interactive command line guides you through provisioning the required Azure services:
![remote-monitoring-provision]({{"/assets/images/mini-solution/remote-monitoring/provision.png" | absolute_url }})
**Notice:** If the page hangs in the loading status when trying to sign in to Azure, please check this [FAQ steps]({{"/docs/faq/#page-hangs-when-log-in-azure" | absolute_url}}) to resolve the issue.
{: .notice--warning}
## Step 4. Build and upload the device code
{% include switch.html content = page.variable %}
### Windows
1. Use `Ctrl+P` to run `task config-device-connection`.
2. The terminal will ask you whether you want to use connection string that retrieves from `task cloud-provision` step. You could also input your own device connection string by clicking 'Create New...'
3. The terminal prompts you to enter configuration mode. To do so, hold down button A, then push and release the reset button. The screen displays the DevKit id and 'Configuration'.
![Verification and upload of the Arduino sketch]({{"/assets/images/mini-solution/remote-monitoring/config-device-connection.png" | absolute_url }})
4. After `task config-device-connection` finished, click `F1` to load VS Code commands and select `Arduino: Upload`, then VS Code starts verifying and uploading the Arduino sketch:
![Verification and upload of the Arduino sketch]({{"/assets/images/mini-solution/remote-monitoring/arduino-upload.png" | absolute_url }})
The DevKit reboots and starts running the code.
**Notice:** Occasionally, you may get an "Error: AZ3166: Unknown package" error message. This occurs when the board package index is not refreshed correctly. Check this [FAQ steps]({{"/docs/faq/#development" | absolute_url}}) to resolve this issue.
{: .notice--warning}
### macOS
1. Put DevKit into configuration mode:
Hold down button A, then push and release the reset button. The screen displays 'Configuration'.
2. Use `Cmd+P` to run `task config-device-connection`.
3. The terminal will ask you whether you want to use connection string that retrieves from `task cloud-provision` step. You could also input your own device connection string by clicking 'Create New...'
![device-upload]({{"/assets/images/mini-solution/remote-monitoring/config-device-connection.png" | absolute_url }})
4. After `task config-device-connection` finished, click `Cmd + shift + p` to load VS Code commands and select `Arduino: Upload`, then VS Code starts verifying and uploading the Arduino sketch:
![device-upload]({{"/assets/images/mini-solution/remote-monitoring/arduino-upload.png" | absolute_url }})
The DevKit reboots and starts running the code.
**Notice:** Occasionally, you may get an "Error: AZ3166: Unknown package" error message. This occurs when the board package index is not refreshed correctly. Check this [FAQ steps]({{"/docs/faq/#development" | absolute_url}}) to resolve the issue.
{: .notice--warning}
## Test the project
When the sample app runs, DevKit sends sensor data over Wi-Fi to your Azure IoT Suite. To see the result, follow these steps:
1. Go to your Azure IoT Suite, and click **DASHBOARD**.
2. On the Azure IoT Suite solution console, you will see your DevKit sensor status.
{% include gallery id="layouts_gallery" caption="View sensor information within Azure IoT Suite." %}
## Customize device ID
You can customize device ID in IoT Hub by following [this doc]({{"/docs/customize-device-id/" | absolute_url }}), however, you still need to change the hardcoding `AZ3166` to customized device ID in the code currently. Here's the list of files you need to modify:
* [RemoteMonitoring.ino](https://github.com/Microsoft/devkit-sdk/blob/master/AZ3166/src/libraries/AzureIoT/examples/RemoteMonitoring/RemoteMonitoring.ino#L23)
## Problems and feedback
If you encounter problems, please refer to [FAQs]({{"/docs/faq/" | absolute_url }}) or reach out to us from the channels below.
{% include feedback.html tutorial="remote-monitoring" %}

Просмотреть файл

@ -8,5 +8,3 @@ header:
difficulty: EASY
last_modified_at: 2017-12-12
---
This article describes how, as a device developer, to connect a MXChip IoT DevKit (DevKit) device to your Microsoft IoT Central application.

Просмотреть файл

@ -3,7 +3,7 @@ title: "MQTT Client"
permalink: /docs/projects/mqtt-helloworld/
redirect_to:
- https://github.com/Microsoft/vscode-iot-workbench/blob/master/docs/iot-devkit/devkit-mqtt-client.md
excerpt: "Use DevKit as a client to send messages to MQTT server."
excerpt: "Use IoT DevKit as a client to send messages to MQTT server."
PreviousVersionUrl: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-arduino-iot-devkit-az3166-mqtt-helloworld
header:
overlay_image: /assets/images/projects-mqtt-helloworld.jpg
@ -12,73 +12,3 @@ header:
difficulty: EASY
last_modified_at: 2017-06-28
---
In this project, you learn how to use the MQTT Client library to send messages to an MQTT broker.
The MQTT client library we used is part of the [Eclipse Paho](http://www.eclipse.org/paho/) project, which provides APIs for using MQTT over multiple means of transport.
{% include toc icon="columns" %}
## What you need
Finish the [Getting Started Guide]({{"/docs/get-started/" | absolute_url }}) to:
* Have your DevKit connected to Wi-Fi
* Prepare the development environment
## Step 1. Open the project folder
1. Disconnect the DevKit from your computer, if it is already connected.
2. Start VS Code.
3. Connect the DevKit to your computer.
VS Code automatically detects your DevKit and opens the following pages:
* The DevKit introduction page.
* Arduino Examples: Hands-on samples to get you started with your DevKit.
Links to these two pages appear on the EXPLORER panel on the left side of the Visual Studio Code window.
![mini-solution-vscode]({{"/assets/images/mini-solution/vscode_start.png" | absolute_url }})
## Step 2. Open the MQTTClient Arduino sample sketch
Expand left side **Aduino Examples** section, browse to **Examples for MXCHIP AZ3166 > MQTT**, and select **MQTTClient**. This will open a new VS Code window with a project folder in it.
![examples-folder]({{"/assets/images/mini-solution/mqtt-helloworld/examples.png" | absolute_url}})
If you happen to close the pane, you can reopen it. Use `Ctrl+Shift+P` (macOS: `Cmd+Shift+P`) to open the command palette, type **Arduino**, and then find and select **Arduino: Examples**.
## Step 3. Build and upload the Arduino sketch to the DevKit
Type `Ctrl+P` (macOS: `Cmd+P`) to run `task device-upload`. Once the upload is completed, DevKit restarts and runs the sketch.
![device-upload]({{"/assets/images/mini-solution/mqtt-helloworld/device-upload.jpg" | absolute_url}})
**Notice:** Occasionally, you may get the "Error: AZ3166: Unknown package" message. This occurs when the board package index is not refreshed. Check this [FAQ steps]({{"/docs/faq/#development" | absolute_url}}) to resolve this issue.
{: .notice--warning}
## Test the project
In VS Code, follow these steps to open and set up the Serial Monitor:
1. Click the `COM[X]` word on the status bar to set the correct COM port with `STMicroelectronics`:
![set-com-port]({{"/assets/images/mini-solution/mqtt-helloworld/set-com-port.jpg" | absolute_url}})
2. Click the power plug icon on the status bar to open the Serial Monitor:
![serial-monitor]({{"/assets/images/mini-solution/mqtt-helloworld/serial-monitor.jpg" | absolute_url}})
3. On the status bar, click the number that represents the Baud Rate and set it to `115200`:
![set-baud-rate]({{"/assets/images/mini-solution/mqtt-helloworld/set-baud-rate.jpg" | absolute_url}})
The Serial Monitor displays all the messages sent by the sample sketch. When the sketch runs, it connects the DevKit to Wi-Fi. When the Wi-Fi connection is successful, the sketch sends a message to the MQTT broker. After that, the sketch repeatedly sends two "iot.eclipse.org" messages using QoS 0 and QoS 1, respectively.
![serial-output]({{"/assets/images/mini-solution/mqtt-helloworld/serial-output.jpg" | absolute_url}})
## Problems and feedback
If you encounter problems, you can refer to [FAQs]({{"/docs/faq/" | absolute_url }}) or reach out to us from the channels below.
{% include feedback.html tutorial="mqtt-helloworld" %}
## See Also
* [Connect IoT DevKit AZ3166 to Azure IoT Hub in the cloud]({{"/docs/getting-started/" | absolute_url }})
* [Shake, Shake for a Tweet]({{"/docs/projects/shake-shake/" | absolute_url }})

Просмотреть файл

@ -16,189 +16,3 @@ icons:
difficulty: MEDIUM
last_modified_at: 2018-01-05
---
Microsoft Azure provides a rich set of integrated public cloud services for all your IoT solution needs. The IoT Hub Device Provisioning Service is a helper service for IoT Hub that enables zero-touch, just-in-time provisioning to the right IoT hub without requiring human intervention, enabling customers to provision millions of devices in a secure and scalable manner.
This project shows how to configure DevKit in order to make it automatically register to IoT Hub using the Device Provisioning Service. In this tutorial, you will learn how to:
* Set up the Device Provisioning Service configuration on the device
* Save Unique Device Secret on STSAFE security chip
* Generate X.509 certificate
* Create a device enrollment entry in the Device Provisioning Service
{% include toc icon="columns" %}
## Before you begin
To complete the steps in this tutorial, you need the following:
* Prepare your DevKit with [Getting Started Guide]({{"/docs/get-started/" | absolute_url }}).
* Upgrade to latest firmware (>= 1.3.0) with [Firmware Upgrading]({{"/docs/firmware-upgrading/" | absolute_url }}) tutorial.
* Create and link IoT Hub with Device Provisioning Service instance with [Set up auto provisioning](https://docs.microsoft.com/en-us/azure/iot-dps/quick-setup-auto-provision).
## Set up the Device Provisioning Service configuration on the device
To enable the DevKit to connect to the Device Provisiong Service instance you just created:
1. In the Azure portal, select the **Overview** blade for your Device Provisioning Service and note down the **Global device endpoint** and **ID Scope** value.
![DPS Global Endpoint and ID Scope]({{"/assets/images/mini-solution/dps/dps-global-endpoint.png" | absolute_url }})
2. Make sure `git` is installed on your machine and is added to the environment variables accessible to the command window. See [Software Freedom Conservancy's Git client tools](https://git-scm.com/download/) to have the latest version installed.
3. Open a command prompt. Clone the GitHub repo for DPS sample code:
```bash
git clone https://github.com/DevKitExamples/DevKitDPS.git
```
4. Launch VS Code and connect DevKit to computer, open the folder that contains the code you cloned.
5. Open **DevKitDPS.ino**, Find and replace `[Global Device Endpoint]` and `[ID Scope]` with the values you just note down.
![DPS Endpoint]({{"/assets/images/mini-solution/dps/endpoint.png" | absolute_url }})
You can leave the **registrationId** as blank, the application will generate one for you based on the MAC address and firmware version. If you want to customized it, the Registration ID has to use alphanumeric, lowercase, and hyphen combinations only with maximum 128 characters long. See [Manage device enrollments with Azure portal](https://docs.microsoft.com/en-us/azure/iot-dps/how-to-manage-enrollments) for more details.
6. Use **Quick Open** in VS Code (Windows: `Ctrl+P`, macOS: `Cmd+P`) and type **task device-upload** to build and upload the code to the DevKit.
7. Observe the success of the task in the output window.
## Save Unique Device Secret on STSAFE security chip
Device Provisioning Service can be configured on device based on its [Hardware Security Module (HSM)](https://azure.microsoft.com/en-us/blog/azure-iot-supports-new-security-hardware-to-strengthen-iot-security/). DevKit uses [Device Identity Composition Engine (DICE)](https://trustedcomputinggroup.org/wp-content/uploads/Foundational-Trust-for-IOT-and-Resource-Constrained-Devices.pdf) from the [Trusted Computing Group (TCG)](https://trustedcomputinggroup.org). A **Unique Device Secret (UDS)** saved in STSAFE security chip on the DevKit is used to generate the device unique [X.509](https://docs.microsoft.com/en-us/azure/iot-dps/tutorial-set-up-device#select-a-hardware-security-module) certificate. The certificate can be later used for the enrollment process in the Device Provisioning Service.
A typical **Unique Device Secret (UDS)** is a 64 characters long string. A sample UDS is as below:
<span id="uds"></span>
```
19e25a259d0c2be03a02d416c05c48ccd0cc7d1743458aae1cb488b074993eae
```
<span id="hex"></span>
Each of two characters are used as Hex value in the security calculation. So the above sample UDS is resolved to: "`0x19`, `0xe2`, `0x5a`, `0x25`, `0x9d`, `0x0c`, `0x2b`, `0xe0`, `0x3a`, `0x02`, `0xd4`, `0x16`, `0xc0`, `0x5c`, `0x48`, `0xcc`, `0xd0`, `0xcc`, `0x7d`, `0x17`, `0x43`, `0x45`, `0x8a`, `0xae`, `0x1c`, `0xb4`, `0x88`, `0xb0`, `0x74`, `0x99`, `0x3e`, `0xae`".
To save Unique Device Secret on the DevKit:
<span id="steps"></span>
1. Take the sample UDS string above and change one or many characters to other values between `0` and `f`. This is used as your own UDS.
2. Open serial monitor by using tool like Putty, see [Use Configuration Mode]({{"/docs/use-configuration-mode/" | absolute_url }}) for details.
3. With the DevKit connected to computer, hold down button A, then push and release the reset button to enter configuration mode. The screen should show the DevKit id and **'Configuration'**.
4. Copy the sample UDS above. In serial monitor window, type **set_dps_uds [your_own_uds_value]** and press the Enter key to save it.
5. Without closing the serial monitor window, press reset button on the DevKit.
6. Note down **DevKit MAC Address** and **DevKit Firmware Version** value.
![Firmware version]({{"/assets/images/mini-solution/dps/firmware-version.png" | absolute_url }})
## Generate X.509 certificate
{% include switch.html content = page.variable %}
1. Open file explorer and go to the folder contain the DSP sample code you cloned, there is a **.build** folder, find and copy **DPS.ino.bin** and **DPS.ino.map** in it.
![Generated files]({{"/assets/images/mini-solution/dps/generated-files.png" | absolute_url }})
**Note:** If you have changed the `built.path` configuration for Arduino to other folder. You need to find those files in the folder you configured.
{: .notice--info}
2. Paste these two files into **tools** folder on the same level with **.build** folder.
3. Run **dps_cert_gen.exe** (or **./dps_cert_gen_mac** for macOS), follow the prompts to enter your **UDS**, **MAC address** for the DevKit and the **firmware version** to generate the X.509 certificate.
Windows:
![Run dps_cert_gen.exe]({{"/assets/images/mini-solution/dps/dps-cert-gen.png" | absolute_url }})
macOS:
![Run dps_cert_gen_mac for mac]({{"/assets/images/mini-solution/dps/dps-cert-gen-mac.png" | absolute_url }})
4. Observe the success of generation, a **.pem** certificate is saved in the same folder.
## Create a device enrollment entry in the Device Provisioning Service
1. In the Azure portal, navigate to your provisioning service. Click **Manage enrollments**, and select the **Individual Enrollments** tab.
![Individual enrollments]({{"/assets/images/mini-solution/dps/individual-enrollments.png" | absolute_url }})
2. Click **Add**.
3. In **Mechanism**, choose **X.509**.
![Upload cert]({{"/assets/images/mini-solution/dps/upload-cert.png" | absolute_url }})
4. In **Certificate .pem or .cer file**, upload the **.pem** certificate you just have.
5. Leave the rest as default and click **Save**.
## Start the DevKit
1. Launch VS Code and open serial monitor.
2. Press the **Reset** button on your DevKit.
You should see the DevKit start the registration with your Device Provisioning Service.
![VS Code output]({{"/assets/images/mini-solution/dps/vscode-output.png" | absolute_url }})
## Verify the DevKit is registered on IoT Hub
Once your device boots, the following actions should take place:
1. The device sends a registration request to your Device Provisioning Service.
2. The Device Provisioning Service sends back a registration challenge to which your device responds.
3. On successful registration, the Device Provisioning Service sends the IoT hub URI and device ID back to the device.
4. The IoT Hub client application on the device then connects to your hub.
5. On successful connection to the hub, you should see the device appear in the IoT hub's Device Explorer.
![Device registered]({{"/assets/images/mini-solution/dps/device-registered.png" | absolute_url }})
## Customize device ID
You can customize device ID in IoT Hub by following [this doc]({{"/docs/customize-device-id/" | absolute_url }}), however, you still need to change the hardcoding `AZ3166` to customized device ID in the code currently. Here's the list of files you need to modify:
* [config.h](https://github.com/DevKitExamples/DevKitDPS/blob/master/config.h#L9)
## Problems and feedback
If you encounter problems, you can find [FAQs]({{"/docs/faq/" | absolute_url }}) if you encounter problems or reach out to us from the channels below.
{% include feedback.html tutorial="dps" %}
## Next Steps
Now that you have learned prepare the DevKit to enroll a device securely to DPS using DICE, so that it will automatically register to IoT Hub with zero-touch.
Advance to the other tutorials to learn:
* [Create and provision a simulated device](https://docs.microsoft.com/en-us/azure/iot-dps/quick-create-simulated-device)
* [Manage device enrollments](https://docs.microsoft.com/en-us/azure/iot-dps/how-to-manage-enrollments)
* [Revoke device access](https://docs.microsoft.com/en-us/azure/iot-dps/how-to-revoke-device-access-portal)
* [Use HSM with SDK](https://docs.microsoft.com/en-us/azure/iot-dps/use-hsm-with-sdk)
* [Control access to Provisioning Service](https://docs.microsoft.com/en-us/azure/iot-dps/how-to-control-access)
<script>
function generateUDS() {
var uds = [];
for (var i = 0; i < 32; i++) {
var char = Math.floor(Math.random() * 256).toString(16);
if (char.length === 1) {
char = `0${char}`;
}
uds.push(char);
}
return uds;
}
(function() {
var udsWatcher = setInterval(function(){
if($) {
clearInterval(udsWatcher);
var uds = generateUDS();
$('p:has(#uds) + .highlighter-rouge code').html(uds.join(''));
var chars = $('p:has(#hex) code');
for (var i = 0; i < 32; i++) {
$(chars.get(i)).html(`0x${uds[i]}`);
}
$('p:has(#steps) + ol li:first-child').remove();
}
}, 500);
})();
</script>

Просмотреть файл

@ -3,7 +3,7 @@ title: "DevKit Translator"
permalink: /docs/projects/devkit-translator/
redirect_to:
- https://github.com/Microsoft/vscode-iot-workbench/blob/master/docs/iot-devkit/devkit-translator.md
excerpt: "Turn DevKit as a translator by using Bing Speech Translator service."
excerpt: "Turn IoT DevKit as a translator by using Bing Speech Translator service."
PreviousVersionUrl: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-arduino-iot-devkit-az3166-translator
header:
overlay_image: /assets/images/projects-devkit-translator.jpg
@ -46,144 +46,3 @@ variable:
name: macOS
last_modified_at: 2017-07-17
---
In this project, you learn how to use DevKit as a translator. The app records your voice and translates it to English text shown on the DevKit screen.
{% include toc icon="columns" %}
## What you need
Finish the [Getting Started Guide]({{"/docs/get-started/" | absolute_url }}) to:
* Have your DevKit connected to Wi-Fi
* Prepare the development environment
An active Azure subscription. If you do not have one, you can register via one of the methods:
* Activate a [free 30-day trial Microsoft Azure account](https://azure.microsoft.com/en-us/free/){:target="_blank"}
* Claim your [Azure credit](https://azure.microsoft.com/en-us/pricing/member-offers/msdn-benefits-details/){:target="_blank"} if you are MSDN or Visual Studio subscriber
## Step 1. Open the project folder
### A. Start VS Code
- Make sure your DevKit is not connected to your PC.
- Start VS Code
- Connect the DevKit to your computer.
VS Code automatically finds the DevKit and opens an introduction page:
![Introduction page]({{"/assets/images/mini-solution/vscode_start.png" | absolute_url }})
**Notice:** Occasionally, when you launch VS Code, you may be prompted with error saying that the Arduino IDE or related board package cannot be found. If this happens, close VS Code, launch the Arduino IDE once again, and VS Code should locate the Arduino IDE path correctly.
{: .notice--warning}
### B. Open the Arduino Examples folder
Expand left side **ARDUINO EXAMPLES** section, browse to **Examples for MXCHIP AZ3166 > AzureIoT**, and select **DevKitTranslator**. This will open a new VS Code window with the DEVKITTRANSLATOR project folder in it.
![mini-solution-examples]({{"/assets/images/mini-solution/vscode_examples.png" | absolute_url }})
If you happen to close the pane, you can reopen it. Use `Ctrl+Shift+P` (macOS: `Cmd+Shift+P`) to open the command palette, type **Arduino**, and then find and select **Arduino: Examples**.
## Step 2. Provision Azure services
In the solution window, run the cloud-provisioniong task by typing `Ctrl+P` (macOS: `Cmd+P`) and entering `task cloud-provision` in the text box:
In the VS Code terminal, an interactive command line will guide you through provisioning all required Azure services:
![mini-solution-provision-sub]({{"/assets/images/mini-solution/devkit-translator/cloud-provision.png" | absolute_url }})
**Notice:** If the page hangs in the loading status when trying to sign in to Azure, please check this [FAQ steps]({{"/docs/faq/#page-hangs-when-log-in-azure" | absolute_url}}) to resolve this issue.
{: .notice--warning}
## Step 3. Deploy Azure Functions
Use `Ctrl+P` (macOS: `Cmd+P`) to run `task cloud-deploy` to deploy the Azure Functions code. This process usually takes 2 to 5 minutes to complete:
![mini-solution-deploy]({{"/assets/images/mini-solution/devkit-translator/cloud-deploy.png" | absolute_url }})
After Azure Function deploys successfully, fill in the azure_config.h file with function app name. You can navigate to [Azure portal](https://portal.azure.com/){:target="_blank"} to find it:
![mini-solution-function-app]({{"/assets/images/mini-solution/devkit-translator/azure-function.png" | absolute_url }})
**Notice:** If the Azure Function does not work properly, please check this [FAQ steps]({{"/docs/faq/#compilation-error-for-azure-function" | absolute_url}}) to resolve this issue.
{: .notice--warning}
## Step 4. Build and upload the device code
{% include switch.html content = page.variable %}
### Windows
1. Use `Ctrl+P` to run `task config-device-connection`.
2. The terminal will ask you whether you want to use connection string that retrieves from `task cloud-provision` step. You could also input your own device connection string by clicking 'Create New...'
3. The terminal prompts you to enter configuration mode. To do so, hold down button A, then push and release the reset button. The screen displays the DevKit id and 'Configuration'.
![Verification and upload of the Arduino sketch]({{"/assets/images/mini-solution/devkit-translator/config-device-connection.png" | absolute_url }})
4. After `task config-device-connection` finished, click `F1` to load VS Code commands and select `Arduino: Upload`, then VS Code starts verifying and uploading the Arduino sketch:
![Verification and upload of the Arduino sketch]({{"/assets/images/mini-solution/devkit-translator/arduino-upload.png" | absolute_url }})
The DevKit reboots and starts running the code.
**Notice:** Occasionally, you may get an "Error: AZ3166: Unknown package" eror message. This occurs when the board package index is not refreshed correctly. Check this [FAQ steps]({{"/docs/faq/#development" | absolute_url}}) to resolve this issue.
{: .notice--warning}
### macOS
1. Put DevKit into configuration mode:
Hold down button A, then push and release the reset button. The screen displays 'Configuration'.
2. Use `Cmd+P` to run `task config-device-connection`.
3. The terminal will ask you whether you want to use connection string that retrieves from `task cloud-provision` step. You could also input your own device connection string by clicking 'Create New...'
![device-upload]({{"/assets/images/mini-solution/devkit-translator/config-device-connection.png" | absolute_url }})
4. After `task config-device-connection` finished, click `Cmd + shift + p` to load VS Code commands and select `Arduino: Upload`, then VS Code starts verifying and uploading the Arduino sketch:
![device-upload]({{"/assets/images/mini-solution/devkit-translator/arduino-upload.png" | absolute_url }})
The DevKit reboots and starts running the code.
**Notice:** Occasionally, you may get an "Error: AZ3166: Unknown package" error message. This is occurs when the board package index is not refreshed correctly. Check this [FAQ steps]({{"/docs/faq/#development" | absolute_url}}) to resolve this issue.
{: .notice--warning}
## Test the project
After app initialization, follow the instructions on the DevKit screen.
The default source language is Chinese.
To translate Chinese to English:
- Simply press and hold button B while speaking, then release button B to initiate the translation. Several seconds later, the translation will be shown on the screen.
To select a source language other than Chinese:
- Press button A to enter setup mode.
- Press button B to scroll all supported source languages.
- Press button A to confirm your choice of source language.
- Press and hold button B while speaking, then release button B to initiate the translation. Several seconds later, the translation will be shown on the screen.
{% include gallery id="layouts_gallery" caption="Translate as you go" %}
- Press button A and B to scroll and select the source language.
- Press button B to talk, release to send the voice and get the translation text
## How it works
![mini-solution-voice-to-tweet-diagram]({{"/assets/images/mini-solution/devkit-translator/diagram.png" | absolute_url }})
The Arduino sketch records your voice then posts an HTTP request to trigger Azure Functions. Azure Functions calls the cognitive service speech translator API to do the translation. After Azure Functions gets the translation text, it sends a C2D message to the device. Then the translation is displayed on the screen.
## Customize device ID
You can customize device ID in IoT Hub by following [this doc]({{"/docs/customize-device-id/" | absolute_url }}), however, you still need to change the hardcoding `AZ3166` to customized device ID in the code currently. Here's the list of files you need to modify:
* [azurefunction/devkit-translator/run.csx](https://github.com/Microsoft/devkit-sdk/blob/master/AZ3166/src/libraries/AzureIoT/examples/DevKitTranslator/azurefunction/devkit-translator/run.csx#L42)
## Problems and feedback
If you encounter problems, you can refer to [FAQs]({{"/docs/faq/" | absolute_url }}) or reach out to us from the channels below.
{% include feedback.html tutorial="devkit-translator" %}

Просмотреть файл

@ -43,231 +43,3 @@ variable:
name: macOS
last_modified_at: 2017-07-05
---
In this project, you learn how to use the motion sensor to trigger an event using Azure Functions. The app will retrieve a random tweet with a #hashtag you have configured in your Arduino sketch. The tweet will display on the DevKit screen.
{% include toc icon="columns" %}
## What you need
Finish the [Getting Started Guide]({{"/docs/get-started/" | absolute_url }}) to:
* Have your DevKit connected to Wi-Fi
* Prepare the development environment
An active Azure subscription. If you do not have one, you can register via one of these methods:
* Activate a [free 30-day trial Microsoft Azure account](https://azure.microsoft.com/en-us/free/){:target="_blank"}
* Claim your [Azure credit](https://azure.microsoft.com/en-us/pricing/member-offers/msdn-benefits-details/){:target="_blank"} if you are an MSDN or Visual Studio subscriber
## Step 1. Open the project folder
### A. Start VS Code
- Make sure your DevKit is **not** connected to your computer.
- Start VS Code.
- Connect the DevKit to your computer.
VS Code will automatically find your DevKit and display an introduction page:
![mini-solution-vscode]({{"/assets/images/mini-solution/vscode_start.png" | absolute_url }})
**Notice:** Occasionally, when you launch VS Code, you may be prompted with an error message saying that the Arduino IDE or related board package cannot be found. If this should occur, close VS Code, launch the Arduino IDE again and VS Code should locate Arduino IDE path correctly.
{: .notice--warning}
### B. Open Arduino Examples folder
Expand left side **ARDUINO EXAMPLES** section, browse to **Examples for MXCHIP AZ3166 > AzureIoT**, and select **ShakeShake**. This opens a new VS Code window with a project folder in it.
![mini-solution-examples]({{"/assets/images/mini-solution/vscode_examples.png" | absolute_url }})
If you happen to close the pane, you can reopen it. Use `Ctrl+Shift+P` (macOS: `Cmd+Shift+P`) to open the command palette, type **Arduino**, and then find and select **Arduino: Examples**.
## Step 2. Provision Azure services
1. In the solution window, run your task through `Ctrl+P` (macOS: `Cmd+P`) by entering `task cloud-provision`:
In the VS Code terminal, an interactive command line will guide you through provisioning the required Azure services:
![cloud-provision]({{"/assets/images/mini-solution/shake-shake/cloud-provision.png" | absolute_url }})
**Notice:** If the page hangs in the loading status when trying to sign in to Azure, please refer to this [FAQ steps]({{"/docs/faq/#page-hangs-when-log-in-azure" | absolute_url}}) to resolve the issue.
{: .notice--warning}
2. When a list of Azure subscriptions display in the terminal, use the **up** and **down** arrow keys to select the Azure subscription that you will use to provision the Azure IoT Hub. Then press **Enter** to confirm the selected subscription.
![Select Azure subscription]({{"/assets/images/mini-solution/shake-shake/select-subscription.png" | absolute_url }})
_Select Azure subscription_
3. Provision IoT Hub
* If you've provisioned IoT Hub(s) before, a list of IoT Hubs associated with the subscription appears in the terminal. Please use **up** and **down** arrow keys to select one from the list and press **Enter** to confirm.
![Select an existing IoT Hub]({{"/assets/images/mini-solution/shake-shake/select-existing-iothub.png" | absolute_url }})
_Select existing Free IoT Hub_
Wait several minutes to finish ARM Template deployment and IoT Hub Device provision. Then press any key to exit the terminal.
![Select an existing IoT Hub done]({{"/assets/images/mini-solution/shake-shake/select-iothub-done.png" | absolute_url }})
_Finish selecting IoT Hub_
* If you don't have any IoT Hub, please follow the steps to create a free IoT Hub:
* Resource group provision:
Use **up** and **down** arrow keys to choose a resource group you've created before or select **Create New...** to provision a new resource group. Complete the resource group provision according to the command line prompt.
![Select or create Azure resource group]({{"/assets/images/mini-solution/shake-shake/select-or-create-resource-group.png" | absolute_url }})
If you choose to create a new resource group:
* Use **up** and **down** arrow keys to select region for a new resource group provision, and then press **Enter** to confirm.
![Select region for a new resource group provision]({{"/assets/images/mini-solution/shake-shake/select-region-for-resource-group.png" | absolute_url }})
_Select region for resource group provision_
* Input a name for new resource group.
![Input name for resource group]({{"/assets/images/mini-solution/shake-shake/input-name-for-resource-group.png" | absolute_url }})
_Input a name for resource group provision_
* IoT Hub provision:
Enter a name for your new IoT Hub, and press **Enter** to confirm.
![Input a name for IoT Hub]({{"/assets/images/mini-solution/shake-shake/input-name-for-iothub.png" | absolute_url }})
_Input a name for IoT Hub provision_
Wait several minutes to finish ARM Template deployment and IoT Hub Device provision. Then press any key to exit the terminal.
![Provision Azure IoT Hub done]({{"/assets/images/mini-solution/shake-shake/provision-iothub-done.png" | absolute_url }})
_Finish cloud provision_
## Step 3. Modify the #hashtag
Open `ShakeShake.ino` and look for this line of code:
```cpp
static const char* iot_event = "{\"topic\":\"iot\"}";
```
Replace the string `iot` within the curly braces with your preferred hashtag. DevKit will later retrieve a random tweet containing the hashtag you specified here.
## Step 4. Deploy Azure Functions
Use `Ctrl+P` (macOS: `Cmd+P`) to run `task cloud-deploy`. This will start deploying the Azure Functions code:
![cloud-deploy]({{"/assets/images/mini-solution/shake-shake/cloud-deploy.png" | absolute_url }})
**Notice:** Occasionally, the Azure Function may not work properly. If this occurs, please check this [FAQ steps]({{"/docs/faq/#compilation-error-for-azure-function" | absolute_url}}) to resolve this issue.
{: .notice--warning}
## Step 5. Build and upload the device code
{% include switch.html content = page.variable %}
### Windows
1. Use `Ctrl+P` to run `task config-device-connection`.
2. The terminal will ask you whether you want to use connection string that retrieves from `task cloud-provision` step. You could also input your own device connection string by clicking 'Create New...'
3. The terminal prompts you to enter configuration mode. To do so, hold down button A, then push and release the reset button. The screen displays the DevKit id and 'Configuration'.
![Verification and upload of the Arduino sketch]({{"/assets/images/mini-solution/shake-shake/config-device-connection.png" | absolute_url }})
4. After `task config-device-connection` finished, click `F1` to load VS Code commands and select `Arduino: Upload`, then VS Code starts verifying and uploading the Arduino sketch:
![Verification and upload of the Arduino sketch]({{"/assets/images/mini-solution/shake-shake/arduino-upload.png" | absolute_url }})
The DevKit reboots and starts running the code.
**Notice:** Occasionally, you may get an "Error: AZ3166: Unknown package" error message. This occurs when the board package index is not refreshed correctly. Check this [FAQ steps]({{"/docs/faq/#development" | absolute_url}}) to resolve this issue.
{: .notice--warning}
### macOS
1. Put DevKit into configuration mode:
Hold down button A, then push and release the reset button. The screen displays 'Configuration'.
2. Use `Cmd+P` to run `task config-device-connection`.
3. The terminal will ask you whether you want to use connection string that retrieves from `task cloud-provision` step. You could also input your own device connection string by clicking 'Create New...'
![device-upload]({{"/assets/images/mini-solution/shake-shake/config-device-connection.png" | absolute_url }})
4. After `task config-device-connection` finished, click `Cmd + shift + p` to load VS Code commands and select `Arduino: Upload`, then VS Code starts verifying and uploading the Arduino sketch:
![device-upload]({{"/assets/images/mini-solution/shake-shake/arduino-upload.png" | absolute_url }})
The DevKit reboots and starts running the code.
**Notice:** Occasionally, you may get an "Error: AZ3166: Unknown package" error message. This occurs when the board package index is not refreshed correctly. Check this [FAQ steps]({{"/docs/faq/#development" | absolute_url}}) to resolve this issue.
{: .notice--warning}
## Test the project
After app initialization, click button A and gently shake the DevKit board to retrieve a random tweet containing your hashtag (e.g. #iot). Within a few seconds, a tweet will display on your DevKit screen.:
{% include gallery id="layouts_gallery" caption="Shake, shake for a random tweet containing the #hashtag you set in the code." %}
- Press button A again, then shake for a new tweet.
- Press button B to scroll through the rest of the tweet.
**Notice:** If the screen displays **No Tweets**, please check [this step]({{"/docs/projects/shake-shake/#problems-and-feedback" | absolute_url}}).
{: .notice--warning}
## How it works
![diagram]({{"/assets/images/mini-solution/shake-shake/diagram.png" | absolute_url }})
The Arduino sketch sends an event to Azure IoT Hub which triggers the Azure Functions app. Azure Functions contains the logic to connect to Twitter's API and retrieve a tweet. It wraps the tweet text into a C2D (Cloud-to-device) message and sends it back to the device.
## Optional: Use your own Twitter bearer token
This sample project uses a pre-configured Twitter bearer token for testing purposes. But there is a [rate limit](https://dev.twitter.com/rest/reference/get/search/tweets){:target="_blank"} for every Twitter account. You might want to consider using your own token. Here are simple instructions to do so:
1. Go to [Twitter Developer portal](https://dev.twitter.com/){:target="_blank"} to register a new Twitter app.
2. [Get Consumer Key and Consumer Secrets](https://support.yapsody.com/hc/en-us/articles/203068116-How-do-I-get-a-Twitter-Consumer-Key-and-Consumer-Secret-key-){:target="_blank"} of your app.
3. Use [some utility](https://gearside.com/nebula/utilities/twitter-bearer-token-generator/){:target="_blank"} to generate a Twitter bearer token from these two keys.
4. In the [Azure portal](https://portal.azure.com/){:target="_blank"}, get into the **Resource Group** and find the Azure Function (Type: App Service) for your "Shake, Shake" project. The name always contains 'shake...' string.
![azure-function]({{"/assets/images/mini-solution/shake-shake/azure-function.png" | absolute_url }})
5. Update the code for `run.csx` within **Functions > shakeshake-cs** with your own token:
```csharp
...
string authHeader = "Bearer " + "[your own token]";
...
```
![twitter-token]({{"/assets/images/mini-solution/shake-shake/twitter-token.png" | absolute_url }})
5. Save the file and click **Run**.
## Problems and feedback
### Problems
#### The screen displays 'No Tweets' while every step has run successfully
This normally happens for the first time you deploy and run the sample. This is because the function app requires anywhere from a couple of seconds to as much as one minute to cold start the app. Or, there are some blips when running the code that will cause restarting of the app. When this happens, the device app can get a timeout for fetching the tweet. In this case, you may try one or both of these methods to solve this issue:
1. Click the reset button on the DevKit to run the device app again.
2. In the [Azure portal](https://portal.azure.com/){:target="_blank"}, find the Azure Functions app you created and restart it:
![azure-function-restart]({{"/assets/images/mini-solution/shake-shake/azure-function-restart.png" | absolute_url }})
### Feedback
If you encounter problems, you can refer to [FAQs]({{"/docs/faq/" | absolute_url }}) or reach out to us from the channels below.
## Customize device ID
You can customize device ID in IoT Hub by following [this doc]({{"/docs/customize-device-id/" | absolute_url }}), however, you still need to change the hardcoding `AZ3166` to customized device ID in the code currently. Here's the list of files you need to modify:
* [azureFunction/shakeshake-cs/run.csx](https://github.com/Microsoft/devkit-sdk/blob/master/AZ3166/src/libraries/AzureIoT/examples/ShakeShake/azureFunction/shakeshake-cs/run.csx#L91)
* [azureFunction/shakeshake-node/index.js](https://github.com/Microsoft/devkit-sdk/blob/master/AZ3166/src/libraries/AzureIoT/examples/ShakeShake/azureFunction/shakeshake-node/index.js#L29)
{% include feedback.html tutorial="shake-shake" %}

Просмотреть файл

@ -34,172 +34,3 @@ variable:
name: macOS
last_modified_at: 2017-07-17
---
In this project, you learn how to use the magnetic sensor to detect magnetic field, triggering the SendGrid service to send notification to your email when the change of magnetic field is too large. A useful situation is that you can attach it to your door with a magnet. Then it could detect the state of your door and notify you when you away.
{% include toc icon="columns" %}
## What you need
Finish the [Getting Started Guide]({{"/docs/get-started/" | absolute_url }}) to:
* Have your DevKit connected to Wi-Fi
* Prepare the development environment
An active Azure subscription. If you do not have one, you can register via one of these methods:
* Activate a [free 30-day trial Microsoft Azure account](https://azure.microsoft.com/en-us/free/){:target="_blank"}.
* Claim your [Azure credit](https://azure.microsoft.com/en-us/pricing/member-offers/msdn-benefits-details/){:target="_blank"} if you are an MSDN or Visual Studio subscriber.
## Step 1. Deploy SendGrid service in Azure
[SendGrid](https://sendgrid.com/){:target="_blank"} is a cloud-based email delivery platform. We will use this service to send out email notifications.
**Note:** if you have deployed a SendGrid service, please go to [step 2](#step-2-deploy-iot-hub-in-azure).
{: .notice--info}
### A. SendGrid Deployment
To provision the service, we will use the **Deploy to Azure** button to provision Azure services. This button enables quick and easy deployment of your open source projects to Microsoft Azure.
Click the **Deploy to Azure**button, below.
[![Deploy to Azure](https://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FVSChina%2Fdevkit-door-monitor%2Fmaster%2FSendGridDeploy%2Fazuredeploy.json){:.click-action-tracker .click-tracker-name--DeployToAzure target="_blank"}
You will then see the following page (or you should first sign in to Azure), completing the sign-up form:
* **Resource group**: Create a resource group to host the SendGrid service or use an existing one. See [Using resource groups to manage your Azure resources](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-portal){:target="_blank"}.
* **Name**: It is the name for your SendGrid service. You should choose a unique name differing from other services you may have.
* **Password**: The service requires a password, but we will not be using it for anything in this project.
* **Email**: The SendGrid service will send verification to this email address.
**Tip:** Check the **Pin to dashboard** option to make this application easier to find in the future.
{: .notice--success}
![SendGrid Deploy]({{"/assets/images/mini-solution/door-monitor/sendgrid-deploy.png" | absolute_url }})
### B. SendGrid API Key creation
After the deployment succeeds, click it and then click the **Manage** button. You will jump to your sendgrid page, and will need to verify your email address.
![SendGrid Manage]({{"/assets/images/mini-solution/door-monitor/sendgrid-manage.png" | absolute_url }})
On the sendgrid page, click **Settings** > **API Keys** > **Create API Key**. Input the **API Key Name** and click **Create & View**.
![SendGrid Create API First]({{"/assets/images/mini-solution/door-monitor/sendgrid-create-api-first.png" | absolute_url }})
![SendGrid Create API Second]({{"/assets/images/mini-solution/door-monitor/sendgrid-create-api-second.png" | absolute_url }})
Your API key will be displayed only one time. Please be sure to store it safely, as it will be used in the next step.
## Step 2. Deploy IoT Hub in Azure
We will now provision other Azure IoT related services and deploy Azure Functions for this project.
Click the **Deploy to Azure**button, below.
[![Deploy to Azure](https://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FVSChina%2Fdevkit-door-monitor%2Fmaster%2Fazuredeploy.json){:.click-action-tracker .click-tracker-name--DeployToAzure target="_blank"}
You will then see the following page (or you should first sign in to Azure), completing the sign-up form:
* **Resource group**: Create a resource group to host the SendGrid service or use an existing one. See [Using resource groups to manage your Azure resources](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-portal){:target="_blank"}.
* **Iot Hub Name**: This is the name for your IoT hub. You should choose a unique name differing from other services you may have.
* **Iot Hub Sku**: F1 (limited one per subscription) is free. You can see more pricing information at [pricing and scale tier](https://azure.microsoft.com/pricing/details/iot-hub/){:target="_blank"}.
* **From Email**: This should be the same email address you used when setting up the SendGrid service.
**Tip:** Check the **Pin to dashboard** option to make this application easier to find in the future.
{: .notice--success}
![IoTHub Deploy]({{"/assets/images/mini-solution/door-monitor/iot-hub-deploy.png" | absolute_url }})
## Step 3. Build and upload the code
### A. Start VS Code
- Make sure your DevKit is **not** connected to your computer.
- Start VS Code
- Connect the DevKit to your computer.
VS Code will automatically detect your DevKit and open an introduction page:
![VSCode]({{"/assets/images/mini-solution/vscode_start.png" | absolute_url }})
**Notice:** Occasionally, when you launch VS Code, you may be prompted with error message stating that it cannot find Arduino IDE or related board package. If this should happen, close VS Code, launch the Arduino IDE again and VS Code should locate the Arduino IDE path correctly.
{: .notice--warning}
### B. Open Arduino Examples folder
Expand left side **ARDUINO EXAMPLES** section, browse to **Examples for MXCHIP AZ3166 > AzureIoT**, and select **DoorMonitor**. This will open a new VS Code window with a project folder in it.
![mini-solution-examples]({{"/assets/images/mini-solution/vscode_examples.png" | absolute_url }})
If you happen to close the pane, you can reopen it. Use `Ctrl+Shift+P` (macOS: `Cmd+Shift+P`) to open the command palette, type **Arduino**, and then find and select **Arduino: Examples**.
### C. Provision Azure services
In the solution window, run your task by typing `Ctrl+P` (macOS: `Cmd+P`) and entering `task cloud-provision` in the provided text box.:
In the VS Code terminal, an interactive command line will guide you through provisioning the required Azure services. You need to select all the same items from the prompted list that you previously provisioned in [Step 2]({{"/docs/projects/door-monitor#step-2-deploy-iot-hub-in-azure" | absolute_url }}).
![Cloud Provision]({{"/assets/images/mini-solution/door-monitor/cloud-prevision.png" | absolute_url }})
**Notice:** If the page hangs in the loading status when trying to sign in to Azure, please check this [FAQ steps]({{"/docs/faq/#page-hangs-when-log-in-azure" | absolute_url}}) to resolve this issue.
{: .notice--warning}
### D. Build and upload the device code
{% include switch.html content = page.variable %}
#### Windows
1. Use `Ctrl+P` to run `task device-upload`.
2. The terminal prompts you to enter configuration mode. To do so, hold down button A, then push and release the reset button. The screen displays the DevKit ID and 'Configuration'.
This sets the connection string that is retrieved from the `task cloud-provision` step.
VS Code then starts verifying and uploading the Arduino sketch to the DevKit:
![device-upload]({{"/assets/images/mini-solution/door-monitor/device-upload.png" | absolute_url }})
The DevKit reboots and starts running the code.
**Notice:** Occasionally, you may get an "Error: AZ3166: Unknown package" error messafge. This occurs when the board package index is not refreshed correctly. Check this [FAQ steps]({{"/docs/faq/#development" | absolute_url}}) to resolve this issue.
{: .notice--warning}
#### macOS
1. Put the DevKit into configuration mode:
Hold down button A, then push and release the reset button. The screen displays 'Configuration'.
2. Use `Cmd+P` to run `task device-upload`.
This sets the connection string that is retrieved from the `task cloud-provision` step.
VS Code then starts verifying and uploading the Arduino sketch to the DevKit:
![device-upload]({{"/assets/images/mini-solution/door-monitor/device-upload.png" | absolute_url }})
The DevKit reboots and starts running the code.
**Notice:** Occasionally, you may get an "Error: AZ3166: Unknown package" error message. This occurs when the board package index is not refreshed correctly. Check this [FAQ steps]({{"/docs/faq/#development" | absolute_url}}) to resolve this issue.
{: .notice--warning}
## Test the project
The program first initializes when the DevKit is in the presence of a stable magnetic field. After initialization, `Door closed` is displayed on the screen. When the magnetic field changes from the initial condition, the state changes to `Door opened`. Whenever the state changes from `closed -> opened` or `opened -> closed`, you will receive a email containing this information. (These email messages may take around 5 minutes to be received.)
{% include gallery id="layouts_gallery" caption="e.g.: use a magnet in the y axis, the magnetic field change and it is recognized as door opened." %}
**Note:** When receiving with two continuous emails, some of the email client would display wrongly. Please careful select an email client when you use.
{: .notice--info}
## Problems and feedback
If you encounter problems, you can refer to [FAQs]({{"/docs/faq/" | absolute_url }}) or reach out to us from the channels below.
{% include feedback.html tutorial="door-monitor" %}

Просмотреть файл

@ -81,7 +81,7 @@ The following are required to complete this lab:
- An [MXChip IoT DevKit](https://microsoft.github.io/azure-iot-developer-kit/)
- A computer running [Windows 10 Anniversary Edition](https://www.microsoft.com/en-us/software-download/windows10) or higher
- Finish the [Getting Started Guide]({{"/docs/get-started/" | absolute_url }}) to:
* Have your DevKit connected to Wi-Fi
* Have your IoT DevKit connected to Wi-Fi
* Upgrade to the latest firmware
* Prepare the development environment
- An active Azure subscription. If you do not have one, you can register via one of the methods:

Просмотреть файл

@ -34,7 +34,7 @@ The following are required to complete this lab:
- An [MXChip IoT DevKit](https://microsoft.github.io/azure-iot-developer-kit/)
- A computer running [Windows 10 Anniversary Edition](https://www.microsoft.com/en-us/software-download/windows10) or higher
- Finish the [Getting Started Guide]({{"/docs/get-started/" | absolute_url }}) to:
* Have your DevKit connected to Wi-Fi
* Have your IoT DevKit connected to Wi-Fi
* Upgrade to the latest firmware
* Prepare the development environment
- An active Azure subscription. If you do not have one, you can register via one of the methods:

Просмотреть файл

@ -31,7 +31,7 @@ The following are required to complete this lab:
- An [MXChip IoT DevKit](https://microsoft.github.io/azure-iot-developer-kit/)
- A computer running [Windows 10 Anniversary Edition](https://www.microsoft.com/en-us/software-download/windows10) or higher
- Finish the [Getting Started Guide]({{"/docs/get-started/" | absolute_url }}) to:
* Have your DevKit connected to Wi-Fi
* Have your IoT DevKit connected to Wi-Fi
* Upgrade to the latest firmware
* Prepare the development environment
- An active Azure subscription. If you do not have one, you can register via one of the methods:

Просмотреть файл

@ -39,7 +39,7 @@ The following are required to complete this lab:
- An [MXChip IoT DevKit](https://microsoft.github.io/azure-iot-developer-kit/)
- A computer running [Windows 10 Anniversary Edition](https://www.microsoft.com/en-us/software-download/windows10) or higher
- Finish the [Getting Started Guide]({{"/docs/get-started/" | absolute_url }}) to:
* Have your DevKit connected to Wi-Fi
* Have your IoT DevKit connected to Wi-Fi
* Upgrade to the latest firmware
* Prepare the development environment
- An active Azure subscription. If you do not have one, you can register via one of the methods:

Двоичные данные
docs/assets/images/photo-arthur.jpg Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 17 KiB

Двоичные данные
docs/assets/images/photo-liki.jpg Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.1 KiB

Просмотреть файл

@ -223,7 +223,7 @@
<p class="page__cta_secondary">
<a href="https://aka.ms/iot-devkit-simulator" target="_blank">Not having a DevKit yet? Try our simulator now.</a>
<a href="https://aka.ms/iot-devkit-simulator" target="_blank">Not having a IoT DevKit yet? Try our simulator now.</a>
</p>
@ -276,7 +276,7 @@
<div class="archive__item">
<div class="archive__item-teaser">
<img src="https://microsoft.github.io/azure-iot-developer-kit/assets/images/devkit-board-vector@2x.png" alt="DevKit Board" style="width: 50%;" />
<img src="https://microsoft.github.io/azure-iot-developer-kit/assets/images/devkit-board-vector@2x.png" alt="IoT DevKit Board" style="width: 50%;" />
</div>
@ -371,7 +371,7 @@
<div class="archive__item-excerpt">
<p>All the cool things you can do with an Arduino can be done with the DevKit. It is targeted for developers to create and prototype IoT projects, using a low-power device, quickly and easily. There are 25 external GPIO pins on the edge connector of the board, allowing you to connect to external sensors and actuators.</p>
<p>All the cool things you can do with an Arduino can be done with the IoT DevKit. It is targeted for developers to create and prototype IoT projects, using a low-power device, quickly and easily. There are 25 external GPIO pins on the edge connector of the board, allowing you to connect to external sensors and actuators.</p>
</div>