100-02課程簡報-arduino and iot

59
Arduino 入門與物聯網應用 台中教育大學 資訊科學系 李宗翰

Upload: insight-ewpg

Post on 30-Mar-2016

233 views

Category:

Documents


3 download

DESCRIPTION

 

TRANSCRIPT

Page 1: 100-02課程簡報-Arduino and IOT

Arduino 入門與物聯網應用 台中教育大學 資訊科學系 李宗翰

Page 2: 100-02課程簡報-Arduino and IOT

• Arduino介紹 • Arduino實作 • Inetnet of Things 物聯網 • Internet of Things 應用

大綱

Page 3: 100-02課程簡報-Arduino and IOT

• 何謂”Arduino” • Arduino架構

• 軟體 • 硬體 • 社群

Arduino介紹

Page 4: 100-02課程簡報-Arduino and IOT

• 義大利Italy • 設計者

– Massimo Banzi – David Cuartielles – Tom Igoe – Gianluca Martino – David Mellis.

• 2005.10.1第一批 • 快速開發prototype: artists、designers、 hobbyists • OPEN SOURCE • 軟體+硬體+社群

何謂Arduino?

Page 5: 100-02課程簡報-Arduino and IOT

• 開放IDE軟體原始碼,可針對底層做修改。 • 相同軟體平台,透過OPEN,快速累積應用範例。 • 玩家、廠商提供多元函式庫

Arduino架構_軟體_OPEN魅力

Page 6: 100-02課程簡報-Arduino and IOT

Processing.org

Page 7: 100-02課程簡報-Arduino and IOT

Fritzing.org

Page 8: 100-02課程簡報-Arduino and IOT

• 數位I/O腳 • PWM腳 • 類比輸入腳 • 供電系統 • 電源輸出

Arduino架構_硬體

數位 I/O腳位:P0~P13

6組PWM輸出

類比訊號輸入

10Bit解析度

三種電源輸出供應 Vin、5V、3.3V

雙供電系統

Page 9: 100-02課程簡報-Arduino and IOT

• Arduino不生產周邊硬體不綁死周邊裝置價格平實

• 周邊裝置搭配arudino腳位開發 • 硬體電路開放,可自行製作與開發 • 硬體資源說明文件多 • Arduino.cc/playground

Arduino架構_硬體_OPEN魅力

Page 10: 100-02課程簡報-Arduino and IOT

DIY Arduino

Page 11: 100-02課程簡報-Arduino and IOT

Freeduino系列

Ardupilot Boarduino Seeeduino

Relayduino Openlog brasuino Fio

Page 12: 100-02課程簡報-Arduino and IOT

擴充Shield

MP3播放板 SD卡模組 WIFI模組

CAN BUS模組 MIDI 訊號模組 COLOR LCD模組

GPRS模組

RFID模組

AV端子顯示模組

Page 13: 100-02課程簡報-Arduino and IOT

Arduino架構_社群

Page 14: 100-02課程簡報-Arduino and IOT

官方提供Blog資料: 近200處 http://www.arduino.cc/playground/Main/People

玩家

Page 15: 100-02課程簡報-Arduino and IOT

• 超過200家周邊製造商與代理商 – RFrobot – Seeed Studio – DIYDrones – Sparkfun – Pololu – Adafruit – Make Magzine – OceanControl – Robotshop – ModernDevice – – –

周邊廠商

Page 16: 100-02課程簡報-Arduino and IOT

• Bootloader預先載入的程式 • 流程:

1. 編寫Arduino Code 2. PC端 Arduino IDE 3. USB(RX、TX) 4. Arduino IO板 5. Bootloader程式轉換機器碼 6. Arduino Work

• 高階C語言函式化的指令 • 類似裝置:Basic Stamp

Arduino架構_軟體

Page 17: 100-02課程簡報-Arduino and IOT

2012/8/28

Arduino開發環境 • 軟體下載: http://arduino.cc/en/Main/Software

Page 18: 100-02課程簡報-Arduino and IOT

2012/8/28

Arduino開發環境

編譯

載入

終端機顯示

停止

開新檔案

開啟檔案

儲存檔案

Page 19: 100-02課程簡報-Arduino and IOT

2012/8/28

Arduino開發環境

Page 20: 100-02課程簡報-Arduino and IOT

2012/8/28

Arduino開發環境

Page 21: 100-02課程簡報-Arduino and IOT

void setup () { //... setup pins } void loop () { //... main loop }

Coding in Arduino

Page 22: 100-02課程簡報-Arduino and IOT

2012/8/28

Arduino開發環境

Page 23: 100-02課程簡報-Arduino and IOT

2012/8/28

Arduino開發環境

Page 24: 100-02課程簡報-Arduino and IOT

2012/8/28

Arduino使用語法

Page 25: 100-02課程簡報-Arduino and IOT

2012/8/28

Arduino使用語法

Page 26: 100-02課程簡報-Arduino and IOT

2012/8/28

Arduino使用語法

Page 27: 100-02課程簡報-Arduino and IOT

2012/8/28

Arduino使用語法

Page 28: 100-02課程簡報-Arduino and IOT

2012/8/28

實作_ Arduino實作練習

Page 29: 100-02課程簡報-Arduino and IOT

2012/8/28

實作_ Arduino實作練習

Page 30: 100-02課程簡報-Arduino and IOT

2012/8/28

Arduino實作練習

• 練習一:

載入Basics範例的Blink

Page 31: 100-02課程簡報-Arduino and IOT

2012/8/28

Blink

•LED腳位: 長腳+

Page 32: 100-02課程簡報-Arduino and IOT

2012/8/28

Arduino實作練習

• 練習二:

載入Digital範例的Blinkwithoutdelay

Page 33: 100-02課程簡報-Arduino and IOT

2012/8/28

BlinkwithoutDelay

•LED腳位: 長腳+

Page 34: 100-02課程簡報-Arduino and IOT

2012/8/28

Arduino實作練習

• 練習三:

載入 Basic 範例的 DigitalReadSerial

Page 35: 100-02課程簡報-Arduino and IOT

2012/8/28

Digital Read Serial (UART to USB)

Page 36: 100-02課程簡報-Arduino and IOT

2012/8/28

Arduino實作練習

• 練習四:

載入 Analog 範例的 AnalogInput

Page 37: 100-02課程簡報-Arduino and IOT

電阻 電壓 2012/8/28

Analog INPUT

1 2 3

電阻成指數遞增,代號A 電阻成線性遞增,代號B

10bit解析度

Page 38: 100-02課程簡報-Arduino and IOT

2012/8/28

Arduino實作練習

• 練習五:

載入 Analog 範例的 Fading

Page 39: 100-02課程簡報-Arduino and IOT

2012/8/28

PWM 脈波寬度調整Pulse Width Modulation

週期

LOW

HIGH

方波寬度

方波高度

0V

5V

Page 40: 100-02課程簡報-Arduino and IOT

PWM

•模擬類比電壓輸出 •腳位3.5.6.9.10.11 •PWM頻率

•980Hz : 5,6 •490Hz :3, 9, 10, 11

•PWM Duty Cycle

Page 42: 100-02課程簡報-Arduino and IOT

2012/8/28

Arduino實作練習

• 練習六:

載入 wire 範例的 Master Writer/Slave Receiver

Page 43: 100-02課程簡報-Arduino and IOT

I2C 傳輸實驗

• Master Writer/Slave Receiver • 本範例將利用I2C連結二組Arduino,並同步傳送與接收數

位資料 • Master

– 每0.5秒,傳送 6 bytes 資料至Slave. • Slave

– 當接收到Master所傳來之資料後,將會顯示在Arduino's serial window.

Page 44: 100-02課程簡報-Arduino and IOT

以 I2C 連接兩組 Arduino

• 連接兩組Arduino之pin 4 (the clock, or SCL, pin) 與 pin 5 (the data, or SDA, pin).

• 確認兩組 Arduino 採用共用接地方式連接. • Slave Arduino 須以USB連接PC並開啟 Arduino Serial Window觀察其

接收資料的狀況.

Page 45: 100-02課程簡報-Arduino and IOT

• 概念 • 應用

Internet of Things 物聯網

Page 46: 100-02課程簡報-Arduino and IOT

物聯網概念 • 物聯網(The Internet of things)的定義是:通過射頻識別(RFID)、紅外感應器、全球定位系統、鐳射掃描器等資訊傳感設備,按約定的協定,把任何物品與互聯網連 接起來,進行資訊交換和通訊,以實現智慧化識別、定位、跟蹤、監控和管理的一種網路。

• 物聯網就是“物物相連的互聯 網”。 這有兩層意思:

– 第一,物聯網的核心和基礎仍然是互聯網,是在互聯網基礎上的延伸和擴展的網路;

– 第二,其用戶端延伸和擴展到了任何物品與物品之間,進行資訊交換和通訊。

Page 47: 100-02課程簡報-Arduino and IOT

物聯網發展 • 物聯網(The Internet of things)的概念是在1999年提出:Foundation

of Auto-ID center of MIT (RFID technology) • 2003 SUN article: Toward a Global “Internet of Things” (Via) • 2005年11月17日:在突尼斯舉行的資訊社會世界峰會(WSIS)上,

國際電信聯盟(ITU)發佈《ITU互聯網報告2005:物聯網》 • 2009年1月23日:IBM Smart Planet,奧巴馬針對IBM首席執行官

彭明盛首次提出“智慧的地球”這一概念,做出回應:物聯網技術美國在21世紀保持和奪回競爭優勢的方式

• 2009年9月:Internet of Things – An action plan for Europe 歐盟行動計畫

• 物聯網(Internet of Things, IoT)的興起與快速發展,依據美國Forrester預測至2020年全球物物互聯的服務量,跟人與人通信的服務量相比,將達到 30比 1,被稱為是下一個十兆元級的資通訊創新應用。

Page 48: 100-02課程簡報-Arduino and IOT

物聯網的新思維 • 物聯網打破了傳統思維。物理基礎設施和IT基礎設施 • 物聯網時代:鋼筋混凝土、電纜將與晶片、寬頻整合為統一的基

礎設施。 • 物聯網的世界裡每個物件具備識別ID、感知與理解能力、控制與

管理功能,並透過網路彼此連結,經由智慧的感知、可靠的傳遞與智慧的處理,賦予物件智慧,實現「人與人」、「人與物」、「物與物」間的溝通和對話功能。依功能面區分,物聯網基本架構可分為: – 「感知/設備層」 – 「網路層」 – 「中介/平台層」 – 「服務層」 – 「消費層」

Page 49: 100-02課程簡報-Arduino and IOT

物聯網概念

Page 50: 100-02課程簡報-Arduino and IOT

• 由許多可擷取及量測資訊之感知元件/設備所組成 – 具感知與理解能力可以監測所在位置的物理或環境狀況(例

如:溫度、濕度、照度、速度等); – 控制與管理功能可以接受遠端設定、操作。

• 為了連結廣泛分布的「感知/設備層」元件,低耗電、低成本、支援大量網路節點的無線感測網路(Wireless sensor network)通訊技術被引用,這當中技術包括: – ZigBee、Z-Wave、6LowPAN (IPv6 over Low power Wireless

Personal Area Networks)等。 – WSN Gateway從分散的WSN測量節點匯總數據並扮演通信

協定轉換的角色,串聯「感知/設備層」與「網路層」。

感知/設備層

Page 51: 100-02課程簡報-Arduino and IOT

•包含有線與無線網路技術,提供可靠的IP(v4/v6)網路傳送技術將感知元件蒐集的資訊整合、匯流到物聯網資料中心。

•對物聯網服務「網路層」必須具備支援服務品質QoS的擁塞與負載控制與支援設備移動性管理等機制,提供一個安全、穩定的網路環境。

網路層

Page 52: 100-02課程簡報-Arduino and IOT

• 為發展物聯網服務的核心 • 過去的服務多為在某一特定領域的專門、封閉式垂直服務,資訊無法有效共用,面對物聯網大量資訊處理與不同服務協同運作之需求,建構一個開放式水平服務平台為未來發展趨勢

• 主要任務為收集來自各感知設備的數據資料,並進行業務邏輯分類與分析判斷,以服務導向架構(SOA) 在開放式水平服務平台上建構各個垂直服務。

中介/平台層

Page 53: 100-02課程簡報-Arduino and IOT

• 即智慧聯網的各種應用領域 • ETSI M2M 強調的應用服務包括:Smart Metering,

eHealth, Connected Consumer, Automotive, City Automation等。

服務層

Page 54: 100-02課程簡報-Arduino and IOT

• 使用者可以各式資訊終端在任何時間、任何地點取得各項服務。

消費層

Page 55: 100-02課程簡報-Arduino and IOT

物聯網應用_nabaztag

Page 56: 100-02課程簡報-Arduino and IOT

物聯網應用 mir:ror

Page 57: 100-02課程簡報-Arduino and IOT

物聯網應用 Sports tracker

Page 58: 100-02課程簡報-Arduino and IOT

Arduino物聯網應用_Pachube

Page 59: 100-02課程簡報-Arduino and IOT

……………………………………The End