Hướng phát triển

Một phần của tài liệu Nghiên cứu và thiết kế anten cho hệ thống truyền phát thông tin đo nhịp tim (ECG) (Trang 68 - 75)

Truyền thông M2M là nền tảng của các hệ thống IoT hay EoT sau này vì vậy việc nghiên cứu chuyên sâu vào mỗi lớp trong kiến trúng tham chiêu của M2M là rất quan trọng. Đặc biệt trong đó phải kể đến việc định tuyến ở lớp M2M network, các giao thức truyền thông trên lớp ứng dụng. Từ các giao thức sẵn có như http, CoAP hay MQTT tìm hiểu so sánh và đưa ra một giao thức mới ưu việt hơn các giao thức đã có.

69

TÀI LIỆU THAM KHẢO

[1] D. Boswarthik, O. Elloumi, and O. Hersent, M2M Communications: A Systems Approach. UK: John Wiley & Sons Ltd, 2012.

[2] http://www.korewireless.com.au/blog/whats-the-difference-between-m2m-and-

iot. Ngày truy cập cuối cùng 25/08/2016.

[3] Machine to machine communications, Architecture, Performance and Applications . Edited by Carles Anto ´ n-Haro and Mischa Dohler.

[4]https://www3.ntu.edu.sg/home/ehchua/programming/webprogramming/HTTP_ Basics.html Ngày truy cập cuối cùng 25/08/2016.

[5] https://voer.edu.vn/m/cau-truc-cua-http-message/9e05dbef. Ngày truy cập cuối

cùng 25/08/2016.

[6]https://voer.edu.vn/m/qua-trinh-dong-goi-du-lieu-va-thao-goi-du-lieu/c29149fa Ngày truy cập cuối cùng 24/08/2016.

[7] https://indigo.com ngày truy cập cuối cùng 23/08/2016.

[8] http://stephendnicholas.com/archives/1217. Ngày truy cập cuối cùng 25/08/2016.

[9] http://www.slideshare.net/carlosralli/curso-coap-v3slideshare?related=2. Ngày truy cập cuối cùng 25/08/2016.

[10] ETSI. Machine to Machine Communications (M2M): Use Cases of M2M Applications for eHealth. Draft TR 102732 v0.4.1, 2011.

[11] http://wso2.com.

[12 ] OECD Report. Machine-to-machine communications: connecting billions of devices. OECD Digital Economy Papers 192, (2012).

[13] Machina Research. Machine-to-Machine (M2M) Communications in Healthcare 2010–20. 2011.

[14] ETSI. Machine to Machine Communications (M2M): Functional Architecture. Technical Specification TS 102690 v1.1.1, 2011.

[15] Standardized Machine-to-Machine and Internet of Things Service Delivery Platform, White Paper. 2013.

[16] IEEE. Performance Analysis of cognitive Machine- to- Machine Communications, Dusit Niyato, 2012.

[17] Chen, J. Wan, and F. Li, “Machine-to-machine communications: Architectures, standards and applications,” TIIS, vol. 6, no. 2, pp. 480– 497, 2012.

70 [18] Boswarthick, O. Elloumi, and O. Hersent, M2M Communications: A Systems Approach, 1st ed. Wiley Publishing, 2012.

[19] ETSI TS 102 690 M2M functional architecture,

http://www.etsi.org/deliver/etsi-ts/102600-102699/102690/01.01.01-60/ts- 102690v010101p.pdf.

[20] G Wu, S. Talwar, K. Johnsson, H. Nageen, and K. Johnson, “M2M : From Mobile to Embedded Internet,” IEEE Commun. Mag., vol. 49, no. 4, pp. 36–43, 2011.

[21] International Business Machines Corporation (IBM), “MQTT V3.1 Protocol Specification,” 2010.

[22] ETSI TS 102 689 V1.1.2, “Machine-to-Machine communications (M2M); M2M service requirements,” 2011.

[23] ETSI TS 102 921 v1.1.1, “Machine-to-Machine communications (M2M); mIa, dIa and mId interfaces,” 2012.

[24] Z. Shelby, K. Hartke, and C. Bormann, “RFC 7252: The Constrained Application Protocol (CoAP).” 2014.

71

Phụ lục

- Codemain.ino

/**

* Project: Ung dung truyen thông M2M trong thu thap do luong tin hieu tu cam bien

* Created by: Nguyen Van Cuong

* Introduction: Day la ung dung thu thap du lieu tu cam bien (nhiet do, do am, anh sang, phat hien chuyen dong) voi viec lap trinh dua tren nen tang phan cung Arduino, giao tiep va theo doi dua tren nen tang M2M platform la Thingspeak

*/

#include <OneWire.h>

#ifdef SPARK // Cầnsửdụngkhikhaibáothưviện con #include "ThingSpeak/ThingSpeak.h" #else #include "ThingSpeak.h" #endif #ifdef ARDUINO_ARCH_AVR // Cầnsửdụngkhikhaibáothưviện con #ifdef ARDUINO_AVR_YUN #include "YunClient.h" YunClient client; #else

// Use wired ethernet shield #include <SPI.h>

#include <Ethernet.h>

72 // Địachỉ MAC ở mặtdưới Arduino. Nếu Arduino đờicũsẽkocó, cóthể

random 1 địachỉ Mac bấtkỳ EthernetClient client;

#endif

// On Arduino: 0 - 1023 maps to 0 - 5 volts #define VOLTAGE_MAX 5.0

#define VOLTAGE_MAXCOUNTS 1023.0 #endif

#ifdef SPARK TCPClient client;

// On Particle: 0 - 4095 maps to 0 - 3.3 volts #define VOLTAGE_MAX 3.3

#define VOLTAGE_MAXCOUNTS 4095.0 #endif

unsigned long myChannelNumber = 115287; // ĐâylàChalnelNumberđượccấpkhitọatàikhoảnThingspeak

const char * myWriteAPIKey = "KB9OOAAH96XSK8GH"; // Key cósẵntrongtàikhoảnThingspeak

bytepinLed = 4;

bytepinTemp = 3; // Cam biennhiet do bytepinHum = A1; // Cam bien do am bytepinBright = A0; // Cam bienanh sang bytepinMotion = 2; // Cam bienchuyen dong byte power5v = 11;

bytecontrolRelay = 12; intmotionDetection = 0; byte count = 0;

73 floataverageHum = 0;

floataverageBright = 0;

OneWireds(pinTemp); // Cảmbiếnánh sang DS18B20 cầnsửdụngthưviệnOneWire void setup() { Ethernet.begin(mac); // Càiđặtenthernet ThingSpeak.begin(client); pinMode(pinLed, OUTPUT); pinMode(pinTemp, INPUT); pinMode(pinHum, INPUT); pinMode(pinBright, INPUT); pinMode(pinMotion, INPUT);

pinMode(power5v, OUTPUT); // Coichan 13 la chan 5v pinMode(controlRelay, OUTPUT); digitalWrite(power5v, HIGH); digitalWrite(pinLed, LOW); digitalWrite(controlRelay, LOW); Serial.begin(9600); } void loop() {

float temp = getTemp(); // Hàmtínhnhiệtđộ, do datasheepcủa DS18B20 cungcấp

floatreadHum = analogRead(pinHum); floatreadBright = analogRead(pinBright); intreadMotion = digitalRead(pinMotion);

float hum = 2475 - readHum*2.4; // Đâylàđộẩmđất, khôngtínhtheo %

float brightness = (1023 - readBright)/1023*100; if (temp > 32) {

74 digitalWrite(pinLed, HIGH); // Khinhiệtđộcaohơn 32

thìđènsángđểthôngbáo

digitalWrite(controlRelay, HIGH); Serial.println("Relay turn on."); }

else {

digitalWrite(pinLed, LOW); digitalWrite(controlRelay, LOW); Serial.println("Relay turn off."); } Serial.print("Temp: "); Serial.println(temp); Serial.print("Hum: "); Serial.println(hum); Serial.print("Bright: "); Serial.println(brightness); Serial.print("Motion: "); Serial.println(readMotion); Serial.println(); count++;

averageTemp += temp; averageHum += hum; averageBright += brightness; if (readMotion>motionDetection)

motionDetection = readMotion;

if (count >= 15) { // ThingSpeak will only accept updates every 15 seconds.

averageTemp /= 16; averageHum /= 16; averageBright /= 16; // Lấygiátrịtrungbìnhcủa 16 lầnđonhiệtđộ, độẩm, ánhsáng ThingSpeak.setField(1, averageTemp); ThingSpeak.setField(2, averageHum); ThingSpeak.setField(3, averageBright); ThingSpeak.setField(4, motionDetection); ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey); count = 0; motionDetection = 0; } delay(1000); }

75 floatgetTemp()

{

//returns the temperature from one DS18S20 in DEG Celsius byte data[12];

byteaddr[8];

if ( !ds.search(addr)) {

//no more sensors on chain, reset search ds.reset_search();

return -1000; }

if ( OneWire::crc8( addr, 7) != addr[7]) { Serial.println("CRC is not valid!");

return -1000; }

if ( addr[0] != 0x10 &&addr[0] != 0x28) { Serial.print("Device is not recognized"); return -1000;

}

ds.reset(); ds.select(addr);

ds.write(0x44,1); // start conversion, with parasite power on at the end byte present = ds.reset();

ds.select(addr);

ds.write(0xBE); // Read Scratchpad

for (inti = 0; i< 9; i++) { // we need 9 bytes data[i] = ds.read();

}

ds.reset_search(); byte MSB = data[1]; byte LSB = data[0];

floattempRead = ((MSB << 8) | LSB); //using two's compliment floatTemperatureSum = tempRead / 16;

Một phần của tài liệu Nghiên cứu và thiết kế anten cho hệ thống truyền phát thông tin đo nhịp tim (ECG) (Trang 68 - 75)

Tải bản đầy đủ (PDF)

(75 trang)