Some edge dev stuff (#122)

* Adding content

* Update en.json

* Update README.md

* Update TRANSLATIONS.md

* Adding lesson tempolates

* Fixing code files with each others code in

* Update README.md

* Adding lesson 16

* Adding virtual camera

* Adding Wio Terminal camera capture

* Adding wio terminal code

* Adding SBC classification to lesson 16

* Adding challenge, review and assignment

* Adding images and using new Azure icons

* Update README.md

* Update iot-reference-architecture.png

* Adding structure for JulyOT links

* Removing icons

* Sketchnotes!

* Create lesson-1.png

* Starting on lesson 18

* Updated sketch

* Adding virtual distance sensor

* Adding Wio Terminal image classification

* Update README.md

* Adding structure for project 6 and wio terminal distance sensor

* Adding some of the smart timer stuff

* Updating sketchnotes

* Adding virtual device speech to text

* Adding chapter 21

* Language tweaks

* Lesson 22 stuff

* Update en.json

* Bumping seeed libraries

* Adding functions lab to lesson 22

* Almost done with LUIS

* Update README.md

* Reverting sunlight sensor change

Fixes #88

* Structure

* Adding speech to text lab for Pi

* Adding virtual device text to speech lab

* Finishing lesson 23

* Clarifying privacy

Fixes #99

* Update README.md

* Update hardware.md

* Update README.md

* Fixing some code samples that were wrong

* Adding more on translation

* Adding more on translator

* Update README.md

* Update README.md

* Adding public access to the container

* First part of retail object detection

* More on stock lesson

* Tweaks to maps lesson

* Update README.md

* Update pi-sensor.md

* IoT Edge install stuffs
pull/126/head
Jim Bennett 4 years ago committed by GitHub
parent 8a9703a153
commit 36434c6691
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,7 +19,7 @@ Connect the light sensor
![A grove light sensor](../../../images/grove-light-sensor.png)
1. Insert one end of a Grove cable into the socket on the light sensor module. It will only go in one way round.
1.
1. With the Raspberry Pi powered off, connect the other end of the Grove cable to the analog socket marked **A0** on the Grove Base hat attached to the Pi. This socket is the second from the right, on the row of sockets next to the GPIO pins.
![The grove light sensor connected to socket A0](../../../images/pi-light-sensor.png)

@ -1,5 +1,7 @@
# Run your fruit detector on the edge
<!-- This lesson is still under development -->
Add a sketchnote if possible/appropriate
This video gives an overview of running image classifiers on IoT devices, the topic that is covered in this lesson.
@ -18,9 +20,73 @@ In this lesson you will learn about
In this lesson we'll cover:
* [Thing 1](#thing-1)
* [Edge computing](#edge-computing)
* [Azure IoT Edge](#azure-iot-edge)
* [Register an IoT Edge device](#registeran-iot-edge-device)
* [Set up an IoT Edge device](#set-up-an-iot-dge-device)
* [Run your classifier on the edge](run-your-classifier-on-the-edge)
## Edge computing
## Azure IoT Edge
![The Azure IoT Edge logo](../../../images/azure-iot-edge-logo.png)
IoT Edge runs code from containers.
## Register an IoT Edge device
To use an IoT Edge device, it needs to be registered in IoT Hub.
### Task - register an IoT Edge device
1. Create an IoT Hub in the `fruit-quality-detector` resource group. Give it a unique name based around `fruit-quality-detector`.
1. Register an IoT Edge device called `fruit-quality-detector-edge` in your IoT Hub. The command to do this is similar to the one used to register a non-edge device, except you pass the `--edge-enabled` flag.
```sh
az iot hub device-identity create --edge-enabled \
--device-id fruit-quality-detector-edge \
--hub-name <hub_name>
```
Replace `<hub_name>` with the name of your IoT Hub.
1. Get the connection string for your device using the following command:
```sh
az iot hub device-identity connection-string show --device-id fruit-quality-detector-edge \
--output table \
--hub-name <hub_name>
```
Replace `<hub_name>` with the name of your IoT Hub.
Take a copy of the connection string that is shown in the output.
## Set up an IoT Edge device
### Task - set up an IoT Edge device
The IoT Edge runtime only runs Linux containers. It can be run on Linux, or on Windows using Linux Virtual Machines.
* If you are using a Raspberry Pi as your IoT device, then this runs a supported version of Linux and can host the IoT Edge runtime. Follow the [Install Azure IoT Edge for Linux guide on Microsoft docs](https://docs.microsoft.com/azure/iot-edge/how-to-install-iot-edge?WT.mc_id=academic-17441-jabenn) to install IoT Edge and set the connection string.
> 💁 Remember, Raspberry Pi OS is a variant of Debian Linux.
* If you are not using a Raspberry Pi, but have a Linux computer, you can run the IoT Edge runtime. Follow the [Install Azure IoT Edge for Linux guide on Microsoft docs](https://docs.microsoft.com/azure/iot-edge/how-to-install-iot-edge?WT.mc_id=academic-17441-jabenn) to install IoT Edge and set the connection string.
* If you are using Windows, you can install the IoT Edge runtime in a Linux Virtual Machine by following the [Install and start the IoT Edge runtime section of the Deploy your first IoT Edge module to a Windows device quickstart on Microsoft docs](https://docs.microsoft.com/azure/iot-edge/quickstart?WT.mc_id=academic-17441-jabenn#install-and-start-the-iot-edge-runtime). You can stop when you reach the *Deploy a module* section.
* If you are using macOS, you can create a virtual machine (VM) in the cloud to use for your IoT Edge device. These are computers you can create in the cloud and access over the internet. You can create a Linux VM that has IoT Edge installed. Follow the [Create a virtual machine running IoT Edge guide](vm-iotedge.md) for instructions on how to do this.
## Create a classifier that can run on the edge
## Run your classifier on the edge
### Task - deploy your classifier using IoT Edge
## Thing 1
### Task - use the edge classifier from your IoT device
---

@ -0,0 +1,66 @@
# Create a virtual machine running IoT Edge
In Azure, you can create a virtual machine - a computer in the cloud that you can configure any way you wish and run your own software on it.
> 💁 You can read more about virtual machines on teh [Virtual Machine page on Wikipedia](https://wikipedia.org/wiki/Virtual_machine).
## Task - Set up an IoT Edge virtual machine
1. Run the following command to create a VM that has Azure IoT Edge already pre-installed:
```sh
az deployment group create \
--resource-group fruit-quality-detector \
--template-uri https://raw.githubusercontent.com/Azure/iotedge-vm-deploy/1.2.0/edgeDeploy.json \
--parameters dnsLabelPrefix=<vm_name> \
--parameters adminUsername=<username> \
--parameters deviceConnectionString="<connection_string>" \
--parameters authenticationType=password \
--parameters adminPasswordOrKey="<password>"
```
Replace `<vm_name>` with a name for this virtual machine. This needs to be globally unique, so use something like `fruit-quality-detector-vm-` with your name or another value on the end.
Replace `<username>` and `<password>` with a username and password to use to log in to the VM. These need to be relatively secure, so you can't use admin/password.
Replace `<connection_string>` with the connection string of your `fruit-quality-detector-edge` IoT Edge device.
This will create a VM configured as a `DS1 v2` virtual machine. These categories indicate how powerful the machine is, and therefor how much it costs. This VM has 1 CPU and 3.5GB of RAM.
> 💰 You can see the current pricing of these VMs on the [Azure Virtual Machine pricing guide](https://azure.microsoft.com/pricing/details/virtual-machines/linux/?WT.mc_id=academic-17441-jabenn)
Once the VM has been created, the IoT Edge runtime will be installed automatically, and configured you connect to your IoT Hub as your `fruit-quality-detector-edge` device.
1. VMs cost money. At the time of writing, a DS1 VM costs about $0.06 per hour. To keep costs down, you should shut down the VM when you are not using it, and delete it when you are finished with this project.
To shut down the VM, use the following command:
```sh
az vm deallocate --resource-group fruit-quality-detector \
--name <vm_name>
```
Replace `<vm_name>` with the name of your virtual machine.
> 💁 There is an `az vm stop` command which will stop the VM, but it keeps the computer allocated to you, so you still pay as if it was still running.
To restart the VM, use the following command:
```sh
az vm start --resource-group fruit-quality-detector \
--name <vm_name>
```
Replace `<vm_name>` with the name of your virtual machine.
You can also configure your VM to automatically shut down at a certain time each day. This means if you forget to shut it down, you won't be billed for more than the time till the automatic shutdown. Use the following command to set this:
```sh
az vm auto-shutdown --resource-group fruit-quality-detector \
--name <vm_name> \
--time <shutdown_time_utc>
```
Replace `<vm_name>` with the name of your virtual machine.
Replace `<shutdown_time_utc>` with the UTC time that you want the VM to shut down using 4 digits as HHMM. For example, if you want to shutdown at midnight UTC, you would set this to `0000`. For 7:30PM on the west coast of the USA, you would use 0230 (7:30PM on the US west coast is 2:30AM UTC).
Loading…
Cancel
Save