This repository was archived by the owner on Jan 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslide.htm
More file actions
304 lines (270 loc) · 9.93 KB
/
slide.htm
File metadata and controls
304 lines (270 loc) · 9.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>실전 ARTIK Cloud 활용 !</title>
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
h1, h2, h3 {
font-weight: 400;
margin-bottom: 0;
}
.remark-slide-content h1 { font-size: 3em; }
.remark-slide-content h2 { font-size: 2em; }
.remark-slide-content h3 { font-size: 1.6em; }
.footnote {
position: absolute;
bottom: 3em;
}
li p { line-height: 1.25em; }
.red { color: #fa0000; }
.large { font-size: 2em; }
a, a > code {
color: rgb(249, 38, 114);
text-decoration: none;
}
code {
background: none repeat scroll 0 0 #F8F8FF;
border: 1px solid #DEDEDE;
border-radius: 3px ;
padding: 0 0.2em;
}
.remark-code, .remark-inline-code { font-family: "Bitstream Vera Sans Mono", "Courier", monospace; }
.remark-code-line-highlighted { background-color: #373832; }
.pull-left {
float: left;
width: 47%;
}
.pull-right {
float: right;
width: 47%;
}
.pull-right ~ p {
clear: both;
}
#slideshow .slide .content code {
font-size: 0.8em;
}
#slideshow .slide .content pre code {
font-size: 0.9em;
padding: 15px;
}
.main-title, .title {
background: #272822;
color: #777872;
text-shadow: 0 0 20px #333;
}
.title h1, .title h2, .main-title h1, .main-title h2 {
color: #f3f3f3;
line-height: 0.8em;
}
/* Custom */
.remark-code {
display: block;
padding: 0.5em;
}
img[alt=piedpiper] { height: 100px; float:right !important;}
img[alt=Dash] { height: 150px; }
img[alt=Hue] { height: 150px; }
img[alt=ARTIK7] { width: 100%; }
</style>
</head>
<body>
<textarea id="source">
# 실전 ARTIK Cloud 활용 !
IoT 제품 & 서비스 만들기
---
## 소개
* Tuner 과제 사진 or 동영상
* 엑싯 실패 원인 공유
* 핵심 부품을 구할 수 없어 나가서 만들 수 없었다.
* 수많은 부품들에 대한 자재 관리도 감당이 안됨
* 인력 부족 - 앱 만들기도 바쁜데 커널/BSP까지 신경써야 한다.
* 하드웨어 기반 스타트업이 쉽지 않은 이유
---
## ARTIK
제품을 개발하는데 아틱&아틱클라우드를 사용 하면 어떤 이득이?
### 보드
* 현실적으로 스핀오프 후 부품수급/자재 관리 어려움. 아틱은 모듈에 다 들어있음.
* 프로토타입 개발 시간 절약 (커널/BSP 제공, API/SDK 제공)
### 클라우드
* 메시지(1K미만) 저장소로 바로 사용 가능 (서버 구축 비용/시간 절약)
* 외부 서비스와 연결/연동 가능 (IFTTT, Alexa, ...)
* 다양한 프로토콜 지원 (REST, WebSockets, MQTT, CoAP)
* 별도 서비스 구축해서 ARTIK Cloud와 연동 가능 (OAuth2 지원)
> 빈번히 바뀌는 아이디어에 대한 프로토타이핑을 빠르게 !
> 하드웨어기반 스타트업의 스핀오프 후 제품 상용화에 현실적인 대안
---
## 무엇을 만드려고 하십니까?
* 하드웨어 / 순수 소프트웨어
* 스핀오프를 원하는 비율
* IoT 연계 가능성
---
## 실습 목표

GEEK-RED-LED-Light.com 만들어 보기
* IoT Button - Amazon Dash
* IoT LED Light (Red color) - Philips Hue


---
## ARTIK 710 Board 설명

[Board Reference](https://developer.artik.io/documentation/artik/getting-started/in-the-box.html#board-reference)
---
## ARTIK 710 Board 설명

[Board Reference](https://developer.artik.io/documentation/artik/getting-started/in-the-box.html#board-reference)
---
## 실습 환경 설정
* ARTIK 710 보드 WiFi 설정(wpa_supplicant)
* [WiFi Guide](https://developer.artik.io/documentation/developer-guide/ethernet-wifi/wifi.html#select-an-access-point)
* Serial Terminal (PuTTY / TeraTerm)
* [Serial Setup Guide](https://developer.artik.io/documentation/artik/getting-started/communicating-pc.html#communicating-with-artik-windows)
* Board Test: GPIO(Button, LED)
* [Blink an LED](https://developer.artik.io/documentation/artik/tutorials/blink-an-led.html#artik-530-and-710-boards)
* [Reading a button](https://developer.artik.io/documentation/artik/tutorials/read-a-button.html#artik-530710-board)
* 샘플 코드 받기
```bash
dnf install git npm
git clone https://github.com/webispy/akc101.git
cd akc101/board
npm install
```
---
## 1부
* ARTIK Cloud 사이트 기본 활용법
* Device type 생성
* 데이터 주고 받기
* 룰 활용하기
---
## Getting started
### 기본
* 회원 가입 (구글 계정으로 로그인)
* https://my.artik.cloud/
* 사용자 - 디바이스 / 룰 / 차트 / 데이터 로그 보기
* https://my.artik.cloud/devices
* Device info: Device ID(DID), Device Type ID(DTID), Device TOKEN
* https://my.artik.cloud/rules
* https://my.artik.cloud/messages
* 개발자 - 디바이스 타입 / 애플리케이션 등록
* https://developer.artik.cloud/dashboard/devicetypes
* https://developer.artik.cloud/dashboard/applications
---
### Device 정의
* 목표
* 원격으로 제어되는 LED Light (ARTIK 710 보드 내장 LED400)
* 만능 버튼 (ARTIK 710 보드 내장 SW403)
* Device Type 등록
* Manifest for 'GEEK Light'
* fields: state (string: 'on', 'off')
* actions: setOn, setOff
* Manifest for 'GEEK Button'
* fields: state (string: 'pressed', 'released')
* actions: none
* Device 생성하기
* Token 생성하기
---
### 클라우드에 Message 보내기
만능 버튼 누르면 ARTIK Cloud에 메시지 보내기
* [ARTIK Cloud API reference](https://developer.artik.cloud/documentation/api-reference/rest-api.html#post-a-message-or-action)
* JSON (JavaScript Object Notation)
* curl로 보내기 테스트 (GEEK Button)
```bash
curl -X POST -H "Content-Type:application/json" \
-H "Authorization:Bearer 8b38d4d3326b4a74803909f560b150d8" \
"https://api.artik.cloud/v1.1/messages" \
-d '{ "sdid": "842f9c4bafc84c8f9bd79f95684aa23f", "type": "message", "data": "{ \"state\": \"pressed\"}" }'
```
* GPIO 처리
* [ARTIK 710 Headers document]( https://developer.artik.io/documentation/developer-guide/gpio/gpio-mapping.html#artik-710-headers)
* SW404 == sysfs 30
* Node.js로 구현하기 (GPIO + HTTP Request)
```bash
cd akc101/board/button
node button.js
```
---
### 룰 작성해보기
* 만능 버튼 눌렀다 떼면(state == 'released') Email 보내기
```
IF any GEEK Button state is released
THEN Send Email with to = webispy@gmail.com,
subject = Hey !, body = Button pressed
```
---
### Action 받아보기
GEEK Light에 Action을 보내면 불 켜기/끄기
* curl로 최근 Action 가져오기 (24시간 사이의 최신 메시지)
```bash
curl -X GET -H "Content-Type:application/json" \
-H "Authorization:Bearer bf946bc4366d4ef98ed18d089673cbe5" \
"https://api.artik.cloud/v1.1/actions?count=1&endDate=$(($(date +"%s")*1000))&startDate=$(($(date +"%s")*1000-24*3600*1000))&order=desc&ddid=b809f9e73ebb4a5ab022233253398199"
```
* 실시간으로 Action 받기 (Websockets)
```bash
cd akc101/board/light
node test_recv.js
```
* GPIO 처리
* LED400(Red) == sysfs 28
* Node.js로 구현하기 ('on' / 'off' 인자 받아서 불 켜고/끄고 상태를 ARTIK Cloud로 보내기)
```bash
cd akc101/board/light
node light.js
```
---
### 룰 업데이트 하기
* 만능 버튼 눌렀다 떼고(state == 'released') Light의 state가 off 이면, Light에 setOn Action 보내기
* 만능 버튼 눌렀다 떼고(state == 'released') Light의 state가 on 이면, Light에 setOff Action 보내기
---
## 2부
* 디바이스 공유
* 외부 서비스와 연동
* 직접 구축한 서비스와 연동
---
### 디바이스 공유해보기
* 컨셉: 가족끼리 디바이스 공유, 사무실 공용기기를 직원들간에 공유
* 옆 사람의 GEEK Light를 공유해보기
* Device type: Private -> Public 으로 변경
* Devices에서 GEEK Light 아래에 있는 Share Device 선택하고 옆 사람 Email로 초청 보내기
* 초청 메일 받으면 수락
* 버튼을 눌러서 옆 사람의 Light를 제어해보기
* 룰 변경하기 (GEEK Light를 공유받은 GEEK Light로 변경)
---
### 외부 서비스와 연동해보기 (IFTTT, LINE Messenger)
* 불이 켜지면 IFTTT로 다른 동작 수행시키기
* IFTTT My Applets에 등록: if light is on, then send a notification
* GEEK Light 디바이스에 state='on' 메시지가 오면, notification을 보냄
* 보드의 불이 켜지면 내 라인 메신저로 이벤트 받기 (Sample-Code/03)
* LINE Notify OAuth2 (https://notify-bot.line.me/)
* Cloud Connector 제작
* OAuth2 Configuration: Client ID/Secret, ARTIK Cloud Callback URL
* Groovy code
* [MyCloudConnector.groovy](https://github.com/webispy/artikcloud-cloudconnector-sdk/blob/master/linenotify/src/main/groovy/cloudconnector/MyCloudConnector.groovy)
* LINE Notify Device 추가하기, AUTHORIZE 하기
* 룰 연동하여 LINE 메신저로 불 상태 이벤트 받기
---
### 직접 구축한 서비스/웹사이트에서 사용자의 아틱 클라우드 디바이스/데이터 연동하기 (Sample-Code/04)
* mystartup.com 사이트에서 아틱 클라우드의 데이터 연동하기
* https://webispy-startup.herokuapp.com/
* 회원가입, ARTIK Cloud OAuth2 인증, User token
* mystartup.com에 가입된 전체 사용자들의 디바이스 목록 보여주기 (관리자 모드 시뮬레이션)
* Heroku에 Deploy해서 실제로 동작 확인하기
* Node.js, Passport
---
### 기타 사용/구현 가능한 시나리오들 설명 (시연은 하지 않음)
* 예) 아마존 에코에 음성 명령을 내리면 보드의 불이 On/Off
* 예) 버튼 누르면 Hue on/off
---
## Q&A
</textarea>
<script src="https://gnab.github.io/remark/downloads/remark-latest.min.js"></script>
<script>
var slideshow = remark.create();
</script>
<script></script>
</body>
</html>