AdSense
Wednesday, August 2, 2017
Microsoft Azure IoT plaftorm (1): deploying an IoT Hub
DEPLOYING AN IoT HUB
- Layout for this exercise:
- The first step to connect a Raspberry Pi device to the Microsoft Azure IoT platform is to create an Azure account. Free and temporary accounts are available here:
https://azure.microsoft.com
- Once entered parameters like name, phone number, password, etc ... , access to the Azure portal is immediate:
- The Dashboard is displayed for managing all the options provided by Microsoft Azure:
- Azure IoT Hub is a fully managed service that enables reliable and secure bi-directional communications between Internet of Things (IoT) devices and a solution back end.
- One of the biggest challenges that IoT projects face is how to reliably and securely connect devices to the solution back end.
- To address this challenge, Azure IoT Hub:
a) offers reliable device-to-cloud and cloud-to-device hyper-scale messaging.
b) enables secure communications using per-device security credentials and access control.
c) includes device libraries for the most popular languages and platforms.
- To create an IoT hub, click New -> Internet of Things -> IoT Hub:
- Entering a name, in this case WhitelistAzure:
- Type of service, in this case the free one:
- Naming a group (WhitelistAzureGroup1) and location (West Central US):
- Pinning to the dashboard:
- The deployment starts and after a few minutes the new WhitelistAzure IoT Hub is successfully created:
- The essential information about the newly created IoT hub:
- Clicking Shared access policies:
- As a result of the deployment of the IoT Hub several cryptographic keys have been created:
- It is very important to copy this information and write down all the keys in a secure document for further usage in future steps:
Tuesday, August 1, 2017
Thinger.io IoT platform (2): controlling a Raspberry Pi from a smartphone Android application
CONTROLLING A RASPBERRY PI FROM A SMARTPHONE ANDROID APPLICATION
- Layout for this exercise:
* This exercise is based in the previous one
1 - Introduction
- The goal of this exercise is to control remotely a red LED connected to a Raspberry Pi device that has been added to the open source IoT platform thinger.io.
- A device token will be generated to control the red LED from a smartphone using the Android thinger.io application.
2 - Installig WiringPi at the Raspberry Pi
- WiringPi is a PIN based GPIO access library written in C for the BCM2835 used in the Raspberry Pi. It’s released under the GNU LGPLv3 license and is usable from C, C++ and RTB (BASIC) as well as many other languages with suitable wrappers.
- Let's install WiringPi at the Raspberry Pi. First of all, to work with the git-core repository:
- Downloading WiringPi:
- Fetching an updated version:
- All the folders and files have been installed:
- Building the application:
- It is important to notice the NOTE warning that to compile programs it is necessary to add -lwiringPi
- Moving the library wiringPi.h to the folder thinger_client/src:
3 - Writing the program
- The main.cpp program used in this exercise:
- Let's analyze the program.
- Including the libraries:
- Providing parameters to connect to the platform thinger.io:
- According with WiringPi pin numbering scheme the pin GPIO 17 corresponds to 0:
- Starting the connection of the device, passing the already defined parameters:
- The pin GPIO 17 is set as OUTPUT mode:
- The device will take 2 possible input modes: HIGH (LED on) and LOW(LED off):
- Starting the application:
4 - Running the application
- Before running the application, and in order to perform a correct compilation two lines must be modified at the configuration file CMakeLists.txt, indicating that the -lwringPi option is called:
- Running the application, finally the connection is achieved between the Raspberry Pi device and the IoT platform thinger.io:
5 - Controlling the Raspberry Pi device from the IoT platform website
- Signing in the thinger.io website (see previous exercise), a new device is found.
- The Boolean input can take two values: 0 (LOW = LED off) and 1 (HIGH = LED on):
- By default the red LED is off, with a value "in":false
- Switching the Boolean button the red LED turns on and the "in":true
- At the last point (7) a video will show the final testing of this exercise.
6 - Controlling the Raspberry Pi device from a smartphone Android application
- This Android application allows controlling IoT devices connected to the thinger.io platform, and can be easily installed in an smartphone from Google Play:
- In order to use the application a device token is required. Going back again to the web dashboard of the thinger.io platform, clicking OK:
- A device token is automatically generated.
- Clicking ShowQRCode:
- Now, the QR code is scanned from the smartphone using the thinger.io application. Once scanned, the application can be used for controlling the Raspberry Pi remotely.
7 - Testing the exercise
- This video shows the successful operation of the exercise:
Subscribe to:
Posts (Atom)