Recently there was a comment on a Hardware Friday IoT post about connecting an IoT device to the cloud/Windows Azure.
Here are two recent MSDN Magazine articles on just that...
There’s a new gold rush happening and it’s not about precious metals. It’s about building innovative devices for consumers and connecting them to the cloud. New Microsoft CEO Satya Nadella said last March that devices are “really uninteresting without the cloud.”
This makes sense. If the device is collecting information through sensors or cameras, how and where will you analyze this data? After all, these low-end devices such as the Raspberry Pi have limited compute power and storage space. The cloud fills this void and goes further by helping with security, device management and so on. So this month, we want to roll up our sleeves from both a hardware and software perspective and learn what it takes to truly embrace this new computing paradigm.
The SmartDoor is the Internet of Things (IoT) product we’ll build from the ground up. We will eventually attach a doorbell, a camera and a Raspberry Pi computing device (see Figure 1). The idea is that someone arrives at your doorstep and rings your doorbell. Once they press the doorbell, the device automatically takes a photo. Then this photo is forwarded to a mobile device as a push notification message (see Figure 2). The message has a hyperlink to the image of the person standing at your doorstep. This invention was inspired by the need to know who is ringing your doorbell, even if you’re not home.
The Software Side
This is a solid starting point for building your own Internet of Things device. We’ve tried to address everything from procuring the hardware, assembly, installing software, writing software and testing functionality. We’ve also supplied many supporting blog posts. But this solution isn’t complete.
In the next article, we’ll address the way push notifications are sent to phones so you can view the photo of the person ringing the doorbell on a mobile device. We’ll introduce the notification service, which is part of the Azure Service Bus. We’ll also build a Windows Phone application capable of receiving push notifications from Azure. Finally, we’ll address additional storage mechanisms, such as using a MongoDB NoSQL database and interfacing with a face recognition back end. Stay tuned for more Internet of Things with Azure.
We recently introduced the idea of connecting an Internet of Things (IoT) device—in our case the Raspberry Pi—to the cloud (Microsoft Azure) to deliver a push notification to your mobile device whenever somebody rings your doorbell at home. This lets you see who’s at your front door step at home from anywhere in the world using your mobile device.
In the September 2014 article, “Soup to Nuts: From Raw Hardware to Cloud-Enabled Device” (msdn.microsoft.com/magazine/dn781356), we walked through the process of integrating the device to storage blobs using Azure Mobile Services to obtain a Shared Access Signature (SAS). This let the device directly upload the file to a storage container without any service tier. Now we can upload the photo to the cloud, but there are still a few things left to do to send a notification to the device.
So far, Azure Mobile Services and Azure Storage have been leveraged in this project. You’ll also need to take advantage of the service bus queues and scheduled tasks services to send messages from the Raspberry Pi device to your mobile device. These two services will be integrated with Azure Mobile Services, which will receive messages from the service bus queue and record them in a database. In the spirit of open source and new-age solutions, we’ll use a MongoDB database hosted and maintained by MongoLab that you can add for free as an Azure Add-on.
Service Bus for Distributed Messaging
There are four types of communication patterns typically used in IoT scenarios. As you can see in Figure 1, one or more Raspberry Pi devices are publishing messages to the service bus queues. Azure Mobile Services is the only subscriber to service bus queues.
Now, Raspberry Pi is fully integrated to our cloud service. The device can upload a file directly to cloud storage, notify the cloud service via service bus and have the information stored in a database.
The next step in this series will be integrating a mobile application to the cloud back end with push notifications of the images. We’ll use custom APIs to surface objects from the database to the app and integrate a third-party API for image facial recognition and a notification hub to power the push notifications. You can examine the code repositories to build and tweak the solution yourself. The Azure Mobile Services back end is at bit.ly/1mHCl0q. You’ll find the Raspberry Pi Code at bit.ly/1l8aOtF.
Integrating Raspberry PI devices to cloud back ends is critical. Leveraging open source technologies such as Node.js makes sense in many scenarios where you’re using a lightweight back end to scale to a large number of devices.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.