Getting Started with Microsoft Azure IoT Central using NodeMCU ESP8266

How To Electronics
13 Jun 202213:44

Summary

TLDRThis tutorial introduces viewers to Microsoft Azure IoT Hub, a cloud-based service that facilitates communication between IoT applications and connected devices. The guide demonstrates setting up an Azure IoT Central, creating device templates, and visualizing sensor data on a dashboard using a DHT11 sensor and NodeMCU ESP8266 board. It offers step-by-step instructions on connecting devices securely, uploading code, and visualizing data, making it an invaluable resource for beginners interested in IoT.

Takeaways

  • πŸ˜€ The video is a tutorial on getting started with Microsoft Azure IoT Hub, a cloud-based service for IoT applications.
  • πŸ”Œ It covers the use of an ESP8266 board along with a DHT11 sensor for measuring temperature and humidity.
  • πŸ’» The tutorial guides through setting up an Azure IoT Central application and creating device templates and devices.
  • πŸ“ˆ It demonstrates how to upload sensor data to Azure and visualize it on a dashboard.
  • 🌐 The Azure IoT Hub can connect millions of devices with internet connectivity, ensuring reliable and secure communication.
  • πŸ› οΈ The video provides a connection diagram for the DHT11 sensor to the NodeMCU ESP8266 board.
  • πŸ”‘ It explains the process of creating a Microsoft account and setting up an Azure subscription for accessing IoT Hub services.
  • πŸ“ The tutorial includes instructions for modifying the code in the 'dst' file to include Wi-Fi credentials and Azure IoT Hub connection details.
  • πŸ”„ The script details the steps to upload the code to the NodeMCU board and monitor the connection process through the serial monitor.
  • πŸ“Š After successful connection, the script shows how to view the visualized data on the Azure IoT Central dashboard.
  • πŸ“š Additional resources, including source code and diagrams, are available on the 'How To Electronics' website for further learning.

Q & A

  • What is Microsoft Azure IoT Hub?

    -Microsoft Azure IoT Hub is a cloud-hosted service that acts as a central message hub for communication between an IoT application and its attached devices, allowing the connection of millions of devices reliably and securely.

  • What is the purpose of the tutorial in the script?

    -The purpose of the tutorial is to provide a getting started guide on using Microsoft Azure IoT Hub with a DHT11 humidity and temperature sensor along with a NodeMCU ESP8266 board, including setting up an Azure IoT Central, creating templates and devices, and visualizing sensor data on an Azure dashboard.

  • What components are needed to start this project?

    -To start this project, you need a NodeMCU ESP8266 board, a DHT11 humidity and temperature sensor, female-to-female jumper wires for connecting the sensor to the board, and a Wi-Fi enabled device to access the Azure portal.

  • How can one create an account for Azure services?

    -To create an account for Azure services, you need a Microsoft account, which can be created using Hotmail or Outlook. During the sign-up process, a credit or debit card is required for enabling Azure services, but no money is deducted for the first 12 months.

  • What is the process of creating an Azure IoT Central application?

    -The process involves signing in with a Microsoft account, searching for 'IoT Central application' in the Azure portal, filling in project details, creating a new resource group, naming the application, selecting a template, choosing a region, and selecting a pricing plan before clicking 'Review + Create' to deploy the application.

  • What is a device template in Azure IoT Central?

    -A device template in Azure IoT Central is a blueprint that defines the capabilities and behaviors of a device, including telemetry, properties, and commands, which helps in creating and managing devices in the application.

  • How does one connect a physical device to Azure IoT Central?

    -After creating a device in Azure IoT Central, you can connect it by using the device connection details, such as the scope ID, device ID, and primary/secondary keys, which can be found in the 'Connect' section of the device's overview in the Azure portal.

  • What is the role of the GitHub repository mentioned in the script?

    -The GitHub repository mentioned in the script contains the complete code and resources needed for connecting a NodeMCU ESP8266 device to Azure IoT Central, including the Arduino files for the PubSub client function and JSON files for uploading device capabilities to Azure IoT Hub.

  • How does the NodeMCU board communicate with Azure IoT Central?

    -The NodeMCU board communicates with Azure IoT Central by uploading the sensor data (temperature and humidity in this case) to the cloud using the PubSub client function, which then gets visualized on the Azure IoT Central dashboard.

  • What modifications are needed in the code for the NodeMCU board?

    -The modifications needed in the code include entering the Wi-Fi SSID and password, pasting the scope ID, device ID, and primary device key from the Azure IoT Central portal, and ensuring the correct variables for temperature and humidity telemetry are set.

  • How can one visualize the sensor data on the Azure IoT Central dashboard?

    -After the device is connected and sending data, the sensor data can be visualized on the Azure IoT Central dashboard by creating views and default dashboard views, where you can customize the appearance, data range, and telemetry details of the graphs.

Outlines

00:00

πŸ˜€ Getting Started with Microsoft Azure IoT Hub

This paragraph introduces a tutorial on Microsoft Azure IoT Hub, comparing it to Amazon AWS IoT. The speaker plans to use a DHT11 sensor and NodeMCU ESP8266 board to demonstrate the setup of Azure IoT Central, device templates, and data visualization on the Azure dashboard. It's aimed at beginners and also mentions a service for professional PCB design.

05:00

πŸ› οΈ Setting Up Azure IoT Central and Device Templates

The speaker guides viewers through the process of setting up an Azure IoT Central application, creating a device template, and adding telemetry capabilities for temperature and humidity. The tutorial covers navigating the Azure portal, selecting a region, and customizing the dashboard for data visualization. It also explains how to create a device using the template and provides connection details for secure device connectivity.

10:01

πŸ”§ Programming NodeMCU ESP8266 for Azure IoT Hub

This section details the coding process for the NodeMCU ESP8266 to connect with Azure IoT Hub, including modifying Wi-Fi credentials and Azure connection details within the code. The tutorial instructs on uploading the code to the device using Arduino IDE, and monitoring the serial output to confirm successful connection and data transmission. The final step is visualizing the temperature and humidity data on the Azure IoT Central dashboard.

Mindmap

Keywords

πŸ’‘Azure IoT Hub

Azure IoT Hub is a managed cloud service from Microsoft that acts as a central hub for communication between IoT devices and their backend solutions. It enables the secure and reliable connection of millions of devices to the cloud. In the video, it is presented as the main platform for collecting and visualizing sensor data from devices like the DHT11 connected to an ESP8266.

πŸ’‘ESP8266

The ESP8266 is a low-cost Wi-Fi microchip with full TCP/IP stack and microcontroller capability, used for connecting devices to the internet. In the video, the ESP8266 is mentioned as the primary device for connecting a DHT11 sensor to Azure IoT Hub, allowing the data to be sent and visualized on the cloud platform.

πŸ’‘DHT11 Sensor

The DHT11 is a basic, low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air and spits out a digital signal. In the video, the DHT11 is used to gather temperature and humidity data, which is then sent to Azure IoT Hub via the ESP8266.

πŸ’‘Device Template

A Device Template in Azure IoT Hub defines the structure and behavior of an IoT device, including its capabilities and telemetry. In the video, creating a device template is a crucial step that involves defining the data types (like temperature and humidity) that will be sent from the DHT11 sensor and visualized on the Azure dashboard.

πŸ’‘Telemetry

Telemetry refers to the automated process of collecting data remotely and transmitting it to receiving equipment for monitoring. In the context of the video, telemetry data includes the temperature and humidity readings sent from the DHT11 sensor to the Azure IoT Hub for real-time monitoring and visualization.

πŸ’‘NodeMCU

NodeMCU is an open-source IoT platform based on the ESP8266 Wi-Fi chip, which integrates GPIO, PWM, I2C, 1-Wire, and ADC all in one board. It simplifies IoT device development by providing a programmable environment. In the video, NodeMCU is used to interface the DHT11 sensor with Azure IoT Hub, enabling the sensor data to be sent to the cloud.

πŸ’‘Wi-Fi SSID

A Wi-Fi SSID (Service Set Identifier) is the name of a wireless network. Devices use the SSID to establish a connection with the appropriate network. In the video, configuring the Wi-Fi SSID and password is necessary to connect the NodeMCU ESP8266 to the internet, which is required for transmitting sensor data to Azure IoT Hub.

πŸ’‘Device Connection String

A Device Connection String is a unique identifier that includes credentials for connecting a specific IoT device to Azure IoT Hub. It typically contains information like the scope ID, device ID, and keys. In the video, the connection string is configured in the code to securely connect the NodeMCU and DHT11 sensor to Azure IoT Hub.

πŸ’‘Azure IoT Central

Azure IoT Central is an IoT application platform that simplifies the creation, management, and operation of IoT solutions. It abstracts much of the underlying complexity, making it easier to deploy IoT solutions quickly. In the video, Azure IoT Central is used to set up an application where the DHT11 sensor data is visualized after being sent from the ESP8266.

πŸ’‘Visualization

Visualization in the context of IoT refers to the graphical representation of data collected from IoT devices. It helps users understand and analyze the data more easily. In the video, after setting up the Azure IoT Central application, the temperature and humidity data from the DHT11 sensor is visualized in real-time using graphs on the Azure dashboard.

Highlights

Introduction to Microsoft Azure IoT Hub as a central message hub for IoT applications and devices.

Comparison of Azure IoT Hub with AWS IoT for cloud-based IoT solutions.

Capability of Azure IoT Hub to connect millions of devices reliably and securely.

Use of DHT11 humidity and temperature sensor with NodeMCU ESP8266 board for demonstration.

Tutorial's utility for beginners interested in learning about Azure IoT Hub.

Promotion of Next PCB for professional PCB design and manufacturing services.

Detailed connection diagram for DHT11 sensor with NodeMCU.

Step-by-step guide on setting up an Azure IoT Central application.

Explanation of creating a device template in Azure IoT Central for custom devices.

Demonstration of adding telemetry data fields for temperature and humidity in the device template.

Instructions on customizing and publishing default dashboard views in Azure IoT Central.

Process of creating a device in Azure IoT Central using the created template.

Retrieval of device connection details for secure device connection to Azure IoT Central.

GitHub repository reference for NodeMCU and Azure IoT Central integration code.

Modification of the code to include Wi-Fi credentials and Azure IoT Central connection details.

Compilation and upload of the code to NodeMCU using Arduino IDE.

Real-time monitoring and visualization of sensor data on the Azure IoT Central dashboard.

Completion of the project with a successful connection and data visualization in Azure IoT Central.

Availability of project details, source code, and diagrams on the How to Electronics website.

Encouragement for viewers to subscribe to the channel for more educational content.

Transcripts

play00:00

hi everyone welcome to how to

play00:01

electronics

play00:03

this is a getting started tutorial on

play00:05

microsoft azure iot hub

play00:07

earlier i've made a couple of videos on

play00:10

imagine aws iot code using esp8266 and

play00:14

esp32 the azure iot hub is a similar

play00:18

cloud platform from microsoft

play00:20

azure iot hub is a managed service

play00:22

hosted in the cloud that acts as a

play00:25

central message hub for communication

play00:27

between an iot application and its

play00:30

attached devices

play00:32

you can connect millions of devices and

play00:34

their backend solution reliably and

play00:37

securely

play00:38

l must any devices with internet

play00:41

connectivity can be connected to an iot

play00:43

hub

play00:44

in this getting started guide i will be

play00:46

using dht11 humidity and temperature

play00:50

sensor along with nodemcu

play00:52

esp82662le board

play00:54

we'll be setting up an azure iot central

play00:57

and creating templates and devices

play01:01

finally we'll upload the dht 11 sensor

play01:04

data and visualize it on azure dashboard

play01:07

this tutorial is going to be very very

play01:09

useful for all the beginners who want to

play01:11

learn about azure iot hub

play01:14

so without getting any further delay

play01:16

let's get started

play01:28

do you want professional pcb like this

play01:30

one that looks so good then use the

play01:32

services of next pcb you can select the

play01:34

board size any solder color marks that

play01:37

you want including something like red

play01:39

and green you can select the thickness

play01:41

and the pcb could be from 2 to 32 layers

play01:43

for some more complex design the finish

play01:46

quality is so good and if you want

play01:47

better connectivity you could also

play01:49

select some gold finish for the pads the

play01:51

ordering process is so easy just go to

play01:54

nexpcb.com then quit now insert your

play01:57

design settings upload your color file

play01:59

and order now and receive the pcb in

play02:01

couple of days welcome back again now

play02:04

the first thing that we need in this

play02:05

project is wi-fi enable chip for this

play02:08

nodemcu esp8266 is best

play02:11

and for the sensor part we'll be using

play02:13

the dht 11 humidity and temperature

play02:16

sensor and we'll also need female to

play02:18

female jumper squads for connecting dht

play02:20

11 with nodemcu so here is the

play02:23

connection diagram connect the ground to

play02:25

ground vcc to 3v3 and the digital pin to

play02:29

d4 that is gpio2 of node mco you can

play02:33

either connect directly with the jumper

play02:35

wires or maybe you can use a breadboard

play02:37

for the connection part now let's move

play02:40

to the practical part so go to the

play02:42

google chrome or any other web browser

play02:45

and look for azure iot hub so here is

play02:48

the first link so click on the first

play02:50

link here so now you need to create an

play02:53

account now to create an account you

play02:55

need a microsoft account you can either

play02:58

create a microsoft account using hotmail

play03:00

or maybe you can use an outlook so i

play03:03

have already a microsoft account so i

play03:05

will be signing in here using a

play03:07

microsoft account so for the 12 month it

play03:10

is free but to sign up for the assured

play03:13

account you need a credit card or a

play03:15

debit card remember no any money is

play03:19

reduced or detected from your account

play03:21

but for enabling the azure services you

play03:24

need a debit card here is the azure

play03:26

portal so initially you will be getting

play03:28

a 200 credit balance you can use this

play03:32

for your application purpose

play03:34

now

play03:35

in this search bar search for

play03:37

iot central application

play03:40

click on this first link

play03:43

now we need to create a application here

play03:47

so click on create

play03:49

now in the create part so we have to

play03:52

first fill the project details so in the

play03:54

subscription part uh select a plan that

play03:57

you created for example you can select

play03:59

azure subscription one and in the

play04:02

resource group

play04:04

you need to

play04:05

add a group but no group projected so

play04:07

create a group now i'll be naming this

play04:09

group as how to electronics

play04:12

then click on ok

play04:15

in the instant details you need to give

play04:17

a resource any name for example i'll be

play04:20

giving a name as

play04:21

mydst11 and in the application url give

play04:25

any name i'll be naming it same again so

play04:28

the link will be mydst here

play04:30

iotcentral.com

play04:32

now in the template part you need to

play04:35

create a template for example i will be

play04:37

selecting a custom application and in

play04:39

the region part select your nearest

play04:41

region like i am staying in southeast

play04:44

asia region so i'll be selecting

play04:46

southeast asia in the pricing plan

play04:49

select anything you want now click on

play04:51

review plus create so it will take a

play04:54

couple of minutes and the validation is

play04:57

passed now click on create so the

play05:00

deployment is in progress so it might

play05:02

take couple of minutes so finally the

play05:06

device is deployed and the deployment is

play05:09

successful as you can see here

play05:13

now what we need is we need to go ahead

play05:16

so for that click one go to resources

play05:18

now here we have a resource

play05:21

like we have a resource group name

play05:23

subscription subscription id and the

play05:25

status that is succeeded on this right

play05:28

side you can see a link called iot

play05:30

central application url

play05:33

just click on this link so a new tab

play05:36

will open with the device

play05:38

name

play05:39

now here we need to first create a

play05:42

device template before creating a device

play05:44

so click on device template on the left

play05:47

side and here click on create a device

play05:50

template now here are

play05:53

so many devices template that is already

play05:56

created by so many other manufacturers

play05:58

and distributor

play06:00

we don't need this as we'll be creating

play06:02

our own device so click on iot device

play06:05

and click on next customize keep the

play06:07

template any name for example i will be

play06:09

naming it at mydst11 then click on next

play06:13

and then click on create

play06:16

so

play06:16

uh model need to be selected here so in

play06:19

order to select a model select custom

play06:21

module so

play06:22

uh application has been updated here now

play06:26

we need to add a capability now in order

play06:29

to get a capability click on add

play06:30

capability and here give a display name

play06:33

for example i will be naming it as

play06:35

temperature and the name automatically

play06:37

temperature will be taken in the

play06:39

capability part put it as a telemetry

play06:41

and in the semantic type

play06:43

we have a default variable called

play06:45

temperature

play06:46

do the same thing for the humidity

play06:48

in the humidity part i'll be selecting

play06:50

relative humidity so now click on save

play06:53

here

play06:55

now go on views and select general

play06:57

default views

play06:59

and then

play07:00

click on gender default dashboard views

play07:03

so the views has also been created now

play07:06

if you go to the outputs tab here you

play07:08

will see a three graph like one is the

play07:11

temperature humidity the other is the

play07:13

temperature and the third one is the

play07:15

humidity graph literally you can modify

play07:17

the title x axis y axis and the data

play07:20

range and the interval range and the

play07:23

telemetry or whatever capability you can

play07:25

add you can update it from here now you

play07:28

can also do the same thing for the

play07:30

temperature part you can increase or

play07:32

decrease the size you can put up to

play07:33

decimals or

play07:35

whatever you can do for it now in the

play07:37

visualization part uh just select last

play07:40

non value this is important also do the

play07:43

same thing for humidity

play07:45

just select last non value okay now it's

play07:50

done you can also select the size

play07:53

now click on publish here so publish

play07:55

dialog box will appear so click on

play07:57

publish again now go to the devices part

play08:00

as we have already created a template

play08:03

now we need to create a device to do

play08:04

this click on add a device

play08:07

now give device any name for example

play08:09

i'll be naming it as my dht11 also give

play08:12

a device id and from here select the

play08:16

device template i'll be selecting the

play08:18

device template which i created a couple

play08:20

of minutes ago now in the device id you

play08:22

can give any name to distinguish your

play08:24

device click on create

play08:27

so our device with the

play08:29

name my dht 11 has been created here

play08:33

now click on this device and here you

play08:35

can see in the about section there are

play08:36

no any capabilities added now if you go

play08:39

to the overview section here you will be

play08:41

seeing the three visualization box that

play08:44

is temperature humidity temperature and

play08:46

humidity in the raw data will be

play08:48

receiving the data from the sensor now

play08:51

here click one connect now when you

play08:53

click on connect now when you click on

play08:55

connect you will get device connection

play08:57

group as id scope my device

play09:00

authentication type key as primary and

play09:02

secondary key you will also get a qr

play09:05

code here so it's just like a plug and

play09:07

play option from which you can connect a

play09:10

device to the iot central securely but

play09:13

for now we'll be connecting it using our

play09:14

key all of the thing is done from this

play09:17

end now go to this github repository so

play09:20

there is a guy called aerosol samuel so

play09:23

he has created a complete repository for

play09:26

nodemcu2 is your iot central you can

play09:30

just download this project code whatever

play09:32

is needed right now so after downloading

play09:36

open this zip file and extract it to

play09:38

your desktop or anywhere you want now

play09:41

when you open this up folder you will

play09:43

get a source folder now the source

play09:45

folder will be having so many files like

play09:48

it will be having arduino files for the

play09:51

pop sub client function and it will be

play09:53

also having uh common files used for

play09:56

uploading the code in json format to

play09:58

azure iot hub what you need is we need

play10:01

to open this dst file now this is the

play10:04

main code used in this project now here

play10:06

is the complete code so in this code

play10:08

part we need to modify something now the

play10:11

first modification that you need is we

play10:14

need to make a change to wipe ssid enter

play10:17

your wi-fi ssid here then enter your

play10:19

wi-fi password now in the scope id uh we

play10:23

need to copy the so this is the scope id

play10:26

from the azure central

play10:29

just copy and paste it here we also need

play10:31

to copy and paste the device id so my

play10:33

device id in my dht level so just copy

play10:36

and paste it here now in the device key

play10:39

part we need to copy the primary key

play10:42

and paste it over here so the primary

play10:45

key is also

play10:46

pasted here now when you go down in the

play10:49

loop section you will see the how the

play10:51

dst 11 temperature immediately is shared

play10:53

and in this post function we will see

play10:56

two variables as temperature and

play10:58

humidity remember these two variables

play11:00

are variables are very very important if

play11:02

you want to add thought variables you

play11:04

can just follow this format

play11:06

so the coding part is done now what we

play11:09

need to do is uh go to the tools and

play11:12

from the tools

play11:13

select word manager in the board manager

play11:16

part

play11:17

type esp8266

play11:19

now here i have selected 2.7.4 version

play11:23

of esp8266 as the latest person is

play11:26

unable to work so install 2.7.4 version

play11:30

as compilation issue has occurred when i

play11:33

selected the other versions now go to

play11:35

tools and from this board list select

play11:38

nodemcu 1.0 board then connect your

play11:41

nodemcu to the computer

play11:46

from the tools select the port

play11:49

now click on upload to upload the code

play11:53

once the code is uploaded open the

play11:55

serial monitor so it will go through all

play11:58

the process of connecting the wi-fi and

play12:01

establishing the

play12:02

connection with the azure iot central so

play12:06

once connected it will show some of the

play12:09

host name operation id and the user name

play12:12

and the password for accessing

play12:13

connection so the device has been

play12:15

connected successfully so you can say

play12:18

the event was received and the payload

play12:20

of temperature and humidity has been

play12:23

successfully sent and has been received

play12:26

by the azure dashboard now where we can

play12:29

visualize this data in order to

play12:31

visualize this data now go to your

play12:34

actual central dashboard so here you can

play12:37

see the temperature is 30.6 and the

play12:41

humidity is height 3.00

play12:44

so on this left raw data part you can

play12:47

see the raw data has been

play12:51

updated or connected and the event

play12:53

creation time every details are here and

play12:55

you can see a connected message is

play12:58

appearing here

play12:59

you can change this visualize option or

play13:02

if you don't want you can

play13:04

simply remove it

play13:06

again if you go to the data there will

play13:08

be a series of sequence where data are

play13:10

uploaded here so this is how we can get

play13:14

started with azure iot hub central and

play13:17

send the data of any sensor using the

play13:20

esp8266 to the azure iot hub the

play13:23

complete details of this project has

play13:25

been uploaded in the website articles of

play13:27

how to electronics you can get the

play13:28

source code diagram and all the detailed

play13:31

procedure on connecting the device with

play13:34

the actual iot hub i hope this tutorial

play13:37

has cleared so many doubts thank you so

play13:40

much for watching and please subscribe

play13:41

our channel for more such videos

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
IoT HubAzure TutorialESP8266DHT11 SensorNodeMCU BoardCloud PlatformData VisualizationSensor DataIoT ApplicationDIY Electronics