工業製造
産業用モノのインターネット | 工業材料 | 機器のメンテナンスと修理 | 産業プログラミング |
home  MfgRobots >> 工業製造 >  >> Manufacturing Technology >> 製造プロセス

ホームスマートホーム

コンポーネントと消耗品

>
Raspberry Pi2モデルB
OrangePIも同様です
× 1
Xbee
× 1
Arduino UNO
× 1

アプリとオンラインサービス

>
Microsoft Azure

このプロジェクトについて

はじめに

MediaTekLinkitを使用してスマートホームシステムをセットアップするために必要なものを見てみましょう。ここにはセンサーデータを読み取るためのハードウェア接続についてガイドする専門家がたくさんいるので、APIの作成と、すべてのセンサーデータをキャプチャするための超低コストの15ドルのローカルサーバーのセットアップに集中します。必要に応じて、データをazureに記録します。

セットアップ

<図>

センサーは、xbeeまたは低コストのトランシーバーを使用して無線信号を介してMediaTekLinkItにデータを送信します。 MediaTek linkItは、すべての生のセンサーデータを受信し、adruinojsonライブラリを使用してjsonオブジェクトにパッケージ化し、ローカルサーバーにPOSTリクエストを送信します。次に、ローカルサーバーはnodejs Webアプリケーションをホストし、すべてのセンサーデータをjsonオブジェクトとして受信します。

ローカルサーバーはプリプロセッサとして使用されており、UTC時間と署名を追加します。データの検証、変換、フィルタリングはすべてここで処理できます。ローカルサーバーは、すべてのデータをクラウドサービス(この場合は紺碧のストレージサービス)に記録します。または、MediaTek linkItは、jsonオブジェクトをAzureストレージサービスに直接投稿できます。 15ドルのPCがデータを処理するのに十分強力であることを証明するために、ローカルサーバーをセットアップしました。ローカルサーバーでもSQL以外のデータベースにデータを記録できるため、外部クラウドストレージが不要になります。これはすべて皆さんにお任せします。

<図> <図> <図>

デモ

   

前提条件

センサーとarduinoやmediaTekなどのマイクロコントローラーを使用してセンサーデータを読み取る方法を知っていると思います。このプロジェクトの範囲を制限するために、センサーデータがMediaTek LinkItで利用可能であると想定します。ローキャスト無線トランシーバーまたはXbeeを使用して、MediaTekなどのマイクロコントローラーに接続されたセンサーとの間で無線信号を送受信できます。初心者は、MediaTek linkItグルーブスターターキットを使用して、温度、湿度、光などの外部環境データを読み取ることができます。

Json Json Json

Jsonは、IoTの事実上の標準になり、広く採用されています。前提条件について述べたので、センサーデータのモデリングから始めましょう。主な目的は、できるだけ多くのデータをキャプチャしてサーバーに渡すことです。サーバーは、分析、データ変換、機械学習などのすべての手間のかかる作業を実行できます。

「望ましい」 jsonオブジェクトは、センサーデータの望ましい状態になります。たとえば、温度を記録する場合、24という望ましい値は、値を24の値でクラウドに同期する必要があることを意味します。ウェブアプリやモバイルアプリなどのクライアントは、この値に更新されます。

ライトをオンにしたいときは、希望の状態をオンにします。これは、ライトがオンになっている、またはオンになることを意味します。すべてのクライアントアプリケーションは、この状態を使用してユーザーへの変更を反映します。つまり、Webアプリのアイコンがオンまたはオフになります。

これは国際標準ではありません。私はこれを思いついたばかりです。だから、あなた自身の便利なフォーマットを自由に使ってください。

温度

  {"deviceid": "iot / myhome / livingroom / thermostat" "desired":{"temperature": "24"、 "humidity": "80"}、 "timeutc": "2015-11 -23T00:41:48.824Z "、" singedBy ":" localserver "}  

マイク

  {"deviceid": "iot / myhome / livingroom / mic" "desired":{"intensity": "66"}、 "timeutc": "2015-11-23T00:41:48.824Z" 、 "singedBy": "localserver"}  

距離

  {"deviceid": "iot / myhome / livingroom / obstacle" "desired":{"proximity": "150"}、 "timeutc": "2015-01-01"、 "singedBy": "localserver"}  

PIR

  {"deviceid": "iot / myhome / livingroom / pir" "desired":{"motion start": "2500"、 "motion end": "5345"}、 "timeutc": "2015 -11-23T00:41:48.824Z "、" singedBy ":" localserver "}  

GPS

  {"deviceid": "iot / mydevice / location" "desired":{"lat": "25.5"、 "long": "32.2"}、 "timeutc": "2015-11-23T00 :41:48.824Z "、" singedBy ":" localserver "}  

湿気

  {"deviceid": "/ iot / myhome / garden / moisture" "desired":{"moisture": "20"}、 "timeutc": "2015-11-23T00:41:48.824Z "、" singedBy ":" localserver "}  

ガス

  {"deviceid": "/ iot / myhome / kitchen / gas" "desired":{"leak": "No"}、 "timeutc": "2015-11-23T00:41:48.824Z "、" singedBy ":" localserver "}  

軽い

  {"deviceid": "/ iot / myhome / livingroom / light" "desired":{"intensity": "60"}、 "timeutc": "2015-11-23T00:41:48.824Z "、" singedBy ":" localserver "}  

またはこれを使用してください

リビングルーム

  {"deviceid": "/ iot / myhome / livingroom" "desired":{"temperature": "25"、 "humidity": "80"、 "" " ":"閉じた "、"軽い ":" 80 "、"ノイズ ":"低い "}}  

ベッドルーム

  {"deviceid": "/ iot / myhome / bedroom" "desired":{"temperature": "24"、 "humidity": "70"、 "window": "closed" ":" closed "、" light ":" 80 "、" ac ":" on "" noise ":" low "}}  

MediaTek-レシーバー

ローカルサーバーにデータを記録するには、ソフトウェアセクションに添付されているinoファイルを参照してください。センサーデータがシミュレートされ、実際の読み取り値をそれぞれのjsonオブジェクトに渡すことができます

ローカルサーバー

ローカルサーバーはオーバーヘッドを追加しますが、多くの点で役立つことが確認されます。 IoTデータのプリプロセッサとしてローカルサーバーを利用できます。データはフィルタリング、タイムスタンプ、署名が可能です

小さなPCとnodejsは、ローカルサーバーに最適です。ラズベリーパイ、オドリオド、バナナパイ、ビーグルボーンなど、どんな小さなPCでも選択できます。このプロジェクトではオレンジパイ($ 15)を選択しました。

セットアップ

nodejs5をサポートする任意の種類のLinuxOSを備えたRaspberrypi2またはOrangePi。arm7にはarchlinuxを備えたorangepiを選択しました。 nodejsとnpmをインストールしました。 githubからiotappをダウンロードし、/ your / local / path / iotappに移動して、npminstallを実行します。基本的なexpressjsアプリがポート3000でリッスンを開始します。

your-local-ip:3000を参照して、デフォルトのexpressjsビューがレンダリングされているかどうかを確認します。センサーデータを投稿するためにこれらのAPIを作成しました

/ iot / myhome / livingroom / thermostat-温度API

/ iot / myhome / livingroom / mic-サウンドAPI

/ iot / myhome / livingroom / pir-プレゼンスセンサーAPI

/ iot / myhome / livingroom / distance-距離センサーAPI

/ iot / myhome / mydevice / location --gps tracker api

/ iot / myhome / garden / moisture-土壌水分センサーAPI

/ iot / myhome / kitchen / gas-ガス漏れセンサーAPI

/ iot / myhome / livingroom / light-光センサーAPI

/ iot / myhome / livingroom-リビングルーム用の他のAPI

/ iot / myhome / bedroom-ベッドルーム用の他のAPI


ローカルサーバーをセットアップします。 githubからソースコードiotappのクローンを作成します。 index.jsを変更して、aspnet5アプリケーションがazureでホストされているクラウドIPアドレスまたはドメイン名を配置します

リモートサーバー

クラウドへのデータの公開は、今日人気が高まっています。アマゾン、紺碧、スパークファン、パブナブ、初期状態、その他多くのIoTデータ提供からサブスクリプションを購入できます。このデモでは紺碧を選択しました。データ分析、データマイニング、機械学習アルゴリズムを開発して、データを処理できます。

githubからiotwebappをダウンロードします。 asp.net5をターゲットにしたVisualStudio2015を使用して作成しました。これらのAPIは、IoTデータを投稿するように設定されています。 APIはIoTをAzureストレージテーブルに記録します

deviceidパラメータを設定して、センサーの場所を特定できます。

これらのAPIは設定されています。

api / iot / myhome / thermostat-すべてのサーモスタットデータをログに記録するasp.net5web api

api / iot / myhome / microphone- asp.net5 webapiですべてのマイクデータをログに記録します

api / iot / myhome / pir-すべてのpirデータをログに記録するasp.net5web api

api / iot / myhome / distance-すべての距離センサーデータをログに記録するasp.net5web api

api / iot / myhome / device / location-gpsデータをログに記録するasp.net5 web api

api / iot / myhome / moisture-水分センサーデータをログに記録するasp.net5web api

api / iot / myhome / gas-ガスセンサーデータをログに記録するasp.net5web api

api / iot / myhome / light-すべての光センサーデータをログに記録するasp.net5web api

api / iot / myhome / livingroom-asp.net5 web apiを使用して、すべてのリビングルームの属性/センサーデータをログに記録します。この1つのAPIを使用して、すべてのセンサー値をプッシュできます。

api / iot / myhome / bedroom-上記と同じように、寝室の詳細をログに記録するために作成しました。

リモートサーバーをセットアップします。 githubからソースコードiotwebappのクローンを作成します。紺碧のストレージテーブルを作成します。 IoTController.csを変更し、Azureストレージテーブルのアカウント名とキーを入力します。このドメイン名またはIPをローカルサーバーで使用する

結論

コードにはリファクタリングする領域がたくさんあります。お気軽に変更して、攻撃を受けた場合はお知らせください。

コード

  • MediaTekRx
  • nodejs-ローカルサーバー
  • ThermoStatController.cs
  • PIRController.cs
  • MoistureController.cs
  • LivingRoomController.cs
  • LightController.cs
  • GPSController.cs
  • GasController.cs
  • DistanceController.cs
  • BedRoomController.cs
MediaTekRx C / C ++
受信機としてのMediaTek。ローカルデータからローカルサーバーへのスケッチ
 / * Webクライアントこのスケッチは、MediaTekLinkItプラットフォームのWi-Fi機能を使用してWebサイトに接続します。それに応じて、マクロWIFI_AP、WIFI_PASSWORD、WIFI_AUTH、およびSITE_URLを変更します。 2010年7月13日作成dlf(Metodo2 srl)変更2012年5月31日TomIgoe変更2014年8月20日MediaTekInc。* /#include  #include  #include  #include  #define WIFI_AP "your ap" #define WIFI_PASSWORD "your password" #define WIFI_AUTH LWIFI_WPA // LWIFI_OPEN、LWIFI_WPA、またはLWIFI_WEPから選択します。#defineSITE_URL "your ip" //ノードjsまたは紺碧のIPアドレスまたはドメイン名LWiFiClientc; void setup(){LWiFi.begin(); Serial.begin(115200); // APに接続されるまで再試行を続けますSerial.println( "Connecting to AP"); while(0 ==LWiFi.connect(WIFI_AP、LWiFiLoginInfo(WIFI_AUTH、WIFI_PASSWORD))){delay(1000); } // Webサイトに接続するまで再試行を続けるSerial.println( "Connecting to WebSite"); while(0 ==c.connect(SITE_URL、3000)){Serial.println( "Webサイトへの再接続"); delay(1000); }} boolean connectedMsg =false; void loop(){//接続されていることを確認し、応答コンテンツをSerialにダンプしますwhile(!c){Serial.println( "サーバーが切断されました.."); // Webサイトに接続するまで再試行を続けますSerial.println( "Connecting to WebSite"); while(0 ==c.connect(SITE_URL、3000)){Serial.println( "Webサイトへの再接続"); delay(1000); }} Serial.println( "読み取り温度.."); updateTemperature(); delay(3000); Serial.println( "音の検出.."); updateSound(); delay(3000); Serial.println( "人の動きを検出しています.."); updatePIR(); delay(3000); Serial.println( "障害物の検出.."); updateDistance(); delay(3000); Serial.println( "デバイスの場所を更新しています.."); updateGPSTracker(); delay(3000); Serial.println( "土壌水分の計算.."); updateMoisture(); delay(3000); Serial.println( "ガス漏れの検出.."); updateGasLeak(); delay(3000); Serial.println( "記録光強度.."); updateLightIntensity(); delay(3000); updateLivingroomAttributes(); delay(3000); update BedroomAttributes(); delay(3000);} void writeToConsole(){//接続されていることを確認し、応答コンテンツをSerialにダンプしますwhile(c){int v =c.read(); if(v!=-1){Serial.print((char)v); }} Serial.println(); Serial.println( "サーバーが切断されました.."); // Webサイトに接続するまで再試行を続けますSerial.println( "Connecting to WebSite"); while(0 ==c.connect(SITE_URL、3000)){Serial.println( "Webサイトへの再接続"); delay(1000); }} void updatePIR(){long unsigned int s; DynamicJsonBuffer jsonBuffer; JsonObject&root =jsonBuffer.createObject(); JsonObject&desired =root.createNestedObject( "desired"); root ["deviceid"] ="/ iot / myhome / livingroom / pir"; //デフォルトの単位がdesired ["motionstart"] =String(random(0,1000));であると想定します。望ましい["motionend"] =String(random(1000,10000));文字列len =String(root.measureLength()); c.println( "POST / iot / myhome / livingroom / pir HTTP / 1.1"); c.println( "ホスト:" SITE_URL); c.println( "Content-Type:application / json"); c.println( "Cache-Control:no-cache"); c.print( "Content-Length:"); c.println(len); c.println( "接続:閉じる"); c.println(); root.printTo(c); root.printTo(シリアル); //遅いサーバー応答を検出し、デッド応答を待たずに要求を再送信するロジックs =millis(); //サーバーの応答を待機していますSerial.println( "HTTP応答を待機中:"); while(!c.available()){delay(100); if((millis()-s> 3000)){Serial.println(); Serial.println( "サーバーが応答していません..");壊す; }} Serial.println( "コンソールへの書き込みの呼び出し.."); writeToConsole(); } void updateDistance(){long unsigned int s; DynamicJsonBuffer jsonBuffer; JsonObject&root =jsonBuffer.createObject(); JsonObject&desired =root.createNestedObject( "desired"); root ["deviceid"] ="/ iot / myhome / livingroom / distancesensor"; //デフォルトの単位cmdesired ["obstacle"] =String(random(50,450));と仮定します。文字列len =String(root.measureLength()); c.println( "POST / iot / myhome / livingroom / distance HTTP / 1.1"); c.println( "ホスト:" SITE_URL); c.println( "Content-Type:application / json"); c.println( "Cache-Control:no-cache"); c.print( "Content-Length:"); c.println(len); c.println( "接続:閉じる"); c.println(); root.printTo(c); root.printTo(シリアル); s =ミリ秒(); //サーバーの応答を待機していますSerial.println( "HTTP応答を待機中:"); while(!c.available()){delay(100); if((millis()-s> 3000)){Serial.println(); Serial.println( "サーバーが応答していません..");壊す; }} Serial.println( "コンソールへの書き込みの呼び出し.."); writeToConsole(); } void updateGPSTracker(){long unsigned int s; DynamicJsonBuffer jsonBuffer; JsonObject&root =jsonBuffer.createObject(); JsonObject&desired =root.createNestedObject( "desired"); root ["deviceid"] ="/ iot / mydevice";望ましい["lat"] =String(random(20,25)); desired ["long"] =String(random(22,27));文字列len =String(root.measureLength()); c.println( "POST / iot / mydevice / location HTTP / 1.1"); c.println( "ホスト:" SITE_URL); c.println( "Content-Type:application / json"); c.println( "Cache-Control:no-cache"); c.print( "Content-Length:"); c.println(len); c.println( "接続:閉じる"); c.println(); root.printTo(c); root.printTo(シリアル); s =ミリ秒(); //サーバーの応答を待機していますSerial.println( "HTTP応答を待機中:"); while(!c.available()){delay(100); if((millis()-s> 3000)){Serial.println(); Serial.println( "サーバーが応答していません..");壊す; }} Serial.println( "コンソールへの書き込みの呼び出し.."); writeToConsole();} void updateMoisture(){long unsigned int s; DynamicJsonBuffer jsonBuffer; JsonObject&root =jsonBuffer.createObject(); JsonObject&desired =root.createNestedObject( "desired"); root ["deviceid"] ="/ iot / myhome / garden / moisture"; //デフォルトの単位が望ましいと仮定します["moisture"] =String(random(40,60));文字列len =String(root.measureLength()); c.println( "POST / iot / myhome / garden / moisture HTTP / 1.1"); c.println( "ホスト:" SITE_URL); c.println( "Content-Type:application / json"); c.println( "Cache-Control:no-cache"); c.print( "Content-Length:"); c.println(len); c.println( "接続:閉じる"); c.println(); root.printTo(c); root.printTo(シリアル); s =ミリ秒(); //サーバーの応答を待機していますSerial.println( "HTTP応答を待機中:"); while(!c.available()){delay(100); if((millis()-s> 3000)){Serial.println(); Serial.println( "サーバーが応答していません..");壊す; }} Serial.println( "コンソールへの書き込みの呼び出し.."); writeToConsole(); } void updateGasLeak(){DynamicJsonBuffer jsonBuffer; JsonObject&root =jsonBuffer.createObject(); JsonObject&desired =root.createNestedObject( "desired"); desired ["leak"] ="no"; root ["deviceid"] ="/ iot / myhome / kitchen / gas"; long unsigned int s;文字列len =String(root.measureLength()); c.println( "POST / iot / myhome / kitchen / gas HTTP / 1.1"); c.println( "ホスト:" SITE_URL); c.println( "Content-Type:application / json"); c.println( "Cache-Control:no-cache"); c.print( "Content-Length:"); c.println(len); c.println( "接続:閉じる"); c.println(); root.printTo(c); root.printTo(シリアル); s =ミリ秒(); //サーバーの応答を待機していますSerial.println( "HTTP応答を待機中:"); while(!c.available()){delay(100); if((millis()-s> 3000)){Serial.println(); Serial.println( "サーバーが応答していません..");壊す; }} Serial.println( "コンソールへの書き込みの呼び出し.."); writeToConsole(); } void updateLightIntensity(){DynamicJsonBuffer jsonBuffer; JsonObject&root =jsonBuffer.createObject(); JsonObject&desired =root.createNestedObject( "desired");望ましい["強度"] ="80"; root ["deviceid"] ="/ iot / myhome / livingroom / light"; long unsigned int s;文字列len =String(root.measureLength()); c.println( "POST / iot / myhome / livingroom / light HTTP / 1.1"); c.println( "ホスト:" SITE_URL); c.println( "Content-Type:application / json"); c.println( "Cache-Control:no-cache"); c.print( "Content-Length:"); c.println(len); c.println( "接続:閉じる"); c.println(); root.printTo(c); root.printTo(シリアル); s =ミリ秒(); //サーバーの応答を待機していますSerial.println( "HTTP応答を待機中:"); while(!c.available()){delay(100); if((millis()-s> 3000)){Serial.println(); Serial.println( "サーバーが応答していません..");壊す; }} Serial.println( "コンソールへの書き込みの呼び出し.."); writeToConsole(); } void updateLivingroomAttributes(){DynamicJsonBuffer jsonBuffer; JsonObject&root =jsonBuffer.createObject(); root ["deviceid"] ="/ iot / myhome / livingroom"; JsonObject&desired =root.createNestedObject( "desired"); // logginリビングルーム属性の代替APIを一度に必要とします["window"] ="open"; desired ["door"] ="closed"; desired ["ac"] ="off";望ましい["温度"] =String(random(24,28));望ましい["湿度"] =String(random(60,65)); long unsigned int s;文字列len =String(root.measureLength()); c.println( "POST / iot / myhome / livingroom HTTP / 1.1"); c.println( "ホスト:" SITE_URL); c.println( "Content-Type:application / json"); c.println( "Cache-Control:no-cache"); c.print( "Content-Length:"); c.println(len); c.println( "接続:閉じる"); c.println(); root.printTo(c); root.printTo(シリアル); s =ミリ秒(); //サーバーの応答を待機していますSerial.println( "HTTP応答を待機中:"); while(!c.available()){delay(100); if((millis()-s> 3000)){Serial.println(); Serial.println( "サーバーが応答していません..");壊す; }} Serial.println( "コンソールへの書き込みの呼び出し.."); writeToConsole(); } void update BedroomAttributes(){DynamicJsonBuffer jsonBuffer; JsonObject&root =jsonBuffer.createObject(); root ["deviceid"] ="/ iot / myhome / bedroom"; JsonObject&desired =root.createNestedObject( "desired"); // logginリビングルーム属性の代替APIを一度に必要とします["window"] ="open"; desired ["door"] ="closed"; desired ["ac"] ="off";望ましい["温度"] =String(random(22,23));望ましい["湿度"] =String(random(75,80)); long unsigned int s;文字列len =String(root.measureLength()); c.println( "POST / iot / myhome / bedroom HTTP / 1.1"); c.println( "ホスト:" SITE_URL); c.println( "Content-Type:application / json"); c.println( "Cache-Control:no-cache"); c.print( "Content-Length:"); c.println(len); c.println( "接続:閉じる"); c.println(); root.printTo(c); root.printTo(シリアル); s =ミリ秒(); //サーバーの応答を待機していますSerial.println( "HTTP応答を待機中:"); while(!c.available()){delay(100); if((millis()-s> 3000)){Serial.println(); Serial.println( "サーバーが応答していません..");壊す; }} Serial.println( "コンソールへの書き込みの呼び出し.."); writeToConsole(); } void updateSound(){long unsigned int s; long unsigned int e; DynamicJsonBuffer jsonBuffer; JsonObject&root =jsonBuffer.createObject(); JsonObject&desired =root.createNestedObject( "desired");望ましい["強度"] =String(random(40,80)); root ["deviceid"] ="/ iot / myhome / livingroom / mic"; root ["timeutc"] =""; root ["signedby"] ="";文字列len =String(root.measureLength()); c.println( "POST / iot / myhome / livingroom / mic HTTP / 1.1"); c.println( "ホスト:" SITE_URL); c.println( "Content-Type:application / json"); c.println( "Cache-Control:no-cache"); c.print( "Content-Length:"); c.println(len); c.println( "接続:閉じる"); c.println(); root.printTo(c); root.printTo(シリアル); s =ミリ秒(); //サーバーの応答を待機していますSerial.println( "HTTP応答を待機中:"); while(!c.available()){delay(100); if((millis()-s> 3000)){Serial.println(); Serial.println( "サーバーが応答していません..");壊す; }} Serial.println( "コンソールへの書き込みの呼び出し.."); writeToConsole();} void updateTemperature(){long unsigned int s; long unsigned int e; DynamicJsonBuffer jsonBuffer; JsonObject&root =jsonBuffer.createObject(); JsonObject&desired =root.createNestedObject( "desired");望ましい["温度"] =String(random(20,40));望ましい["湿度"] =String(random(60,80)); root ["deviceid"] ="/ iot / myhome / livingroom / thermostat"; root ["timeutc"] =""; root ["signedby"] ="";文字列len =String(root.measureLength()); c.println( "POST / iot / myhome / livingroom / thermostat HTTP / 1.1"); c.println( "ホスト:" SITE_URL); c.println( "Content-Type:application / json"); c.println( "Cache-Control:no-cache"); c.print( "Content-Length:"); c.println(len); c.println( "接続:閉じる"); c.println(); root.printTo(c); root.printTo(シリアル); s =ミリ秒(); //サーバーの応答を待機していますSerial.println( "HTTP応答を待機中:"); while(!c.available()){delay(100); if((millis()-s> 3000)){Serial.println(); Serial.println( "サーバーが応答していません..");壊す; }} Serial.println( "コンソールへの書き込みの呼び出し.."); writeToConsole(); } 
nodejs-ローカルサーバー JavaScript
MediaTekからデータを受信するルートを持つindex.js
 var express =require( 'express'); var router =express.Router(); var buf =require( 'buffer'); var request =require( "request"); // your-ip-or-domain-nameを実際のIPアドレスまたはドメイン名に置き換えます//exampleiot.azurewebsites.com//example yourdomainname.com//example 47.12.67.16 // acceptホームページのPOSTリクエストrouter.post( '/ iot / myhome / livingroom / thermostat'、function(req、res){var state =req.body; state.timeutc =new Date(); state.signedby ="orangepi"; console.log(state); var options ={メソッド: 'POST'、url: 'http:// your-ip-or-domain-name / api / iot / myhome / livingroom / thermostat'、ヘッダー:{'キャッシュ-control ':' no-cache '、' content-type ':' application / json '}、body:state、json:true}; request(options、function(error、response、body){if(error)throw new Error(error); console.log(body);}); res.send( 'リビングルームの温度が記録されました');}); // POSTリクエストを受け入れるmicrou ter.post( '/ iot / myhome / livingroom / mic'、function(req、res){var state =req.body; state.timeutc =new Date(); state.signedby ="orangepi"; console.log(state); var options ={メソッド: 'POST'、url: 'http:// your-ip-or-domain-name / api / iot / myhome / livingroom / microphone'、ヘッダー:{'cache-control': 'no- cache '、' content-type ':' application / json '}、body:state、json:true}; request(options、function(error、response、body){if(error)throw new Error(error); console.log(body);}); res.send( 'リビングルームの音の強さを記録');}); // POSTリクエストを受け入れるpirrouter.post( '/ iot / myhome / livingroom / pir'、function(req、res){var state =req.body; state.timeutc =new Date(); state.signedby ="orangepi"; console.log(state); var options ={メソッド: 'POST'、url: 'http:// your-ip-or-domain-name / api / iot / myhome / livingroom / pir '、ヘッダー:{' cache-control ':' no-cache '、' content-type ':' application / json '}、body:state、json:true};リクエスト(options、function(error、response、body){if(error)throw new Error(error); console.log(body);}); res.send( 'リビングルームのピルの動きが記録されました');}); / / POSTリクエストを受け入れるdistancerouter.post( '/ iot / myhome / livingroom / distance'、function(req、res){var state =req.body; state.timeutc =new Date(); state.signedby ="orangepi"; console.log(state); var options ={メソッド: 'POST'、url: 'http:// your-ip-or-domain-name / api / iot / myhome / livingroom / distance'、ヘッダー:{'キャッシュ-コントロール': ' no-cache '、' content-type ':' application / json '}、body:state、json:true}; request(options、function(error、response、body){if(error)throw new Error(error); console.log(body);}); res.send( 'リビングルームの障害物が記録されました');}); // POSTリクエストを受け入れるgpsrouter.post( '/ iot / mydevice / location'、function(req、res){var state =req.body; state.timeutc =new Date(); state.signedby ="orangepi"; console.log(state); var options ={メソッド: 'POST'、url: 'http:// your-ip-or-domain-name / api / iot / mydevice / location / gps '、ヘッダー:{' cache-control ':' no-cache '、' content-type ':' application / json '}、body:state、json:true}; request(options、 function(error、response、body){if(error)throw new Error(error); console.log(body);}); res.send( 'device locationrecorded');}); // POSTリクエストを受け入れるmoisturerouter .post( '/ iot / myhome / garden / moisture'、function(req、res){var state =req.body; state.timeutc =new Date(); state.signedby ="orangepi"; console.log(state ); var options ={メソッド: 'POST'、url: 'http:// your-ip-or-domain-name / api / iot / myhome / garden / moisture'、ヘッダー:{'cache-control': ' no-cache '、' content-ty pe ':' application / json '}、body:state、json:true}; request(options、function(error、response、body){if(error)throw new Error(error); console.log(body);}); res.send( 'ガーデン水分レベルが記録されました');}); // POSTリクエストを受け入れるgasrouter.post( '/ iot / myhome / kitchen / gas'、function(req、res){var state =req.body; state .timeutc =new Date(); state.signedby ="orangepi"; console.log(state); var options ={メソッド: 'POST'、url: 'http:// your-ip-or-domain-name / api / iot / myhome / kitchen / gas '、ヘッダー:{' cache-control ':' no-cache '、' content-type ':' application / json '}、body:state、json:true}; request( options、function(error、response、body){if(error)throw new Error(error); console.log(body);}); res.send( 'ガスリーク情報が記録されました');}); //受け入れるPOSTリクエストlightrouter.post( '/ iot / myhome / livingroom / light'、function(req、res){var state =req.body; state.timeutc =new Date(); state.signedby ="orangepi"; console。 log(state); var options ={メソッド: 'POST'、url: 'http:// your-ip-or-domain-name / api / iot / myhome / livingroom / light'、ヘッダー:{'cache-control ':'キャッシュなし '、'コンテンツ-type ':' application / json '}、body:state、json:true}; request(options、function(error、response、body){if(error)throw new Error(error); console.log(body);}); res.send( '光強度記録');}); // POSTリクエストを受け入れるlivingroomrouter.post( '/ iot / myhome / livingroom'、function(req、res){var state =req.body; state.timeutc =new Date(); state.signedby ="orangepi"; console.log(state); var options ={メソッド: 'POST'、url: 'http:// your-ip-or-domain-name / api / iot / myhome / room / livingroom '、ヘッダー:{' cache-control ':' no-cache '、' content-type ':' application / json '}、body:state、json:true}; request(options、function (error、response、body){if(error)throw new Error(error); console.log(body);}); res.send( 'Livingroom attributerecorded');}); // POSTリクエストbedroomrouterを受け入れます。 post( '/ iot / myhome / bedroom'、function(req、res){var state =req.body; state.timeutc =new Date(); state.signedby ="orangepi"; console.log(state); var options ={メソッド: 'POST'、url: 'http:// your-ip-or-domain-name / api / iot / myhome / room / bedroom'、ヘッダー:{'cache-control': 'no-cache '、'コンテンツタイプ ' : 'application / json'}、body:state、json:true}; request(options、function(error、response、body){if(error)throw new Error(error); console.log(body);}); res.send( '寝室の属性が記録されました');}); // /userrouter.put('/user'、function(req、res){res.send('Got a PUT request at / user 'でPUTリクエストを受け入れます);}); ///user//router.delete('/user'、function(req、res){// res.send( 'Got a DELETE request at / user'); //でDELETEリクエストを受け入れる}); / *ホームページを取得します。 * /router.get('/'、function(req、res、next){res.render('index'、{title:'Express '});}); module.exports =router; 
ThermoStatController.cs C#
apiを使用して温度データをクラウドに記録します
 using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Newtonsoft.Json; usingMicrosoft.WindowsAzure。 Storage; using Microsoft.WindowsAzure.Storage.Auth; using Microsoft.WindowsAzure.Storage.Table; //空のプロジェクトでMVCを有効にする方法の詳細については、http://go.microsoft.com/fwlink/?LinkID =397860namespaceiotwebappにアクセスしてください。 .Controllers {[Route( "api / iot / myhome / livingroom / [Controller]")] public class ThermoStatController:IoTController {// GET:/  / public IActionResult Index(){return View(); } [HttpPost] public IActionResult Post([FromBody] IotTemperature iotTemperature){//テーブルクライアントを作成します。 CloudTableClient tableClient =storageAccount.CreateCloudTableClient(); //「people」テーブルを表すCloudTableオブジェクトを作成します。 CloudTableテーブル=tableClient.GetTableReference( "iot"); iotTemperature.PartitionKey ="サーモスタット"; iotTemperature.RowKey =Guid.NewGuid()。ToString(); //顧客エンティティを挿入するTableOperationオブジェクトを作成します。 TableOperation insertOperation =TableOperation.Insert(iotTemperature); //挿入操作を実行します。 table.Execute(insertOperation); Ok( "紺碧の雲に記録された温度データ..");を返します。 }} public class IotTemperature:TableEntity {public string deviceid {get;セットする; } public string timeutc {get;セットする; } public string signby {get;セットする; } public string state {get {return JsonConvert.SerializeObject(this.desired); } セットする {; }} publicDesireddesired {get;セットする; } public class Desired {public stringtemperature {get;セットする; }パブリック文字列湿度{取得;セットする; }}}} 
PIRController.cs C#
存在センサーデータをazureに記録するためのAPI
 using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.WindowsAzure.Storage.Table; using Newtonsoft.Json; //空のプロジェクトでWebAPIを有効にする方法の詳細については、http://go.microsoft.com/fwlink/?LinkID =397860namespace iotwebapp.Controllers {[Route( "api / iot / myhome / livingroom / [Controller] ")] public class PIRController:IoTController {[HttpPost] public IActionResult Post([FromBody] IotPIR iotPIR){//テーブルクライアントを作成します。 CloudTableClient tableClient =storageAccount.CreateCloudTableClient(); //「people」テーブルを表すCloudTableオブジェクトを作成します。 CloudTableテーブル=tableClient.GetTableReference( "iot"); iotPIR.PartitionKey ="pir"; iotPIR.RowKey =Guid.NewGuid()。ToString(); //顧客エンティティを挿入するTableOperationオブジェクトを作成します。 TableOperation insertOperation =TableOperation.Insert(iotPIR); //挿入操作を実行します。 table.Execute(insertOperation); Ok( "Azureクラウドに記録されたPIRデータ..");を返します。 }} public class IotPIR:TableEntity {public string deviceid {get;セットする; } public string timeutc {get;セットする; } public string signby {get;セットする; } public string state {get {return JsonConvert.SerializeObject(this.desired); } セットする {; }} publicDesireddesired {get;セットする; } public class Desired {public string motionstart {get;セットする; } public string motionend {get;セットする; }}}} 
MoistureController.cs C#
土壌水分データをazureに記録するためのAPI
 using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.WindowsAzure.Storage.Table; using Newtonsoft.Json; //空のプロジェクトでWebAPIを有効にする方法の詳細については、http://go.microsoft.com/fwlink/?LinkID =397860namespace iotwebapp.Controllers {[Route( "api / iot / myhome / garden / [Controller] ")] public class MoistureController:IoTController {[HttpPost] public IActionResult Post([FromBody] IotMoisture iotMoisture){//テーブルクライアントを作成します。 CloudTableClient tableClient =storageAccount.CreateCloudTableClient(); //「people」テーブルを表すCloudTableオブジェクトを作成します。 CloudTableテーブル=tableClient.GetTableReference( "iot"); iotMoisture.PartitionKey ="moisture"; iotMoisture.RowKey =Guid.NewGuid()。ToString(); //顧客エンティティを挿入するTableOperationオブジェクトを作成します。 TableOperation insertOperation =TableOperation.Insert(iotMoisture); //挿入操作を実行します。 table.Execute(insertOperation); Ok( "紺碧の雲に記録された水分データ..");を返します。 }} public class IotMoisture:TableEntity {public string deviceid {get;セットする; } public string timeutc {get;セットする; } public string signby {get;セットする; } public string state {get {return JsonConvert.SerializeObject(this.desired); } セットする {; }} publicDesireddesired {get;セットする; } public class Desired {public stringmoisture {get;セットする; }}}} 
LivingRoomController.cs C#
apiを使用して、すべてのリビングルームセンサーデータをazureに記録します
 using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.WindowsAzure.Storage.Table; using Newtonsoft.Json; //空のプロジェクトでWebAPIを有効にする方法の詳細については、http://go.microsoft.com/fwlink/?LinkID =397860namespace iotwebapp.Controllers {[Route( "api / iot / myhome / room / [controller] ")] public class LivingRoomController:IoTController {[HttpPost] public IActionResult Post([FromBody] IotLivingRoom iotLivingRoom){//テーブルクライアントを作成します。 CloudTableClient tableClient =storageAccount.CreateCloudTableClient(); //「people」テーブルを表すCloudTableオブジェクトを作成します。 CloudTableテーブル=tableClient.GetTableReference( "iot"); iotLivingRoom.PartitionKey ="リビングルーム"; iotLivingRoom.RowKey =Guid.NewGuid()。ToString(); //顧客エンティティを挿入するTableOperationオブジェクトを作成します。 TableOperation insertOperation =TableOperation.Insert(iotLivingRoom); //挿入操作を実行します。 table.Execute(insertOperation); return Ok( "居間の属性が紺碧の雲に記録されました.."); }} public class IotLivingRoom:TableEntity {public string deviceid {get;セットする; } public string timeutc {get;セットする; } public string signby {get;セットする; } public string state {get {return JsonConvert.SerializeObject(this.desired); } セットする {; }} publicDesireddesired {get;セットする; } public class Desired {public string window {get;セットする; } public string door {get;セットする; } public string ac {get;セットする; } public stringtemperature {get;セットする; }パブリック文字列湿度{取得;セットする; }}}} 
LightController.cs C#
光センサーデータをazureに記録するためのAPI
 using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.WindowsAzure.Storage.Table; using Newtonsoft.Json; //空のプロジェクトでWebAPIを有効にする方法の詳細については、http://go.microsoft.com/fwlink/?LinkID =397860namespace iotwebapp.Controllers {[Route( "api / iot / myhome / livingroom / [Controller] ")] public class LightController:IoTController {[HttpPost] public IActionResult Post([FromBody] IotLight iotLight){//テーブルクライアントを作成します。 CloudTableClient tableClient =storageAccount.CreateCloudTableClient(); //「people」テーブルを表すCloudTableオブジェクトを作成します。 CloudTableテーブル=tableClient.GetTableReference( "iot"); iotLight.PartitionKey ="light"; iotLight.RowKey =Guid.NewGuid()。ToString(); //顧客エンティティを挿入するTableOperationオブジェクトを作成します。 TableOperation insertOperation =TableOperation.Insert(iotLight); //挿入操作を実行します。 table.Execute(insertOperation); Ok( "紺碧の雲に記録された光の強度..");を返します。 }} public class IotLight:TableEntity {public string deviceid {get;セットする; } public string timeutc {get;セットする; } public string signby {get;セットする; } public string state {get {return JsonConvert.SerializeObject(this.desired); } セットする {; }} publicDesireddesired {get;セットする; } public class Desired {パブリック文字列強度{get;セットする; }}}} 
GPSController.cs C#
gpsデータをazureに記録するためのAPI
 using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.WindowsAzure.Storage.Table; using Newtonsoft .Json; //空のプロジェクトでWebAPIを有効にする方法の詳細については、http://go.microsoft.com/fwlink/?LinkID =397860namespace iotwebapp.Controllers {[Route( "api / iot / mydevice / location / [ Controller] ")] public class GPSController:IoTController {[HttpPost] public IActionResult Post([FromBody] IotGPS iotGPS){//テーブルクライアントを作成します。 CloudTableClient tableClient =storageAccount.CreateCloudTableClient(); //「people」テーブルを表すCloudTableオブジェクトを作成します。 CloudTableテーブル=tableClient.GetTableReference( "iot"); iotGPS.PartitionKey ="gps"; iotGPS.RowKey =Guid.NewGuid()。ToString(); //顧客エンティティを挿入するTableOperationオブジェクトを作成します。 TableOperation insertOperation =TableOperation.Insert(iotGPS); //挿入操作を実行します。 table.Execute(insertOperation); Ok( "紺碧の雲に記録されたGPSデータ..");を返します。 }} public class IotGPS:TableEntity {public string deviceid {get;セットする; } public string timeutc {get;セットする; } public string signby {get;セットする; } public string state {get {return JsonConvert.SerializeObject(this.desired); } セットする {; }} publicDesireddesired {get;セットする; } public class Desired {public string lat {get;セットする; } [JsonProperty( "long")] public stringlongitude {get;セットする; }}}} 
GasController.cs C#
ガス漏れデータをazureに記録するためのAPI
 using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.WindowsAzure.Storage.Table; using Newtonsoft.Json; //空のプロジェクトでWebAPIを有効にする方法の詳細については、http://go.microsoft.com/fwlink/?LinkID =397860namespace iotwebapp.Controllers {[Route( "api / iot / myhome / kitchen / [Controller] ")] public class GasController:IoTController {[HttpPost] public IActionResult Post([FromBody] IotGas iotGas){//テーブルクライアントを作成します。 CloudTableClient tableClient =storageAccount.CreateCloudTableClient(); //「people」テーブルを表すCloudTableオブジェクトを作成します。 CloudTableテーブル=tableClient.GetTableReference( "iot"); iotGas.PartitionKey ="gas"; iotGas.RowKey =Guid.NewGuid()。ToString(); //顧客エンティティを挿入するTableOperationオブジェクトを作成します。 TableOperation insertOperation =TableOperation.Insert(iotGas); //挿入操作を実行します。 table.Execute(insertOperation); Ok( "紺碧の雲に記録されたガス漏れ情報..");を返します。 }} public class IotGas:TableEntity {public string deviceid {get;セットする; } public string timeutc {get;セットする; } public string signby {get;セットする; } public string state {get {return JsonConvert.SerializeObject(this.desired); } セットする {; }} publicDesireddesired {get;セットする; } public class Desired {public string Leak {get;セットする; }}}} 
DistanceController.cs C#
超音波距離センサーデータをazureに記録するためのAPI
 using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.WindowsAzure.Storage.Table; using Newtonsoft.Json; //空のプロジェクトでWebAPIを有効にする方法の詳細については、http://go.microsoft.com/fwlink/?LinkID =397860namespace iotwebapp.Controllers {[Route( "api / iot / myhome / livingroom / [Controller] ")] public class DistanceController:IoTController {[HttpPost] public IActionResult Post([FromBody] IotDistance iotDistance){//テーブルクライアントを作成します。 CloudTableClient tableClient =storageAccount.CreateCloudTableClient(); //「people」テーブルを表すCloudTableオブジェクトを作成します。 CloudTableテーブル=tableClient.GetTableReference( "iot"); iotDistance.PartitionKey ="distance"; iotDistance.RowKey =Guid.NewGuid()。ToString(); //顧客エンティティを挿入するTableOperationオブジェクトを作成します。 TableOperation insertOperation =TableOperation.Insert(iotDistance); //挿入操作を実行します。 table.Execute(insertOperation); Ok( "紺碧の雲に記録された障害物データ..");を返します。 }} public class IotDistance:TableEntity {public string deviceid {get;セットする; } public string timeutc {get;セットする; } public string signby {get;セットする; } public string state {get {return JsonConvert.SerializeObject(this.desired); } セットする {; }} publicDesireddesired {get;セットする; } public class Desired {パブリック文字列障害物{get;セットする; }}}} 
BedRoomController.cs C#
すべてのベッドルームセンサーデータをazureに記録するためのAPI
 using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.WindowsAzure.Storage.Table; using Newtonsoft.Json; //空のプロジェクトでWebAPIを有効にする方法の詳細については、http://go.microsoft.com/fwlink/?LinkID =397860namespace iotwebapp.Controllers {[Route( "api / iot / myhome / room / [controller] ")] public class BedRoomController:IoTController {[HttpPost] public IActionResult Post([FromBody] IotBedRoom iotBedRoom){//テーブルクライアントを作成します。 CloudTableClient tableClient =storageAccount.CreateCloudTableClient(); //「people」テーブルを表すCloudTableオブジェクトを作成します。 CloudTableテーブル=tableClient.GetTableReference( "iot"); iotBedRoom.PartitionKey ="寝室"; iotBedRoom.RowKey =Guid.NewGuid()。ToString(); //顧客エンティティを挿入するTableOperationオブジェクトを作成します。 TableOperation insertOperation =TableOperation.Insert(iotBedRoom); //挿入操作を実行します。 table.Execute(insertOperation); return Ok( "紺碧の雲に記録された寝室の属性.."); }} public class IotBedRoom:TableEntity {public string deviceid {get;セットする; } public string timeutc {get;セットする; } public string signby {get;セットする; } public string state {get {return JsonConvert.SerializeObject(this.desired); } セットする {; }} publicDesireddesired {get;セットする; } public class Desired {public string window {get;セットする; } public string door {get;セットする; } public string ac {get;セットする; } public stringtemperature {get;セットする; }パブリック文字列湿度{取得;セットする; }}}} 
MediaTekスマートホーム-データロギングのソースコード
nodejsapp、aspnet5、mediatekレシーバーinohttps://github.com/syediddi/iot-mediatek-linkIt
のソースコード

回路図

arduinoから無線信号を送信する シールドなしでarduinoからXbee経由で無線信号を送信する arduinoから無線信号を送信する

製造プロセス

  1. スマートデータ:IoTの次のフロンティア
  2. SensorflareとRaspberryPiを備えた433MHzスマートホームコントローラー
  3. RASPBERRY PI HOME AUTOMATION
  4. スマートバーテンダー
  5. 明日のスマート病院には、よりスマートなソフトウェアが必要です
  6. スマートホームスキルのギャップ
  7. 職場での相互接続の利点
  8. スマートに:あなたの家の未来
  9. スマートファクトリーパイプの夢
  10. スマートホーム接続:主要な障害を克服するための3つのステップ
  11. 現代の生活のためのスマートホームのアップグレード