Slide 1

Slide 1 text

LoRa Technology and Implementation - Building a LoRa Nano Gateway 台灣樹莓派 Mar 06, 2017/Raspberry Pi #18

Slide 2

Slide 2 text

姓名標示 — 非商業性 — 相同方式分享 CC (Creative Commons) 姓名標示 — 你必須給予 適當表彰、提供指向本授權 條款的連結,以及 指出(本作品的原始版本)是否已 被變更。你可以任何合理方式為前述表彰,但不得以 任何方式暗示授權人為你或你的使用方式背書。 非商業性 — 你不得將本素材進行商業目的之使 用。 相同方式分享 — 若你重混、轉換本素材,或依本 素材建立新素材,你必須依本素材的授權條款來 散布你的貢獻物。

Slide 3

Slide 3 text

3 ● Raspberry Pi 官方經銷商 ● 專注 Raspberry Pi 應用與推廣 , 舉辦社群活動 關於我們

Slide 4

Slide 4 text

4 ● COSCUP,MakerConf,PyCon,HKOSCon 講者 ● 投影片 ● https://speakerdeck.com/piepie_tw ● 程式碼 ● https://github.com/piepie-tw 分享 x 教學

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

6 http://en.wikipedia.org/wiki/Internet_of_Things

Slide 7

Slide 7 text

物聯網技術重點之一在”無線傳輸”

Slide 8

Slide 8 text

速度與距離的考量 https://www.slideshare.net/PeterREgli/lpwan 數公里以上 數百公尺到一公里 數十公尺 >10Mbps 100Kbps ~ 10Mbps <10Kbps

Slide 9

Slide 9 text

不同無線傳輸技術的特點 https://www.slideshare.net/PeterREgli/lpwan

Slide 10

Slide 10 text

● LPWAN(Low Power Wide Area Network) 最近很夯的低功耗廣域網路 http://www.techbang.com/posts/49656

Slide 11

Slide 11 text

從 OSI 模型看 LPWAN https://www.slideshare.net/infiswift/lpwan-for-iot-62591541

Slide 12

Slide 12 text

● LoRa ● LoRaWAN ● LoRa Node ● Gateway ● Network Server 名詞解釋

Slide 13

Slide 13 text

● LoRa 是實體層 (PHY) 的調變技術 ● 採用 CSS 調變技術 ● 常用頻段 :433/470~510/868/915MHz ● 低功耗 , 長距離 , 高靈敏度 , 低資料率 ● 低功耗 :RX<10mA, Sleep<200nA ● 長距離 :500m 到 50Km ● 靈敏度 : 低於 -137 dBm ● 資料率 :0.3kbps 到 50kbps LoRa(Long Range)

Slide 14

Slide 14 text

● 定義網路系統架構與通訊協定 ● 終端點採 LoRa 做長距離通訊 ( 星狀拓樸 ) ● 和終端點的是通訊雙向 ● AES 加密 LoRaWAN http://www.atim.com/en/technologies-2/lorawan/

Slide 15

Slide 15 text

● 定址 :DevEUI, AppEUI ● 使用 ALOHA, 沒有 CSMA 機制 , 三種 class LoRa Node https://www.thethingsnetwork.org/wiki/LoRaWAN/Home

Slide 16

Slide 16 text

● 傳輸協定轉換 (ex:LoRa + WiFi) ● 接收所有頻道的所有資訊 ● 封包直接轉發到後端 (Network Server) Gateway https://en.wikipedia.org/wiki/Gateway_(telecommunications)

Slide 17

Slide 17 text

● 冗餘封包濾除 (CRC) ● 安全性查驗 (Authentication/Authorization) ● 最佳 ACK 路徑 (ACK Routing) ● 適應性資料率 (Adaptive Data Rate, ADR) Network Server http://jensd.be/755/network/lorawan-simply-explained

Slide 18

Slide 18 text

Link Budget 計算 https://www.slideshare.net/PeterREgli/lpwan

Slide 19

Slide 19 text

如何估計 Link Budget ? http://www.semtech.com/wireless-rf/rf-transceivers/sx1272/

Slide 20

Slide 20 text

用 Pi 做 LoRa Nano Gateway

Slide 21

Slide 21 text

● 使用硬體 ● Pi 3 x2 – https://www.raspberrypi.com.tw/10684/55/ ● Pi 3 x1 ● Arduino x1 ● Microchip RN2483 Module x4 – https://www.raspberrypi.com.tw/14724/1420/ Pi 3 Arduino RN2483

Slide 22

Slide 22 text

● 特色 ● 支援 433/868 等頻段 ● 支援 LoRaWAN class A 協定 ● 整合 FSK, GFSK, LoRa 等調變技術 ● UART 傳輸介面 + 類 AT 命令列控制 ● 每次最大傳輸 255bytes Microchip RN2483

Slide 23

Slide 23 text

● sys 設定系統與 GPIO ● radio 設定射頻 ● mac 設定 LoRaWAN 三種指令

Slide 24

Slide 24 text

● radio set freq [868100000] ● radio set bw [250] ● radio set pwr [14] ● radio set sf [sf12] ● radio set wdt [0] ● mac pause ● radio rx 0 ● radio tx [1234] 相關參數 頻率 頻寬 發射功率 Watchdog Timer 設定 Spreading Factor 停用 LoRaWAN 功能 傳送 1234 啟用連續接收模式 http://ww1.microchip.com/downloads/en/DeviceDoc/40001784B.pdf

Slide 25

Slide 25 text

LoRa 封包格式 https://www.semtech.com/images/datasheet/LoraDesignGuide_STD.pdf 非必要 傳送資料 1234

Slide 26

Slide 26 text

● 限制 : ● 只能傳送 0-F 資料 (Hex) ● 每個符號以 ASCII 方式傳送 (1bytes) ● Data 資料 : ● 包含 id 與 content, 以 JSON 格式封裝 Payload 設計 Data CRLF Length SOH 1bytes 3bytes 2bytes char*bytes 0x01 0x0D 0x0A

Slide 27

Slide 27 text

● 接收端 ACK 機制與傳送時間 ● 當接收端收到封包後 , 回傳 ACK(0x06) 與 id ● 回傳時間與封包長度有關 ● 發送端重送機制類似 class A ● 傳送端發送完畢後 , 將等待一段時間等待 ACK ● 如果沒有收到 ACK, 將用 ALOHA 方式重送 ● 最大重送次數 <3 ACK 與重送機制設計

Slide 28

Slide 28 text

架構 Sensor Node Nano Gateway Gateway-02 Gateway-01 Node-01 Node-02

Slide 29

Slide 29 text

Node-01 廣播 Sensor Node Nano Gateway Gateway-02 Gateway-01 Node-01 Node-02

Slide 30

Slide 30 text

Gateway-01 最早收到後回 ACK Sensor Node Nano Gateway Gateway-02 Gateway-01 Node-01 Node-02 ACK

Slide 31

Slide 31 text

Node-02 廣播 Sensor Node Nano Gateway Gateway-02 Gateway-01 Node-01 Node-02

Slide 32

Slide 32 text

Gateway-02 最早收到後回 ACK Sensor Node Nano Gateway Gateway-02 Gateway-01 Node-01 Node-02 ACK

Slide 33

Slide 33 text

LoRa Gateway 限制 https://github.com/maartenweyn/lpwansimulation/

Slide 34

Slide 34 text

DEMO

Slide 35

Slide 35 text

35 Raspberry Pi Rocks the World Thanks