Introduction
In this part we will cover how to configure Azure IOT hub and make it ready for using it with Raspberry Pi or ESP8266 boards.
Things that you Need
- An ESP8266 Dev board or Raspberry Pi 2 or 3 or Pie Zero W or Node MCU. I will be using Raspberry Pi 2
- An active Azure subscription. If you do not have an Azure account, create a free Azure trial.
- A monitor, a USB keyboard, and mouse that connects to Pi.
- A Mac or PC that is running Windows or Linux.
- An internet connection.
- A 16 GB or above microSD card.
- A USB-SD adapter or microSD card to burn the operating system image onto the microSD card.
- A 5-volt 2-amp power supply with the 6-foot micro USB cable.
- An assembled Adafruit BME280 temperature, pressure, and humidity sensor or DHT22 Humidity and Temperature sensor. We will be using DHT22 Humidity and temperature sensor
- A breadboard.
- Some jumper wires.
- LED.
Create an IoT hub
- Sign in to the Azure portal.
- Select Create a resource > Internet of Things > IoT Hub.
In the IOT hub pane, enter the following information for your IOT hub:
- Name: Create a name for your IOT hub. If the name you enter is valid, a green check mark appears.
Note: The IOT hub will be publicly discoverable as a DNS endpoint, so make sure to avoid any sensitive information while naming it.
- Pricing and scale tier: For this tutorial, select the F1 – Free tier. For more information, see the Pricing and scale tier.
- Resource group: Create a resource group to host the IOT hub or use an existing one. For more information, see Use resource groups to manage your Azure resources
- Location: Select the closest location to you.
- Pin to dashboard: Check this option for easy access to your IOT hub from the dashboard.
Click Create. Your IOT hub might take a few minutes to create. You can monitor the progress in the Notifications pane.
OIn IoT hub, locate the important information that you use to connect devices and applications to your IoT hub.
Note down the Hostname and connection string of the iothub
Register a Device in IOT HUB for the device
- Open your IoT hub and click Device Explorer.
- In the Device Explorer pane, click Add to add a device to your IoT hub. Then do the following:
- Device ID: Enter the ID of the new device. Device IDs are case sensitive.
- Authentication Type: Select Symmetric Key.
- Auto Generate Keys: Select this check box.
- Connect device to IoT Hub: Click Enable.
- Click Save.
- After the device is created, open the device in the Device Explorer pan and make a note of the primary key of the connection string.