2016년 11월 8일 화요일

오픈소스 기반 IoT 기기 연결 플랫폼 Blynk 와 Temboo

이 글은 오픈소스 기반 IoT 기기 연결 플랫폼에 대한 글이다.

1. Blynk 
Blynk는 IoT 기기를 개발하는 메이커에게 도움을 주는 플랫폼이다. Blynk는 하드웨어 간 연결을 지원하고, 가상 사용자 인터페이스를 지원한다. Blynk는 상당히 빠르게 성장하는 오픈소스 기반 IoT 플랫폼이다. 이를 이용하면, 다음과 같은 IoT 센서 앱을 손쉽게 개발할 수 있다.


Blynk는 다음과 같이 인터넷 접근 가능한 다양한 하드웨어와 앱을 서로 연결해 준다. 별도의 PC가 필요없다.


Blynk 서버는 스마트폰과 하드웨어 간 통신을 담당하며, 클라우드 플랫폼으로 동작된다. 하드웨어와 서버 연결을 위해 Blynk Libraries를 제공한다.

복잡한 코딩을 할 필요가 없다. Blynk 앱에서 IoT로 만들고 싶은 인터넷에 연결된 보드 종류를 선택하고, 보드 입출력핀에 연결된 센서나 액추에이터를 선택하면 된다.

불필요한 코딩이 없음. 인터넷에 연결된 보드 종류와 입출력 핀 동작을 지정해 주면 된다

Blynk는 앱 빌더와 퍼블리쉬를 지원하며, 클라우드 기반에서 동작하며, 다양한 임베디드 하드웨어들을 지원한다.


다음 영상은 아두이노에 연결된 센서나 액추에이터를 Blynk를 이용해 얼마나 쉽게 IoT 기반 장치를 만들 수 있는 지를 잘 보여준다. 



Blynk는 매우 쉽고, 게다가, 오픈소스로 많은 위젯이 무료이다. 게다가, Blynk소스 서버가 공유되어 있어, 라즈베리파이 같은 저렴한 PC에 설치해, 자신만의 Blynk서버를 만들 수도 있다.  



아두이노와 센서가 준비되어 있다면, Blynk를 설치하고, IoT 기기를 만드는 데 5분이 걸리지 않는다.  Blynk의 Getting started 사이트는 Blynk 설치 앱과 아두이노를 위한 라이브러리를 제공한다.



Blynk는 매우 다양한 하드웨어를 지원하며, 이 중에는 가격이 불과 5달러 정도 밖에 하지 않은 ESP8266 등도 포함하고 있다. 물론, 유튜브 등에는 이와 관련된 수많은 튜토리얼 영상이 공유되고 있다.

2. TEMBOO
TEMBOO 플랫폼을 이용해 IoT 기기를 손쉽게 개발할 수 있다. Github에 소스가 올라온 지는 벌써 4년이 되어 가는 IoT 플랫폼이다. TEMBOO는 아두이노 기반으로 동작한다. 아두이노 WiFi 쉴드나 아두이노 윤을 이용해 개발할 수 있다. 다만, 아두이노 윤(Arduino Yun)을 이용하면, TEMBOO 플랫폼을 이용해 IoT 기기를 손쉽게 개발할 수 있으나, 아두이노 윤 가격이 9만원으로 매우 비싼것이 단점이다.

100개 이상의 SaaS 사이트에서 제공되는 데이터를 API기반으로 연결해, 아두이노 윤과 연결할 수 있다. 예를 들어, 트위터에서 어떤 메시지가 올라오면, 이 값을 받아서, 네트워크에 연결된 기기를 동작하거나 센싱하는 일을 손쉽게 할 수 있다.


다음은 TEMBOO를 소개하고, 간단한 앱 개발 방법을 보여준다.


단순히, 데이터를 입력받을 장치를 선택하고, 데이터를 변환하는 규칙을 적용한 후, 출력받을 장치를 선택하면 된다.


그럼, 다음과 같은 아두이노 코드를 자동으로 생성해준다.
/*
  GetYahooWeatherReport
  
  Demonstrates making a request to the Yahoo Weather API using the Temboo Arduino Yun library.
  
  This example code is in the public domain.
*/

#include <Bridge.h>
#include <Temboo.h>
#include "TembooAccount.h" // contains Temboo account information

// the address for which a weather forecast will be retrieved
String ADDRESS_FOR_FORECAST = "104 Franklin St., New York NY 10013";

int numRuns = 1;   // execution count, so that this doesn't run forever
int maxRuns = 10;  // max number of times the Yahoo WeatherByAddress Choreo should be run

void setup() {
  Serial.begin(9600);
    
  // for debugging, wait until a serial console is connected
  delay(4000);
  while(!Serial);
  Bridge.begin();
}

void loop()
{
  // while we haven't reached the max number of runs...
  if (numRuns <= maxRuns) {
      
    // print status
    Serial.println("Running GetWeatherByAddress - Run #" + String(numRuns++) + "...");

    // create a TembooChoreo object to send a Choreo request to Temboo
    TembooChoreo GetWeatherByAddressChoreo;
    
    // invoke the Temboo client
    GetWeatherByAddressChoreo.begin();

    // add your temboo account info
    GetWeatherByAddressChoreo.setAccountName(TEMBOO_ACCOUNT);
    GetWeatherByAddressChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
    GetWeatherByAddressChoreo.setAppKey(TEMBOO_APP_KEY);
    
    // set the name of the choreo we want to run
    GetWeatherByAddressChoreo.setChoreo("/Library/Yahoo/Weather/GetWeatherByAddress");
    
    // set choreo inputs; in this case, the address for which to retrieve weather data
    // the Temboo client provides standardized calls to 100+ cloud APIs
    GetWeatherByAddressChoreo.addInput("Address", ADDRESS_FOR_FORECAST);

    // add an output filter to extract the name of the city.
    GetWeatherByAddressChoreo.addOutputFilter("city", "/rss/channel/yweather:location/@city", "Response");
    
    // add an output filter to extract the current temperature
    GetWeatherByAddressChoreo.addOutputFilter("temperature", "/rss/channel/item/yweather:condition/@temp", "Response");

    // add an output filter to extract the date and time of the last report.
    GetWeatherByAddressChoreo.addOutputFilter("date", "/rss/channel/item/yweather:condition/@date", "Response");

    // run the choreo 
    GetWeatherByAddressChoreo.run();
        
    // when the choreo results are available, print them to the serial monitor
    while(GetWeatherByAddressChoreo.available()) {
          
      char c = GetWeatherByAddressChoreo.read();    
      Serial.print(c);
    }
    GetWeatherByAddressChoreo.close();

  }

  Serial.println("Waiting...");
  Serial.println("");
  delay(30000); // wait 30 seconds between GetWeatherByAddress calls
}

TEMBOO 홈페이지에는 TEMBOO를 이용한 다양한 오픈소스 IoT 프로젝트를 다음과 같이 확인할 수 있다.

앞으로는 누구나 자신에게 필요한 IoT 기기를 쉽게 만들고, 제어할 수 있도록, 불필요한 코딩은 점점 줄여나가는 방식으로 발전될 것 같다.

댓글 없음:

댓글 쓰기