SlideShare a Scribd company logo
Azure & Raspberry Pi
Please Follow my Youtube Account for video tutorials.
http://www.youtube.com/c/FaisalMehmoodAvan
Also follow me on my LinkedIn Account
https://kr.linkedin.com/in/faisalavan
Contact Information:
Phone: +82-10-6876-6805
Email: faisal.avan@Hotmail.com
Table of Contents
S.No Topic
1. Create an IoT hub
2. Register a device for Raspberry Pi in your IoT hub
3. Set up Raspberry Pi
4. Run a sample application on Pi to send sensor data to your IoT hub
5. Configure the sample application
6. Monitor device-to-cloud messages
7. Save IoT hub messages to your Azure blob storage
Create an IoT hub (1/4)
1. Sign in to the Azure
portal.
2. Select New in the Left
Pane of the Microsoft
Azure Dashboard
3. Select Internet of Things
in the Azure Marketplace
Section
4. Select IoT Hub in
Featured Section
Select New > Internet of
Things > IoT Hub.
Create an IoT hub (2/4)
5. 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.
• Pricing and scale tier: For this tutorial, select the F1
- Free tier or Pay-As-You-Go. For more information,
see the Pricing and scale tier
(https://docs.microsoft.com/en-us/azure/azure-resource-
manager/resource-group-portal )
• 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 (https://docs.microsoft.com/en-
us/azure/azure-resource-manager/resource-group-portal )
• Location: Select the closest location to you.
• Pin to dashboard: Check this option for easy access
to your IoT hub from the dashboard.
6. Click Create. Your IoT hub might take a few
minutes to create. You can monitor the progress in
the Notifications pane.
Create an IoT hub (3/4)
Now that you have created
an IoT hub, locate the
important information that
you use to connect devices
and applications to your IoT
hub.
7. After your IoT hub is
created, click it on the
dashboard. Make a note of
the Hostname, and then
click Shared access policies.
Note Down the Hostname
Create an IoT hub (4/4)
8. In the Shared access policies pane, click the iothubowner policy, and then copy
and make a note of the Connection string of your IoT hub. For more information,
see Control access to IoT Hub. (https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-
devguide-security )
Connection String will be used to
connect Raspberry Pi with Azure
Also note Shared Access Key
Register a device in the IoT hub for your device (1/2)
1. In the Azure Portal (https://portal.azure.com/#dashboard/private/4687ca07-ebf6-458a-aba0-4f85374b500f ), open your IoT hub.
2. Click IoT Devices.
3. 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.
Device Id is used to connect raspberry pi tot IoT hub.
Authentication Type: Select Symmetric Key. Auto Generate Keys: Select this check box.
Connect device to IoT Hub: Click Enable.
4. Click Save
Register a device in the IoT hub for your device (2/2)
5. After the device is created, open the device in the Device Explorer pane.
6. Make a note of the primary key of the connection string.
Note:
Device Id will be used to connect raspberry pi to IoT hub. We will need Connection
String and Shared Access Key.
Set up Raspberry Pi
• Connect the sensor to Pi, use the breadboard and jumper wires to
connect an LED and a BME280 to Pi as follows.
• BME280 is a sensor for temperature, barometric, pressure, and
humidity. Following table shows connecting hardware
Module PCB Desc GPIO Header Pins
VCC 3.3V P1-01
GND Ground P1-06
SCL 12C SCL P1-05
SDA 12C SDA P1-03
Run a sample application on Pi (1/4)
1. Connect to your Raspberry Pi with
one of the following SSH clients
from your host computer: We
have used PuTTY to access
Raspberry Pi remotely.
2. Make sure SSH is enabled in
Raspberry Pi
3. The default Username is “pi” and
password is “raspberry”
4. To enable SSH in raspberry pi
Follow the following steps
1. Open Command Terminal
2. sudo raspi-config
3. Select Interfacing Option
4. Select P2 SSH
5. Select Enable and Click OK
IP of the Raspberry Pi
Run a sample application on Pi (2/4)
• To Find the ip of Raspberry Pi
• Connect the Raspberry pi with the Internet
• Open Command terminal
• Write the following Command
• Sudo ifconfig
• Note down the IP of the raspberry pi to connect via SSH
Run a sample application on Pi (3/4)
2. First check nodejs and npm To check
node .js version run the following
command
sudo nodejs --version
sudo npm --version
If node.js is not install, then install the
latest version of node.js and npm by
running following command.
sudo apt-get install nodejs
sudo apt-get install npm
If Node.js version is lower than 4.x then
run the following command
(node –v; curl -sL http://deb.nodesource.com/setup_4.x |
sudo -E bash; sudo apt-get -y install nodejs)
3. First Install git on raspberry pi, To
Install git run the following command
sudo apt-get install git
Then Clone the sample application.
(git clone https://github.com/Azure-Samples/iot-hub-
node-raspberrypi-client-app)
Run a sample application on Pi (4/4)
4. Install all packages for the
sample.
The installation includes
• Azure IoT device SDK
• BME280 Sensor library
• Wiring Pi library.
cd iot-hub-node-raspberrypi-client-
app
sudo npm install
Configure the sample application (1/4)
5. Open the config file by running the
following commands: We have used Nano
editor to edit config file.
sudo nano config.json
There are two items in this file you can
configure.
1. The first one is interval, which defines the
time interval (in milliseconds) between
messages sent to the cloud.
2. The second one is simulatedData, which is
a Boolean value for whether to use
simulated sensor data or not.
Configure the sample application (2/4)
6. If you don't have the sensor,
set the simulatedData value to
true to make the sample
application create and use
simulated sensor data.
7. Change the Device ID. Device
ID is the ID which we Added in
the Microsoft Azure IoT Hub.
Refer To Slide 7 to know the
Device ID
Now Save by following
Command
Ctrl + 0
And press Enter
Now exit nano editor by
following command
Ctrl + X
Configure the sample application (3/4)
8. Run the sample application by running the following
command:
sudo node index.js '<YOUR AZURE IOT HUB DEVICE CONNECTION STRING>‘
Refer To Slide No. 6 for connection string
sudo node index.js 'HostName=my-hub.azure-
devices.net;DeviceId=raspberry-
pi;SharedAccessKey=OhJ3uXxxK54BDEI9u/jO5iCmG051dOeGBJuOP/r3
ZGI='
Have a “unable to determine hardware version” error.
Configure the sample application (4/4)
9. Solution: Solve the error by
updating the firmware to the latest
version, reverting fixed it using this
command:
sudo rpi-update
52241088c1da59a359110d39c1875cda5
6496764
Then it is able to send data to
Azure IoT Hub:
Monitor device-to-cloud messages using iothub-explorer
To monitor messages that are sent from your device to your IoT hub, follow these steps:
1. Open a console window (bash)
2. Run the following command:
iothub-explorer monitor-events <device-id> --login "<IoTHubConnectionString>“
Note: Refer To Slide 6 for Connection String and SharedAccessKey. Refer to Slide 7 for Device
ID.
iothub-explorer monitor-events raspberry-pi --login "HostName=my-hub.azure-
devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=GZNNngcIvMi2B9mt6XksJ
B99p83QtgfCPwvIYQPbM9A="
Hostname my-hub.azure-devices.net
IoT hub owner Connection
string primary key
HostName=my-hub.azure-
devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=GZNNngcIvMi2B9mt6XksJB99p83QtgfC
PwvIYQPbM9A=
Device ID raspberry-pi
Device connection string --
primary key
HostName=my-hub.azure-devices.net;DeviceId=raspberry-
pi;SharedAccessKey=OhJ3uXxxK54BDEI9u/jO5iCmG051dOeGBJuOP/r3ZGI=
Save IoT hub messages to your Azure blob storage (1/5)
1. Create an Azure storage account. In
the Azure Portal,
click New > Storage > Storage
account > Create.
2. Enter the necessary information for
the storage account and click create.
Name: The name of the storage
account. The name must be globally
unique.
Resource group: Use the same
resource group that your IoT hub
uses.
Pin to dashboard: Select this option
for easy access to your IoT hub from
the dashboard.
Save IoT hub messages to your Azure blob storage (2/5)
3. Add storage as a custom endpoint. Navigate to your IoT hub in the
Azure portal. Click Endpoints > Add. Name the endpoint and select Azure
Storage Container as the endpoint type. Use the picker to select the
storage account you created in the previous section. Create a storage
container and select it, then click OK.
Save IoT hub messages to your Azure blob storage (3/5)
4. Add a route to route data to storage. Click Routes > Add and enter a
name for the route. Select Device Messages as the data source, and select
the storage endpoint you just created as the endpoint in the route. Enter
true as the query string, then click Save.
Save IoT hub messages to your Azure blob storage (4/5)
5. Verify your message in your storage container.
• Run the sample application on your device to send messages to your IoT
hub.
• To Run the sample application, Refer To Slide 17
• Choose the storage you created on dashboard, click Blobs, choose you Blob
service, open the folders, you can see the files saved in cloud. You are able
to click Download to download the file to local.
Save IoT hub messages to your Azure blob storage (5/5)
The downloaded message file:
Contact Information
• Please Follow my Youtube Account for video tutorials.
• http://www.youtube.com/c/FaisalMehmoodAvan
• Also follow me on my LinkedIn Account
• https://kr.linkedin.com/in/faisalavan
• Contact Information:
• Phone: +82-10-6876-6805
• Email: faisal.avan@Hotmail.com

More Related Content

What's hot

Simple docker hosting on fiware lab
Simple docker hosting on fiware labSimple docker hosting on fiware lab
Simple docker hosting on fiware lab
Kenneth Nagin
 
Setting up your virtual infrastructure using fi lab cloud
Setting up your virtual infrastructure using fi lab cloudSetting up your virtual infrastructure using fi lab cloud
Setting up your virtual infrastructure using fi lab cloudHenar Muñoz Frutos
 
Uccn1003 -may10_-_lab_01_-_network_services_and_commands
Uccn1003  -may10_-_lab_01_-_network_services_and_commandsUccn1003  -may10_-_lab_01_-_network_services_and_commands
Uccn1003 -may10_-_lab_01_-_network_services_and_commandsShu Shin
 
Simple docker hosting in FIWARE Lab
Simple docker hosting in FIWARE LabSimple docker hosting in FIWARE Lab
Simple docker hosting in FIWARE Lab
Fernando Lopez Aguilar
 
How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2
Fernando Lopez Aguilar
 
Setting up your virtual infrastructure using fi lab cloud webminar
Setting up your virtual infrastructure using fi lab cloud webminarSetting up your virtual infrastructure using fi lab cloud webminar
Setting up your virtual infrastructure using fi lab cloud webminarHenar Muñoz Frutos
 
Configure &amp; send push notification on i os device
Configure &amp; send push notification on i os deviceConfigure &amp; send push notification on i os device
Configure &amp; send push notification on i os device
ShepHertz
 
Training Alcatel-Lucent WDM PSS 183x
Training Alcatel-Lucent WDM PSS 183xTraining Alcatel-Lucent WDM PSS 183x
Training Alcatel-Lucent WDM PSS 183x
Abdelilah CHARBOUB
 
sfdx continuous Integration with Jenkins on aws (Part II)
sfdx continuous Integration with Jenkins on aws (Part II)sfdx continuous Integration with Jenkins on aws (Part II)
sfdx continuous Integration with Jenkins on aws (Part II)
Jérémy Vial
 
IoT Fire Starter
IoT Fire StarterIoT Fire Starter
IoT Fire Starter
Doug Seven
 
sfdx continuous Integration with Jenkins on aws (Part I)
sfdx continuous Integration with Jenkins on aws (Part I)sfdx continuous Integration with Jenkins on aws (Part I)
sfdx continuous Integration with Jenkins on aws (Part I)
Jérémy Vial
 
How to become cloud backup provider
How to become cloud backup providerHow to become cloud backup provider
How to become cloud backup providerCLOUDIAN KK
 

What's hot (12)

Simple docker hosting on fiware lab
Simple docker hosting on fiware labSimple docker hosting on fiware lab
Simple docker hosting on fiware lab
 
Setting up your virtual infrastructure using fi lab cloud
Setting up your virtual infrastructure using fi lab cloudSetting up your virtual infrastructure using fi lab cloud
Setting up your virtual infrastructure using fi lab cloud
 
Uccn1003 -may10_-_lab_01_-_network_services_and_commands
Uccn1003  -may10_-_lab_01_-_network_services_and_commandsUccn1003  -may10_-_lab_01_-_network_services_and_commands
Uccn1003 -may10_-_lab_01_-_network_services_and_commands
 
Simple docker hosting in FIWARE Lab
Simple docker hosting in FIWARE LabSimple docker hosting in FIWARE Lab
Simple docker hosting in FIWARE Lab
 
How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2
 
Setting up your virtual infrastructure using fi lab cloud webminar
Setting up your virtual infrastructure using fi lab cloud webminarSetting up your virtual infrastructure using fi lab cloud webminar
Setting up your virtual infrastructure using fi lab cloud webminar
 
Configure &amp; send push notification on i os device
Configure &amp; send push notification on i os deviceConfigure &amp; send push notification on i os device
Configure &amp; send push notification on i os device
 
Training Alcatel-Lucent WDM PSS 183x
Training Alcatel-Lucent WDM PSS 183xTraining Alcatel-Lucent WDM PSS 183x
Training Alcatel-Lucent WDM PSS 183x
 
sfdx continuous Integration with Jenkins on aws (Part II)
sfdx continuous Integration with Jenkins on aws (Part II)sfdx continuous Integration with Jenkins on aws (Part II)
sfdx continuous Integration with Jenkins on aws (Part II)
 
IoT Fire Starter
IoT Fire StarterIoT Fire Starter
IoT Fire Starter
 
sfdx continuous Integration with Jenkins on aws (Part I)
sfdx continuous Integration with Jenkins on aws (Part I)sfdx continuous Integration with Jenkins on aws (Part I)
sfdx continuous Integration with Jenkins on aws (Part I)
 
How to become cloud backup provider
How to become cloud backup providerHow to become cloud backup provider
How to become cloud backup provider
 

Similar to Raspberry pi and Azure

PowerShell: A Language for the Internet of Things #ATLPUG
PowerShell: A Language for the Internet of Things #ATLPUGPowerShell: A Language for the Internet of Things #ATLPUG
PowerShell: A Language for the Internet of Things #ATLPUG
Taylor Riggan
 
Bluemix iot demo
Bluemix iot demoBluemix iot demo
Bluemix iot demo
Joseph Chang
 
From the internet of things to the web of things course
From the internet of things to the web of things courseFrom the internet of things to the web of things course
From the internet of things to the web of things course
Dominique Guinard
 
Bluemix iot with intel galileo
Bluemix iot with intel galileoBluemix iot with intel galileo
Bluemix iot with intel galileo
Joseph Chang
 
Taishaun_OwnensCNS-533_Lab
Taishaun_OwnensCNS-533_LabTaishaun_OwnensCNS-533_Lab
Taishaun_OwnensCNS-533_LabTaishaun Owens
 
Azure hands on lab
Azure hands on labAzure hands on lab
Azure hands on lab
Atanas Gergiminov
 
Microsoft.certleader.az 220.free.pdf.2020-may-30.by.tony.0q.vce (1)
Microsoft.certleader.az 220.free.pdf.2020-may-30.by.tony.0q.vce (1)Microsoft.certleader.az 220.free.pdf.2020-may-30.by.tony.0q.vce (1)
Microsoft.certleader.az 220.free.pdf.2020-may-30.by.tony.0q.vce (1)
Rajesh Anbalagan
 
Setup VoIP System and Interconnection with LTE network
Setup VoIP System and Interconnection with LTE networkSetup VoIP System and Interconnection with LTE network
Setup VoIP System and Interconnection with LTE network
Nazmul Hossain Rakib
 
Building Better IoT Applications without Servers
Building Better IoT Applications without ServersBuilding Better IoT Applications without Servers
Building Better IoT Applications without Servers
Ian Massingham
 
IoT Workshop in Macao
IoT Workshop in MacaoIoT Workshop in Macao
IoT Workshop in Macao
Shigeru Kobayashi
 
IoT Workshop in Macao
IoT Workshop in MacaoIoT Workshop in Macao
IoT Workshop in Macao
Shigeru Kobayashi
 
AZ-220 Microsoft Azure IoT Developer Updated Dumps
AZ-220 Microsoft Azure IoT Developer Updated DumpsAZ-220 Microsoft Azure IoT Developer Updated Dumps
AZ-220 Microsoft Azure IoT Developer Updated Dumps
VictoriaMeisel
 
Federico Michele Facca - FIWARE Primer - Learn FIWARE in 60 Minutes
Federico Michele Facca - FIWARE Primer - Learn FIWARE in 60 MinutesFederico Michele Facca - FIWARE Primer - Learn FIWARE in 60 Minutes
Federico Michele Facca - FIWARE Primer - Learn FIWARE in 60 Minutes
Codemotion
 
FIWARE Primer - Learn FIWARE in 60 Minutes
FIWARE Primer - Learn FIWARE in 60 MinutesFIWARE Primer - Learn FIWARE in 60 Minutes
FIWARE Primer - Learn FIWARE in 60 Minutes
Federico Michele Facca
 
A step by step guide to develop temperature sensor io t application using ibm...
A step by step guide to develop temperature sensor io t application using ibm...A step by step guide to develop temperature sensor io t application using ibm...
A step by step guide to develop temperature sensor io t application using ibm...
Azilen Technologies Pvt. Ltd.
 
Steps to be done in arduino ide for monitoring
Steps to be done in arduino ide for monitoringSteps to be done in arduino ide for monitoring
Steps to be done in arduino ide for monitoring
Citharthan Durairaj
 
Develop Smart Solutions with Raspberry Pi and EnableX Live Video API
Develop Smart Solutions with Raspberry Pi and EnableX Live Video APIDevelop Smart Solutions with Raspberry Pi and EnableX Live Video API
Develop Smart Solutions with Raspberry Pi and EnableX Live Video API
Enablex io
 
Iot physical servers and cloud offerings
Iot physical servers and cloud offeringsIot physical servers and cloud offerings
Iot physical servers and cloud offerings
RajanRock3
 
Android Workshop
Android WorkshopAndroid Workshop
Android Workshop
Junda Ong
 
R server and spark
R server and sparkR server and spark
R server and spark
BAINIDA
 

Similar to Raspberry pi and Azure (20)

PowerShell: A Language for the Internet of Things #ATLPUG
PowerShell: A Language for the Internet of Things #ATLPUGPowerShell: A Language for the Internet of Things #ATLPUG
PowerShell: A Language for the Internet of Things #ATLPUG
 
Bluemix iot demo
Bluemix iot demoBluemix iot demo
Bluemix iot demo
 
From the internet of things to the web of things course
From the internet of things to the web of things courseFrom the internet of things to the web of things course
From the internet of things to the web of things course
 
Bluemix iot with intel galileo
Bluemix iot with intel galileoBluemix iot with intel galileo
Bluemix iot with intel galileo
 
Taishaun_OwnensCNS-533_Lab
Taishaun_OwnensCNS-533_LabTaishaun_OwnensCNS-533_Lab
Taishaun_OwnensCNS-533_Lab
 
Azure hands on lab
Azure hands on labAzure hands on lab
Azure hands on lab
 
Microsoft.certleader.az 220.free.pdf.2020-may-30.by.tony.0q.vce (1)
Microsoft.certleader.az 220.free.pdf.2020-may-30.by.tony.0q.vce (1)Microsoft.certleader.az 220.free.pdf.2020-may-30.by.tony.0q.vce (1)
Microsoft.certleader.az 220.free.pdf.2020-may-30.by.tony.0q.vce (1)
 
Setup VoIP System and Interconnection with LTE network
Setup VoIP System and Interconnection with LTE networkSetup VoIP System and Interconnection with LTE network
Setup VoIP System and Interconnection with LTE network
 
Building Better IoT Applications without Servers
Building Better IoT Applications without ServersBuilding Better IoT Applications without Servers
Building Better IoT Applications without Servers
 
IoT Workshop in Macao
IoT Workshop in MacaoIoT Workshop in Macao
IoT Workshop in Macao
 
IoT Workshop in Macao
IoT Workshop in MacaoIoT Workshop in Macao
IoT Workshop in Macao
 
AZ-220 Microsoft Azure IoT Developer Updated Dumps
AZ-220 Microsoft Azure IoT Developer Updated DumpsAZ-220 Microsoft Azure IoT Developer Updated Dumps
AZ-220 Microsoft Azure IoT Developer Updated Dumps
 
Federico Michele Facca - FIWARE Primer - Learn FIWARE in 60 Minutes
Federico Michele Facca - FIWARE Primer - Learn FIWARE in 60 MinutesFederico Michele Facca - FIWARE Primer - Learn FIWARE in 60 Minutes
Federico Michele Facca - FIWARE Primer - Learn FIWARE in 60 Minutes
 
FIWARE Primer - Learn FIWARE in 60 Minutes
FIWARE Primer - Learn FIWARE in 60 MinutesFIWARE Primer - Learn FIWARE in 60 Minutes
FIWARE Primer - Learn FIWARE in 60 Minutes
 
A step by step guide to develop temperature sensor io t application using ibm...
A step by step guide to develop temperature sensor io t application using ibm...A step by step guide to develop temperature sensor io t application using ibm...
A step by step guide to develop temperature sensor io t application using ibm...
 
Steps to be done in arduino ide for monitoring
Steps to be done in arduino ide for monitoringSteps to be done in arduino ide for monitoring
Steps to be done in arduino ide for monitoring
 
Develop Smart Solutions with Raspberry Pi and EnableX Live Video API
Develop Smart Solutions with Raspberry Pi and EnableX Live Video APIDevelop Smart Solutions with Raspberry Pi and EnableX Live Video API
Develop Smart Solutions with Raspberry Pi and EnableX Live Video API
 
Iot physical servers and cloud offerings
Iot physical servers and cloud offeringsIot physical servers and cloud offerings
Iot physical servers and cloud offerings
 
Android Workshop
Android WorkshopAndroid Workshop
Android Workshop
 
R server and spark
R server and sparkR server and spark
R server and spark
 

More from Faisal Mehmood

Raspbian Noobs
Raspbian NoobsRaspbian Noobs
Raspbian Noobs
Faisal Mehmood
 
Lecture 20 combinatorics o
Lecture 20 combinatorics oLecture 20 combinatorics o
Lecture 20 combinatorics oFaisal Mehmood
 
Lecture 36 laws of prob
Lecture 36 laws of probLecture 36 laws of prob
Lecture 36 laws of probFaisal Mehmood
 
Lecture 19 counting
Lecture 19 countingLecture 19 counting
Lecture 19 counting
Faisal Mehmood
 
Lecture 18 recursion
Lecture 18 recursionLecture 18 recursion
Lecture 18 recursion
Faisal Mehmood
 
Lecture 17 induction
Lecture 17 inductionLecture 17 induction
Lecture 17 induction
Faisal Mehmood
 
Lecture 16 SERIES
Lecture 16  SERIESLecture 16  SERIES
Lecture 16 SERIES
Faisal Mehmood
 
Lecture 15 sequences
Lecture 15 sequencesLecture 15 sequences
Lecture 15 sequences
Faisal Mehmood
 
Lecture 14(d)
Lecture 14(d)Lecture 14(d)
Lecture 14(d)
Faisal Mehmood
 

More from Faisal Mehmood (20)

Raspbian Noobs
Raspbian NoobsRaspbian Noobs
Raspbian Noobs
 
Lecture 44
Lecture 44Lecture 44
Lecture 44
 
Lecture 37 cond prob
Lecture 37 cond probLecture 37 cond prob
Lecture 37 cond prob
 
Lecture 20 combinatorics o
Lecture 20 combinatorics oLecture 20 combinatorics o
Lecture 20 combinatorics o
 
Lecture 36 laws of prob
Lecture 36 laws of probLecture 36 laws of prob
Lecture 36 laws of prob
 
Lecture 36
Lecture 36 Lecture 36
Lecture 36
 
Lecture 35 prob
Lecture 35 probLecture 35 prob
Lecture 35 prob
 
Lecture 27
Lecture 27Lecture 27
Lecture 27
 
Lecture 26
Lecture 26Lecture 26
Lecture 26
 
Lecture 25
Lecture 25Lecture 25
Lecture 25
 
Lecture 24
Lecture 24Lecture 24
Lecture 24
 
Lecture 22
Lecture 22Lecture 22
Lecture 22
 
Lecture 21
Lecture 21Lecture 21
Lecture 21
 
Lecture 20
Lecture 20Lecture 20
Lecture 20
 
Lecture 19 counting
Lecture 19 countingLecture 19 counting
Lecture 19 counting
 
Lecture 18 recursion
Lecture 18 recursionLecture 18 recursion
Lecture 18 recursion
 
Lecture 17 induction
Lecture 17 inductionLecture 17 induction
Lecture 17 induction
 
Lecture 16 SERIES
Lecture 16  SERIESLecture 16  SERIES
Lecture 16 SERIES
 
Lecture 15 sequences
Lecture 15 sequencesLecture 15 sequences
Lecture 15 sequences
 
Lecture 14(d)
Lecture 14(d)Lecture 14(d)
Lecture 14(d)
 

Recently uploaded

ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
ShahidSultan24
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
Kamal Acharya
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
DuvanRamosGarzon1
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
abh.arya
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
Kamal Acharya
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
Kamal Acharya
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 

Recently uploaded (20)

ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 

Raspberry pi and Azure

  • 1. Azure & Raspberry Pi Please Follow my Youtube Account for video tutorials. http://www.youtube.com/c/FaisalMehmoodAvan Also follow me on my LinkedIn Account https://kr.linkedin.com/in/faisalavan Contact Information: Phone: +82-10-6876-6805 Email: faisal.avan@Hotmail.com
  • 2. Table of Contents S.No Topic 1. Create an IoT hub 2. Register a device for Raspberry Pi in your IoT hub 3. Set up Raspberry Pi 4. Run a sample application on Pi to send sensor data to your IoT hub 5. Configure the sample application 6. Monitor device-to-cloud messages 7. Save IoT hub messages to your Azure blob storage
  • 3. Create an IoT hub (1/4) 1. Sign in to the Azure portal. 2. Select New in the Left Pane of the Microsoft Azure Dashboard 3. Select Internet of Things in the Azure Marketplace Section 4. Select IoT Hub in Featured Section Select New > Internet of Things > IoT Hub.
  • 4. Create an IoT hub (2/4) 5. 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. • Pricing and scale tier: For this tutorial, select the F1 - Free tier or Pay-As-You-Go. For more information, see the Pricing and scale tier (https://docs.microsoft.com/en-us/azure/azure-resource- manager/resource-group-portal ) • 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 (https://docs.microsoft.com/en- us/azure/azure-resource-manager/resource-group-portal ) • Location: Select the closest location to you. • Pin to dashboard: Check this option for easy access to your IoT hub from the dashboard. 6. Click Create. Your IoT hub might take a few minutes to create. You can monitor the progress in the Notifications pane.
  • 5. Create an IoT hub (3/4) Now that you have created an IoT hub, locate the important information that you use to connect devices and applications to your IoT hub. 7. After your IoT hub is created, click it on the dashboard. Make a note of the Hostname, and then click Shared access policies. Note Down the Hostname
  • 6. Create an IoT hub (4/4) 8. In the Shared access policies pane, click the iothubowner policy, and then copy and make a note of the Connection string of your IoT hub. For more information, see Control access to IoT Hub. (https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub- devguide-security ) Connection String will be used to connect Raspberry Pi with Azure Also note Shared Access Key
  • 7. Register a device in the IoT hub for your device (1/2) 1. In the Azure Portal (https://portal.azure.com/#dashboard/private/4687ca07-ebf6-458a-aba0-4f85374b500f ), open your IoT hub. 2. Click IoT Devices. 3. 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. Device Id is used to connect raspberry pi tot IoT hub. Authentication Type: Select Symmetric Key. Auto Generate Keys: Select this check box. Connect device to IoT Hub: Click Enable. 4. Click Save
  • 8. Register a device in the IoT hub for your device (2/2) 5. After the device is created, open the device in the Device Explorer pane. 6. Make a note of the primary key of the connection string. Note: Device Id will be used to connect raspberry pi to IoT hub. We will need Connection String and Shared Access Key.
  • 9. Set up Raspberry Pi • Connect the sensor to Pi, use the breadboard and jumper wires to connect an LED and a BME280 to Pi as follows. • BME280 is a sensor for temperature, barometric, pressure, and humidity. Following table shows connecting hardware Module PCB Desc GPIO Header Pins VCC 3.3V P1-01 GND Ground P1-06 SCL 12C SCL P1-05 SDA 12C SDA P1-03
  • 10. Run a sample application on Pi (1/4) 1. Connect to your Raspberry Pi with one of the following SSH clients from your host computer: We have used PuTTY to access Raspberry Pi remotely. 2. Make sure SSH is enabled in Raspberry Pi 3. The default Username is “pi” and password is “raspberry” 4. To enable SSH in raspberry pi Follow the following steps 1. Open Command Terminal 2. sudo raspi-config 3. Select Interfacing Option 4. Select P2 SSH 5. Select Enable and Click OK IP of the Raspberry Pi
  • 11. Run a sample application on Pi (2/4) • To Find the ip of Raspberry Pi • Connect the Raspberry pi with the Internet • Open Command terminal • Write the following Command • Sudo ifconfig • Note down the IP of the raspberry pi to connect via SSH
  • 12. Run a sample application on Pi (3/4) 2. First check nodejs and npm To check node .js version run the following command sudo nodejs --version sudo npm --version If node.js is not install, then install the latest version of node.js and npm by running following command. sudo apt-get install nodejs sudo apt-get install npm If Node.js version is lower than 4.x then run the following command (node –v; curl -sL http://deb.nodesource.com/setup_4.x | sudo -E bash; sudo apt-get -y install nodejs) 3. First Install git on raspberry pi, To Install git run the following command sudo apt-get install git Then Clone the sample application. (git clone https://github.com/Azure-Samples/iot-hub- node-raspberrypi-client-app)
  • 13. Run a sample application on Pi (4/4) 4. Install all packages for the sample. The installation includes • Azure IoT device SDK • BME280 Sensor library • Wiring Pi library. cd iot-hub-node-raspberrypi-client- app sudo npm install
  • 14. Configure the sample application (1/4) 5. Open the config file by running the following commands: We have used Nano editor to edit config file. sudo nano config.json There are two items in this file you can configure. 1. The first one is interval, which defines the time interval (in milliseconds) between messages sent to the cloud. 2. The second one is simulatedData, which is a Boolean value for whether to use simulated sensor data or not.
  • 15. Configure the sample application (2/4) 6. If you don't have the sensor, set the simulatedData value to true to make the sample application create and use simulated sensor data. 7. Change the Device ID. Device ID is the ID which we Added in the Microsoft Azure IoT Hub. Refer To Slide 7 to know the Device ID Now Save by following Command Ctrl + 0 And press Enter Now exit nano editor by following command Ctrl + X
  • 16. Configure the sample application (3/4) 8. Run the sample application by running the following command: sudo node index.js '<YOUR AZURE IOT HUB DEVICE CONNECTION STRING>‘ Refer To Slide No. 6 for connection string sudo node index.js 'HostName=my-hub.azure- devices.net;DeviceId=raspberry- pi;SharedAccessKey=OhJ3uXxxK54BDEI9u/jO5iCmG051dOeGBJuOP/r3 ZGI=' Have a “unable to determine hardware version” error.
  • 17. Configure the sample application (4/4) 9. Solution: Solve the error by updating the firmware to the latest version, reverting fixed it using this command: sudo rpi-update 52241088c1da59a359110d39c1875cda5 6496764 Then it is able to send data to Azure IoT Hub:
  • 18. Monitor device-to-cloud messages using iothub-explorer To monitor messages that are sent from your device to your IoT hub, follow these steps: 1. Open a console window (bash) 2. Run the following command: iothub-explorer monitor-events <device-id> --login "<IoTHubConnectionString>“ Note: Refer To Slide 6 for Connection String and SharedAccessKey. Refer to Slide 7 for Device ID. iothub-explorer monitor-events raspberry-pi --login "HostName=my-hub.azure- devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=GZNNngcIvMi2B9mt6XksJ B99p83QtgfCPwvIYQPbM9A=" Hostname my-hub.azure-devices.net IoT hub owner Connection string primary key HostName=my-hub.azure- devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=GZNNngcIvMi2B9mt6XksJB99p83QtgfC PwvIYQPbM9A= Device ID raspberry-pi Device connection string -- primary key HostName=my-hub.azure-devices.net;DeviceId=raspberry- pi;SharedAccessKey=OhJ3uXxxK54BDEI9u/jO5iCmG051dOeGBJuOP/r3ZGI=
  • 19. Save IoT hub messages to your Azure blob storage (1/5) 1. Create an Azure storage account. In the Azure Portal, click New > Storage > Storage account > Create. 2. Enter the necessary information for the storage account and click create. Name: The name of the storage account. The name must be globally unique. Resource group: Use the same resource group that your IoT hub uses. Pin to dashboard: Select this option for easy access to your IoT hub from the dashboard.
  • 20. Save IoT hub messages to your Azure blob storage (2/5) 3. Add storage as a custom endpoint. Navigate to your IoT hub in the Azure portal. Click Endpoints > Add. Name the endpoint and select Azure Storage Container as the endpoint type. Use the picker to select the storage account you created in the previous section. Create a storage container and select it, then click OK.
  • 21. Save IoT hub messages to your Azure blob storage (3/5) 4. Add a route to route data to storage. Click Routes > Add and enter a name for the route. Select Device Messages as the data source, and select the storage endpoint you just created as the endpoint in the route. Enter true as the query string, then click Save.
  • 22. Save IoT hub messages to your Azure blob storage (4/5) 5. Verify your message in your storage container. • Run the sample application on your device to send messages to your IoT hub. • To Run the sample application, Refer To Slide 17 • Choose the storage you created on dashboard, click Blobs, choose you Blob service, open the folders, you can see the files saved in cloud. You are able to click Download to download the file to local.
  • 23. Save IoT hub messages to your Azure blob storage (5/5) The downloaded message file:
  • 24. Contact Information • Please Follow my Youtube Account for video tutorials. • http://www.youtube.com/c/FaisalMehmoodAvan • Also follow me on my LinkedIn Account • https://kr.linkedin.com/in/faisalavan • Contact Information: • Phone: +82-10-6876-6805 • Email: faisal.avan@Hotmail.com