Introduction

This article is about your Raspberry Pi device where you can switch on/off your LED lights connected on the breadboard by giving data from Azure Mobile Services.
Requirements :
Activities We do
  1. Circuit Connection
  2. Creating Azure Mobile Service
  3. Creating a Windows10 UWP for Raspberry Pi
  4. Creating a Client App
  5. Deploying the App
Step 1: Circuit Connection
Connection can be made as to the Circuit below,
Step:2 Creating Azure Mobile Services
Creating an Azure Mobile Service from Azure Portal
New Mobile Dialog Box Opens, Click on COMPUTEà MOBILE SERVICE à CREATE,
Enter Mobile service URL, select database, region & backend options,
5.png
After creating mobile service, add a new table.
Enter the table name as powercontrol.
Step 2: Creating a Windows10 Universal App for Raspberry PI,
Below are the steps to create an app to the Azure Mobile Service,
To perform this experiment there are two samples that we need to create,
  • NuGet Package page will open & search for “Microsoft Azure Mobile Service."
  • Select from the list & click on Install button.
Connect your app to Azure
  • Again go to the Azure Management portal.
  • Select mobile service first tab & select windows platform.

  1. sealed partial class App : Application
  2. {
  3. /// <summary>
  4. /// Initializes the singleton application object. This is the first line of authored code
  5. /// executed, and as such is the logical equivalent of main() or WinMain().
  6. /// </summary>
  7. public App()
  8. {
  9. this.InitializeComponent();
  10. this.Suspending += OnSuspending;
  11. }
  12. public static MobileServiceClient MobileService = new MobileServiceClient(
  13. "https://mobileservice.azure-mobile.net/",
  14. "jwernSrEUNmPcpXPfMWatoCcCahglki89"
To Deploy this App to Raspberry pi -- you need to change Architecture to ARM,
Step 4: Creating a Client App
Create a new Universal Blank App.
To perform this experiment there are two samples that we need to create,

Create one class (right-click on project name & add new class item from list).
Note: Table name on Azure & class name in project must be same name,
  1. namespace RaspberryCloud
  2. {
  3. public class powercontrol
  4. {
  5. public string id { get; set; }
  6. public string status { get; set; }
  7. }
  8. }
  • Now run the app on Local Machine and execute On/Off operations from your Azure Mobile Services

Conclusion

We find out that it's easy to connect your Raspberry pi devices to Azure Mobile Services for passing and sending data to azure services by managing IoT devices.
Read more articles on Raspberry Pi: