Getting Started with Microsoft Azure IoT Central using NodeMCU ESP8266
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
😀 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.
🛠️ 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.
🔧 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
💡ESP8266
💡DHT11 Sensor
💡Device Template
💡Telemetry
💡NodeMCU
💡Wi-Fi SSID
💡Device Connection String
💡Azure IoT Central
💡Visualization
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
hi everyone welcome to how to
electronics
this is a getting started tutorial on
microsoft azure iot hub
earlier i've made a couple of videos on
imagine aws iot code using esp8266 and
esp32 the azure iot hub is a similar
cloud platform from microsoft
azure iot hub is a managed service
hosted in the cloud that acts as a
central message hub for communication
between an iot application and its
attached devices
you can connect millions of devices and
their backend solution reliably and
securely
l must any devices with internet
connectivity can be connected to an iot
hub
in this getting started guide i will be
using dht11 humidity and temperature
sensor along with nodemcu
esp82662le board
we'll be setting up an azure iot central
and creating templates and devices
finally we'll upload the dht 11 sensor
data and visualize it on azure dashboard
this tutorial is going to be very very
useful for all the beginners who want to
learn about azure iot hub
so without getting any further delay
let's get started
do you want professional pcb like this
one that looks so good then use the
services of next pcb you can select the
board size any solder color marks that
you want including something like red
and green you can select the thickness
and the pcb could be from 2 to 32 layers
for some more complex design the finish
quality is so good and if you want
better connectivity you could also
select some gold finish for the pads the
ordering process is so easy just go to
nexpcb.com then quit now insert your
design settings upload your color file
and order now and receive the pcb in
couple of days welcome back again now
the first thing that we need in this
project is wi-fi enable chip for this
nodemcu esp8266 is best
and for the sensor part we'll be using
the dht 11 humidity and temperature
sensor and we'll also need female to
female jumper squads for connecting dht
11 with nodemcu so here is the
connection diagram connect the ground to
ground vcc to 3v3 and the digital pin to
d4 that is gpio2 of node mco you can
either connect directly with the jumper
wires or maybe you can use a breadboard
for the connection part now let's move
to the practical part so go to the
google chrome or any other web browser
and look for azure iot hub so here is
the first link so click on the first
link here so now you need to create an
account now to create an account you
need a microsoft account you can either
create a microsoft account using hotmail
or maybe you can use an outlook so i
have already a microsoft account so i
will be signing in here using a
microsoft account so for the 12 month it
is free but to sign up for the assured
account you need a credit card or a
debit card remember no any money is
reduced or detected from your account
but for enabling the azure services you
need a debit card here is the azure
portal so initially you will be getting
a 200 credit balance you can use this
for your application purpose
now
in this search bar search for
iot central application
click on this first link
now we need to create a application here
so click on create
now in the create part so we have to
first fill the project details so in the
subscription part uh select a plan that
you created for example you can select
azure subscription one and in the
resource group
you need to
add a group but no group projected so
create a group now i'll be naming this
group as how to electronics
then click on ok
in the instant details you need to give
a resource any name for example i'll be
giving a name as
mydst11 and in the application url give
any name i'll be naming it same again so
the link will be mydst here
iotcentral.com
now in the template part you need to
create a template for example i will be
selecting a custom application and in
the region part select your nearest
region like i am staying in southeast
asia region so i'll be selecting
southeast asia in the pricing plan
select anything you want now click on
review plus create so it will take a
couple of minutes and the validation is
passed now click on create so the
deployment is in progress so it might
take couple of minutes so finally the
device is deployed and the deployment is
successful as you can see here
now what we need is we need to go ahead
so for that click one go to resources
now here we have a resource
like we have a resource group name
subscription subscription id and the
status that is succeeded on this right
side you can see a link called iot
central application url
just click on this link so a new tab
will open with the device
name
now here we need to first create a
device template before creating a device
so click on device template on the left
side and here click on create a device
template now here are
so many devices template that is already
created by so many other manufacturers
and distributor
we don't need this as we'll be creating
our own device so click on iot device
and click on next customize keep the
template any name for example i will be
naming it at mydst11 then click on next
and then click on create
so
uh model need to be selected here so in
order to select a model select custom
module so
uh application has been updated here now
we need to add a capability now in order
to get a capability click on add
capability and here give a display name
for example i will be naming it as
temperature and the name automatically
temperature will be taken in the
capability part put it as a telemetry
and in the semantic type
we have a default variable called
temperature
do the same thing for the humidity
in the humidity part i'll be selecting
relative humidity so now click on save
here
now go on views and select general
default views
and then
click on gender default dashboard views
so the views has also been created now
if you go to the outputs tab here you
will see a three graph like one is the
temperature humidity the other is the
temperature and the third one is the
humidity graph literally you can modify
the title x axis y axis and the data
range and the interval range and the
telemetry or whatever capability you can
add you can update it from here now you
can also do the same thing for the
temperature part you can increase or
decrease the size you can put up to
decimals or
whatever you can do for it now in the
visualization part uh just select last
non value this is important also do the
same thing for humidity
just select last non value okay now it's
done you can also select the size
now click on publish here so publish
dialog box will appear so click on
publish again now go to the devices part
as we have already created a template
now we need to create a device to do
this click on add a device
now give device any name for example
i'll be naming it as my dht11 also give
a device id and from here select the
device template i'll be selecting the
device template which i created a couple
of minutes ago now in the device id you
can give any name to distinguish your
device click on create
so our device with the
name my dht 11 has been created here
now click on this device and here you
can see in the about section there are
no any capabilities added now if you go
to the overview section here you will be
seeing the three visualization box that
is temperature humidity temperature and
humidity in the raw data will be
receiving the data from the sensor now
here click one connect now when you
click on connect now when you click on
connect you will get device connection
group as id scope my device
authentication type key as primary and
secondary key you will also get a qr
code here so it's just like a plug and
play option from which you can connect a
device to the iot central securely but
for now we'll be connecting it using our
key all of the thing is done from this
end now go to this github repository so
there is a guy called aerosol samuel so
he has created a complete repository for
nodemcu2 is your iot central you can
just download this project code whatever
is needed right now so after downloading
open this zip file and extract it to
your desktop or anywhere you want now
when you open this up folder you will
get a source folder now the source
folder will be having so many files like
it will be having arduino files for the
pop sub client function and it will be
also having uh common files used for
uploading the code in json format to
azure iot hub what you need is we need
to open this dst file now this is the
main code used in this project now here
is the complete code so in this code
part we need to modify something now the
first modification that you need is we
need to make a change to wipe ssid enter
your wi-fi ssid here then enter your
wi-fi password now in the scope id uh we
need to copy the so this is the scope id
from the azure central
just copy and paste it here we also need
to copy and paste the device id so my
device id in my dht level so just copy
and paste it here now in the device key
part we need to copy the primary key
and paste it over here so the primary
key is also
pasted here now when you go down in the
loop section you will see the how the
dst 11 temperature immediately is shared
and in this post function we will see
two variables as temperature and
humidity remember these two variables
are variables are very very important if
you want to add thought variables you
can just follow this format
so the coding part is done now what we
need to do is uh go to the tools and
from the tools
select word manager in the board manager
part
type esp8266
now here i have selected 2.7.4 version
of esp8266 as the latest person is
unable to work so install 2.7.4 version
as compilation issue has occurred when i
selected the other versions now go to
tools and from this board list select
nodemcu 1.0 board then connect your
nodemcu to the computer
from the tools select the port
now click on upload to upload the code
once the code is uploaded open the
serial monitor so it will go through all
the process of connecting the wi-fi and
establishing the
connection with the azure iot central so
once connected it will show some of the
host name operation id and the user name
and the password for accessing
connection so the device has been
connected successfully so you can say
the event was received and the payload
of temperature and humidity has been
successfully sent and has been received
by the azure dashboard now where we can
visualize this data in order to
visualize this data now go to your
actual central dashboard so here you can
see the temperature is 30.6 and the
humidity is height 3.00
so on this left raw data part you can
see the raw data has been
updated or connected and the event
creation time every details are here and
you can see a connected message is
appearing here
you can change this visualize option or
if you don't want you can
simply remove it
again if you go to the data there will
be a series of sequence where data are
uploaded here so this is how we can get
started with azure iot hub central and
send the data of any sensor using the
esp8266 to the azure iot hub the
complete details of this project has
been uploaded in the website articles of
how to electronics you can get the
source code diagram and all the detailed
procedure on connecting the device with
the actual iot hub i hope this tutorial
has cleared so many doubts thank you so
much for watching and please subscribe
our channel for more such videos
5.0 / 5 (0 votes)