Course Intro

Developing For The Raspberry Pi and Azure IoT Hub

Course completed!

Watch Preview
icon enterprise Created with Sketch.
Work for a company?
Try Cloud Academy for Teams!
Grow your team's cloud skill with the Enterprise Training program.

Developing For The Raspberry Pi and Azure IoT Hub

When it comes to IoT there are multiple layers. It’s not just an application deployed out on virtual machines, where the users interact with a web browser. In this course we’ll go through the process of setting up both the cloud and device side of an IoT solution.

This course focuses on how to implement a basic IoT solution. We’re going to setup a Raspberry Pi 3 B, with the Raspbian operating system. We’ll use a breadboard to wire up a DS18B20 temperature sensor, and 2 LEDs. And we’ll use a Node.js application to interact with the sensor, LEDs, and IoT Hub.

We’ll check the temperature every second, and if it’s changed since the last read, we’ll send a message to IoT Hub. Any time we send a message, we’ll make the green LED blink. And if the temperature hits 70 degrees or higher, we’ll turn the red LED on, as a warning light that it’s getting too warm; the only way to disable the warning light is to use an IoT Hub device-method.

So that’s what we’re going to build on the device side of things. On the cloud side of things, we’re going to use IoT Hub to hold the messages in its queue. We’ll implement an Azure Function to listen for messages, and then it’s going to take the message and save it in Document DB.

Here’s what you’ll need to build this for yourself.

First, you’ll need an Azure Subscription, because we’re going to use 3 Azure Services as our cloud back-end. We’ll use IoT Hub, Azure Functions and DocumentDB. You’ll also need a Raspberry Pi. I’m using a Raspberry Pi 3 B, for this demo. Since the pin layout may be different for different versions, you may need to adjust things for your implementation. You’ll also need an SD card for the Pi and a power supply. Most kits come with these. You’ll need a mouse, keyboard and HDMI compatible display for the initial OS setup. You’re going to need a breadboard. You’ll need two LEDs, ideally two different colors. You’ll need a temperature sensor, in particular, if you want to follow along and use the code I’ve prepared, you’ll want to use a DS18B20. When it comes to wiring up this project, you could use some male-to-female wires and connect to the pins on the Raspberry Pi directly. Or, you can use a breakout board, with male-to-male wires, which is what I’ll be using. You’ll also need some resistors, I’m using a 10k resistor with the sensor, and then a 220 ohm resistor with each LED.

Raspberry Pi Kits / Sensors

CanaKit Ultimate
Azure IoT Starter Kit
DS18B20 Sensor
Kuman Sensor Kit

Here’s some recommended reading if you’re new to IoT.

How to use a breadboard
Raspberry Pi documentation
IoT Hub getting started with Node.js
Azure Node.js SDK samples
Pin Layout


Developing For The Raspberry Pi and Azure IoT Hub: What You'll Learn

LectureWhat you'll learn
Course Intro What to expect from this course
Service Setup Creating the services
Configuring The Services Configuring the services and testing them
Preparing The Raspberry Pi Getting the OS installed and configured
Preparing The Breadboard Wiring up the solution
Reviewing The Code Reviewing the application
Running The Code Testing the solution out
Next Steps What's next

Do you have questions about this course? Contact our cloud experts in our community forum.

Transcripts are available as part of your Cloud Academy membership.

Sign-up for a 7-day free trial