{"id":1926,"date":"2019-12-31T23:03:18","date_gmt":"2020-01-01T07:03:18","guid":{"rendered":"https:\/\/doubleecpu.com\/?page_id=1926"},"modified":"2020-01-10T00:25:28","modified_gmt":"2020-01-10T08:25:28","slug":"azure-services","status":"publish","type":"page","link":"https:\/\/doubleecpu.com\/index.php\/azure-services\/","title":{"rendered":"Azure Services"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Links to docs.microsoft.com<\/h2>\n\n\n\n<p><a href=\"https:\/\/catalog.azureiotsolutions.com\/docs?title=Azure\/azure-iot-device-ecosystem\/setup_iothub\">IOT Device Setup<\/a><br><a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/iot-hub\/iot-hub-devguide\">IoT Hub Developer Guide <\/a><br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Connecting RaspberryPi to Azure IoT Hub<\/h2>\n\n\n\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/iot-hub\/quickstart-send-telemetry-python\">Send telemetry data (MQTT messages) from RaspberryPi using Python<\/a> <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Create an IoT hub and register a device with the hub. <\/h3>\n\n\n\n<p> In a  Cloud Shell (CLI) instance add the Azure IoT Extension, to add  IoT Hub, IoT Edge, and IoT Device Provisioning Service (DPS) commands to Azure CLI. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">  az extension add --name azure-cli-iot-ext <\/pre>\n\n\n\n<p>On Azure services find and click on IoT Hub<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1229\" height=\"279\" src=\"https:\/\/doubleecpu.com\/wp-content\/uploads\/2020\/01\/image-1.png\" alt=\"\" class=\"wp-image-1936\"\/><\/figure>\n\n\n\n<p>On the IoT Hub click the + Add to create a new IoT Resource<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1249\" height=\"272\" src=\"https:\/\/doubleecpu.com\/wp-content\/uploads\/2020\/01\/image.png\" alt=\"\" class=\"wp-image-1935\"\/><\/figure>\n\n\n\n<p>Select Subscription<br>Create New Resource Group and call it RaspberryPiAzureIoT<br>Select Region<br>Enter IoT Hub Name RaspberryPiSenseHat<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1256\" height=\"866\" src=\"https:\/\/doubleecpu.com\/wp-content\/uploads\/2020\/01\/image-2.png\" alt=\"\" class=\"wp-image-1937\"\/><\/figure>\n\n\n\n<p>Click Next: Size and scale <br>Pricing and scale tier : F1: Free Tier  *(only one free resource per Hub)<br>Number of S1 IoT Hub units: 1    (can be increased later)<br>under Advanced Settings<br>Device-to-cloud partitions : 2<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1236\" height=\"1045\" src=\"https:\/\/doubleecpu.com\/wp-content\/uploads\/2020\/01\/image-3.png\" alt=\"\" class=\"wp-image-1938\"\/><\/figure>\n\n\n\n<p>Click the Create button to create the IoT Hub resource <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1248\" height=\"741\" src=\"https:\/\/doubleecpu.com\/wp-content\/uploads\/2020\/01\/image-4.png\" alt=\"\" class=\"wp-image-1940\"\/><\/figure>\n\n\n\n<p>Wait until deployment completes<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1104\" height=\"402\" src=\"https:\/\/doubleecpu.com\/wp-content\/uploads\/2020\/01\/image-5.png\" alt=\"\" class=\"wp-image-1941\"\/><\/figure>\n\n\n\n<p>Create IoT Device on Azure<\/p>\n\n\n\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n\n\n\n<p>Register the RaspberryPi to the Azure IoT Hub using the Azure cloud shell CLI. Use RaspberryPiSenseHat as {YourIoTHubName} and SenseHat as {MyPythonDevice}<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">az iot hub device-identity create --hub-name RaspberryPiSenseHat --device-id SenseHat<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Send Sense Hat Data to Azure<\/h3>\n\n\n\n<p>For this example a RaspberryPi 3 B+  was used running Rasbian Buster Lite, with Python 3.7.3, Thonny 3.2.0 and Sense Hat installed.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Install Azure-IoT on RaspberryPi<\/h4>\n\n\n\n<p>Open a terminal window and install azure iot Python module<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> pip3 install azure-iot-device<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1329\" height=\"268\" src=\"https:\/\/doubleecpu.com\/wp-content\/uploads\/2020\/01\/image-7.png\" alt=\"\" class=\"wp-image-1946\"\/><\/figure>\n\n\n\n<p>Download  and extract the ZIP archive of the sample Python project from:<br>\u00a0<a href=\"https:\/\/github.com\/Azure-Samples\/azure-iot-samples-python\/archive\/master.zip\">https:\/\/github.com\/Azure-Samples\/azure-iot-samples-python\/archive\/master.zip<\/a>\u00a0.  <br>In this example files were extracted to directory:<br>\/home\/pi\/Public\/Azure\/azure-iot-samples-python-master<\/p>\n\n\n\n<p>Use the Azure CLI to get the device connection string.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">az iot hub device-identity show-connection-string --hub-name  RaspberryPiSenseHat  --device-id  SenseHat --output table<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1528\" height=\"525\" src=\"https:\/\/doubleecpu.com\/wp-content\/uploads\/2020\/01\/image-9.png\" alt=\"\" class=\"wp-image-1948\"\/><\/figure>\n\n\n\n<p>Navigate to the\u00a0<strong>iot-hub\\Quickstarts\\simulated-device<\/strong>\u00a0folder and open the\u00a0<strong>SimulatedDevice.py<\/strong>\u00a0and replace CONNECTION_STRING value to the value from CLI<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1055\" height=\"772\" src=\"https:\/\/doubleecpu.com\/wp-content\/uploads\/2020\/01\/image-8.png\" alt=\"\" class=\"wp-image-1947\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/samples\/azure-samples\/functions-js-iot-hub-processing\/processing-data-from-iot-hub-with-azure-functions\/\">Processing data from IoT Hub with Azure Functions<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Links to docs.microsoft.com IOT Device SetupIoT Hub Developer Guide Connecting RaspberryPi to Azure IoT Hub Send telemetry data (MQTT messages) from RaspberryPi using Python Create an IoT hub and register a device with the hub. In a Cloud Shell (CLI) instance add the Azure IoT Extension, to add IoT Hub, IoT Edge, and IoT Device &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/doubleecpu.com\/index.php\/azure-services\/\" class=\"more-link\">Read more<span class=\"screen-reader-text\"> &#8220;Azure Services&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1926","page","type-page","status-publish","hentry"],"featured_media_urls":[],"_links":{"self":[{"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/pages\/1926","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/comments?post=1926"}],"version-history":[{"count":0,"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/pages\/1926\/revisions"}],"wp:attachment":[{"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/media?parent=1926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}