標題: 基於MQTT之Scratch物聯網擴充平台設計
A Scratch Extension Platform for Internet of Things based on MQTT
作者: 廖思幃
蔡錫鈞
Liao, Szu-Wei
Tsai, Shi-Chun
資訊科學與工程研究所
關鍵字: MQTT;Scratch;物聯網;MQTT;Scratch;Internet of Things
公開日期: 2017
摘要: 隨著物聯網的使用越來越普及,許多IoT相關的應用出現在日常生活中,在產業界也產生了很大的商機。為了培養業界所需具備IoT專業能力的人才,各大學開設了許多IoT相關的課程,因此須要建置許多IoT課程所需的設備。為有效運用這些設備並維持其高妥善率,教學資源的維運及共享便形成了一重要的議題。對於初學程式設計或沒有電子電路基礎的使用者,非常容易在操作過程中損壞這些IoT設備,因此造成學習的障礙。為了讓初學者能夠快速理解程式設計的觀念,許多大學藉由導入Scratch做為學習程式語言的入門課程,以期降低學習的門檻。藉由Scratch程式平台可以和IoT裝置互動,之前的做法是透過架設WebSocket server的方式來分享IoT感測器所測得的資訊,以操控Scratch內的角色,但是每位使用者必須架設自己專用的伺服器,來分享感測器的資訊,過程中除了方便性不佳外,也會產生頻繁的操作及資訊傳輸,這將造成一些延遲,及不好的使用體驗。 為了解決上述問題,本研究基於MQTT通訊協定與Scratch程式學習平台,實作出一個Scratch的IoT擴充系統。此系統提供一個互動網站,使用者可以透過網站分享自己的IoT裝置給其他使用者,並且藉由我們的Scratch擴充積木,可以在Scratch平台上取用這些裝置的資訊。IoT裝置的提供者可以直接在系統網站下載註冊裝置所對應的Arduino範例程式碼,只需修改實際接線的PIN腳即可上傳到Arduino使用。我們比較MQTT Broker與WebSocket server兩種分享方式的效能,實驗結果顯示MQTT Broker能降低50%的CPU使用率及75%的Memory使用率,而在模擬大規模用戶連線的部分,則顯示出Bridge的設置可以減緩一定程度的系統負載,並降低整體的延遲時間,相較於單一Broker與WebSocket server,能夠滿足更多不同情境下使用者的需求。
As the concept of the Internet of Things (IoT) is becoming more and more popular, various IoT related applications have appeared in our daily lives and have created numerous business opportunities in the industry. To equip students with professional skills of IoT, colleges and universities open related curriculum; therefore, it is essential to construct the equipments needed for the IoT courses. To effectively use these devices and maintain their high availability, the maintenance and sharing of teaching resources have become an important issue. During the operating, the electronic parts of these devices can be damaged easily by students who have limited or no programming or electronic circuit backgrounds, thereby causing barriers to learning. To enable students to quickly grasp the concept of programming, Scratch, an on-line platform of learning programming language, is widely used in schools as an introductory programming course to reduce the difficulty of learning. By using the Scratch programming platform, users can interact with the IoT devices. In previous studies, users build their own WebSocket servers to share the IoT sensor values (e.g. G-sensor on the mobile phone), which are used to control the sprites in Scratch. However, this method can bring unpleasant experience to the users because of the complicated process of building a WebSocket server and substantial typing on the phone. In this thesis, based on the MQTT protocol and Scratch, we implement a Scratch extension platform for IoT. Our system provides an interactive website where users can share their IoT devices and access shared resources from Scratch by loading our Scratch extension blocks. The website also provides the function of downloading the Arduino sample codes that are mapped to the registed devices of the users. Finally, we compare the efficacy of the MQTT Broker and WebSocket server. The results show that the MQTT Broker reduces about 50% of CPU usage and 75% of memory usage. In addition, in the large-scale user connection tests, the results show that comparing to Single MQTT Broker and WebSocket server, Bridge can relive a certain degree of system load, reduce the overall latency, and satisfy more user needs in different scenarios.
URI: http://etd.lib.nctu.edu.tw/cdrfb3/record/nctu/#GT070456113
http://hdl.handle.net/11536/142638
顯示於類別:畢業論文