Arduino Wifi Shield - Laboratory of Intelligent Networks

Download Report

Transcript Arduino Wifi Shield - Laboratory of Intelligent Networks

Ubiquitous Computing Practice (Wi-Fi)

Youn-Hee Han, Chan-Myung Kim {yhhan, cmdr}@koreatech.ac.kr

Laboratory of Intelligent Networks Advanced Technology Research Center Korea University of Technology http://link.koreatech.ac.kr

Introduction

Arduino – Wifi Shield (Recommended)

2 / 16

Introduction

Sparkfun Wifly Shield Arduino Wifi Shield (Recommended)

3 / 16

Arduino WiFi Shield

http://arduino.cc/en/Main/ArduinoWiFiShield 4 / 16

Wifi      begin() disconnect() SSID() RSSI() …  Server      begin() available() write() println() … Client         connected() connect() print() println() available() read() stop() … http://arduino.cc/en/Reference/WiFi

Wifi Library

5 / 16

.

Post Tweet

http://arduino-tweet.appspot.com/ 6 / 16

if (WiFi.status() == WL_NO_SHIELD) { Serial.println("WiFi shield not present"); while(true); } while ( status != WL_CONNECTED) { Serial.print("Attempting to connect to SSID: "); Serial.println(ssid);

status = WiFi.begin(ssid, key);

delay(5000); }

Setup

7 / 16

Encryption

Open (No Encryption) char ssid[] = "yourNetwork"; int status = WiFi.begin(ssid); WPA char ssid[] = "yourNetwork"; char pw[] = “yourPassword"; int status = WiFi.begin(ssid, pw); WEP char ssid[] = "yourNetwork"; char key[] = "D0D0DEADF00DABBADEAFBEADED"; // ascii code int keyIndex = 0; int status = WiFi.begin(ssid, keyIndex, key); 8 / 16

Post Tweet

.

char[] token = “2E6p1VBvd7oA3S9xPjmHYB7fB4xbEvIf8”; String tweet = “ 트윗 내용 ”; if (twtclient.connect(server_adr, 80)) { Serial.println("connected"); twtclient.println("POST http://arduino tweet.appspot.com/update HTTP/1.0"); twtclient.print("Content-Length: "); twtclient.println(tweet.length()+strlen(token)+14); twtclient.println(); twtclient.print("token="); twtclient.print(token); twtclient.print("&status="); twtclient.println(tweet); } 9 / 16

Temperature + humidity

10 / 16

Temperature + humidity

int indata0; int indata1; float RH; float sRH; float temperatureC; indata0 = analogRead(0); sRH = (indata0 / 1024.0) /0.0062 - 0.16 / 0.0062; temperatureC = analogRead(1) * 0.004882814; temperatureC = (temperatureC - 0.5) * 100; RH = sRH / (1.0546 - 0.00216 * temperatureC); 11 / 16

Discomfort Index  1.8 * temperatureC - 0.55 * (1 - RH/100.0) * (1.8 * temperatureC - 26) + 32

Indices

Food Poisoning Index  (1-exp(-exp( 4.4946+0.0701*temperatureC+0.0152*RH)))*185.66+26.14

Deterioration Index  ((RH-65)/14)*pow(1.054, temperatureC) http://www.kma.go.kr/weather/lifenindustry/life_01.jsp?JISU_INFO=life3_03 12 / 16

.

Post Tweet

13 / 16

Thank You

14 / 16