develop iot project with airvantage m2m cloud

Post on 21-Jun-2015

480 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

Learn how to build an Internet of Things (IoT) project with sensors, BeagleBone Black, MQTT protocol and the AirVantage M2M cloud

TRANSCRIPT

1

Develop IoT project with AirVantage M2M Cloud

Crystal Lam – AirVantage Product Marketing Manager

2

Agenda

• Introduction

• Eclo Inc. & their greenhouses

• Example: Greenhouse project

• Q&A

3

In the Air Design Challenge

4

Sierra Wireless Device-to-Cloud Solution

Leading-edge intelligent devices

Secure cloud services platform

Value creation& competitive barriers+ =

5

Eclo Inc. & their greenhouses

Corporatesoftware

sensor

Embedded system

Support team

greenhouse

actuator

Customers

MQTT

REST API

AlertMonitoringTroubleshoot

ConfigurationSoftware upgradeAlertStatistics

Asset monitoring

6

Example: Greenhouse project

BeagleBone Black

MQTT

Mobile/ Web App

SensorsActuators REST

API

7

Bill of Material

• BeagleBone Black (and the USB cable)

• Ethernet cable

• Sensors and actuators (e.g. servomotor)

• AirVantage M2M Cloud account

Get an AirVantage Enterprise Platform trial account:https://signup.airvantage.net/public/avep/

(Free for 6 months, up to 10 systems)

Don’t have one?

8

Key steps

9

Step 1:Develop embedded code on BBB

Cloud9 IDE

Ethernet cable

USB cable

sensors

10

Embedded code

Purposes:

• Setup connection with AirVantage

• Read the sensor inputs• Send the data to AirVantage• Listen to the command from

AirVantage

Test it on Cloud9

Keep sending data to AirVantage!

Get the sample code : https://github.com/crystallam/beagleboneblack-mqtt-greenhouse Customize the code and flash it to your BBB with the Cloud9 IDE

11

Step 2: Register your BBB on AirVantage

Go to Inventory tab/ Systems: register your BBB by creating a new system

12

Create a system

System = “Gateway” (hardware) + “Subscription” (optional) + “Applications” (software)

Note your BBB serial number and the MQTT password for the embedded code

13

Application model

Find an example in the tutorial “Using MQTT with AirVantage” :https://doc.airvantage.net/display/USERGUIDE/Using+MQTT+with+AirVantage

Application model

- Describe the capability of the embedded application

- Help AirVantage UI to understand what are the data and commands sent by the systems

14

Publish it on AirVantage

Go to Develop tab/ My Apps and release your app to the repository

15

Release & publish your application

16

Step 3:Test it on AirVantageGo to Monitor tab/ Systems, and click on your BBB to find this System detail page

17

Timeline – troubleshoot

Troubleshoot with all the data sent from your device to AirVantage

18

Data History – analyze data

Plot aggregated data on chart, identify trends

It works!

19

Step 4: Use API

First thing to do : create an API Client as the identifier of your application

20

AirVantage uses OAuth 2.0• Pick the most suitable OAuth flow to get the

access token

– Resource owner for really trusted application

– Authorization code for server-side application

– Implicit for client-side application

Implement authentication

Specs: http://tools.ietf.org/html/rfc6749

21

AirVantage API

Base URI : https://na.airvantage.net/api/v1

HTTP VerbsGET: Used for retrieving resources.

POST: Used for creating resources, or performing custom actions.

PUT: Used for updating resources or collections.

DELETE: Used for deleting resources.

Resource Path : find them all in the API Documentation

Get an access token with OAuth 2.0

21

> GET https://{server}/api/v1/users/current?access_token={token}

HTTP Verb Base URI Resource Path

This is the typical format of our REST API

22

I want to use the AirVantage API to • get data sent from the greenhouses,

• automate communications,

• analyze the data

For the greenhouse project

23

« I want to see the stream of values sent from my device. »

API to list all historical values for a given data of a system

e.g. greenhouse.temperature:

Raw data

> GET https://{server}/api/v1/systems/data/raw? targetIds={system_uid} &dataIds={data_id} &access_token={token}

24

« I want my device to execute a command. »

API to send a command to given system. e.g. powerFan

Send commands & track operation

> POST https://{server}/api/v1/operations/systems/command?access_token={token}{ "systems" : { "uids" : [“{system_uid}"] }, "commandId" : “{command_id}"}

25

« I want to validate the command has been received and executed. »

API to get the details of an operation

> GET https://{server}/api/v1/operations/{operation_uid}?access_token={token}

Send commands & track operation

26

« I want to validate the command has been received and executed. »

API to get the details of an operation

• Track the "state" property to know if the operation is done

• Track the "state" property of the different "counters" to know if it worked or not

Send commands & track operation

> GET https://{server}/api/v1/operations/{operation_uid}?access_token={token}

27

« I want to be notified when the temperature is above a threshold. »

Configure an alert rule

Setup the "Call URL" to enable webhook notifications

Alerts & Webhooks

28

Alerts & Webhooks

29

AirVantage will send a request on the callback URL as soon as a new alert is generated

Alerts & Webhooks

> POST http://www.yoursite.com/your_callback{

"name":"event.alert.rule.triggered","date":1385718100163,"content": {

"alert.uid":"f04a77e306de463e919ec39c387fa016","rule.uid":"7316ee643b17473381b61b8ac0afa824","target.uid":"da687e2c39d54bc391633fa9c8d4c0da"

}}

30

« I want to analyze the data sent by my device.»

API to get aggregated values of data and multiple systems

Available functions:

mean, max, min, standard deviation, sum of squares, count, count of occurrences

e.g. get the average temperature of the greenhouses in Toulouse, Nice, Paris

Aggregated data (System level)

> GET https://{server}/api/v1/systems/data/aggregated? targetIds={system_uid1},{system_uid2}… &dataIds={data_id1},{data_id2}… &fn={aggregation_function} &access_token={token}

31

« I want to analyze the data sent by all my devices.»

API to get aggregated values for data of all the systems

Aggregated data (Fleet level)

> GET https://{server}/api/v1/systems/data/fleet? targetIds={company_uid1} &dataIds={data_id1},{data_id2}… &fn={system_aggregation_function} &fleetFn={fleet_aggregation_function} &access_token={token}

e.g. get the maximum values of the average temperature of all my greenhouses

32

Want to test the API now?

Try tools like Postman – www.getpostman.com

33

What’s next?

Use the AirVantage API to get data with your favorite language

Check out sample web app “eclo watch”: https://github.com/AirVantage/sampleapp-eclo-watch

Data visualization

Dashboard

34

The key steps again

SensorsActuators MQTT REST

API

Application

Step 1. Develop the embedded code on BBB

Step 2. Register BBB on AirVantage to receive data/ send command

Step 3. Test it on AirVantage

Step 4. Create API clientAuthenticate OAuth 2Use APIs

35

Explore the resources• Get your free trial account: https://signup.airvantage.net/public/avep/

• To get started with AirVantage, check our the User Guide and Developer Guide: https://doc.airvantage.net/

• Find the full list of the API in Develop/ API Documentation

• Check out http://airvantage.github.io/ for API libraries, projects and sample codes

• Tutorials mentioned:

– Connect your BBB to AirVantage using MQTT: https://doc.airvantage.net/display/USERGUIDE/Using+MQTT+with+AirVantage

– Embedded code for BBB to send/receive sensor data to AirVantage: https://github.com/crystallam/beagleboneblack-mqtt-greenhouse

– Web app example (“eclo watch): https://github.com/AirVantage/sampleapp-eclo-watch

• Need help?

– Forum: https://forum.sierrawireless.com/

– Feedback button on the web user interface @crystallam31@airvantage

36

Thank YouThank you

Questions?

37

House by Wayne Tyler Sall from The Noun Project

Thermostat by Luboš Volkov from The Noun Project

Fan by Arthur Shlain from The Noun Project

People by Berkay Sargın from The Noun Project

Cell Phone by Yorlmar Campos from The Noun Project

Router by im icons from The Noun Project

Circuit Board by Mike Wirth from The Noun Project

Credits

top related