智能家居:利用 IoT 技術和 IFTTT 製作保安設備 (學生版)Household project: Making security devices using IoT and IFTTT (Student's version)

標題:Title:智能家居 II:利用 IoT 技術和 IFTTT 製作保安設備Household project II: Making security devices using IoT and IFTTT
主題及重點:Unit: 主題三:互聯相依的當代世界
學習重點4:全球新科技發展概略:人工智能、大數據、雲端儲存
學習技能:Learning skill: micro:bitmicro:bit ArduinoArduino IoT:bitIoT:bit
學習範圍:Learning areas: 0 了解感應技術、無線通訊、資料傳輸和安全等方面的科學知識 0 運用IoT技術和IFTTT網絡服務 0 設計和製作保安設備 0 分析及記錄相關數據

前言Introduction

近年人工智能迅速發展,成為新興科技的重要一環。人工智能至今未有統一定義,一般是指人類製造的機器所表現出來的智慧,能執行需要人類智能才能完成的任務,例如語音和視像識別、推理、規劃、學習及解決問題。

利用IoT技術和IFTTT製作智能防盜盒子和智能保安門,使用了人工智能的電腦運算能力和大數據,讓學生了解人工智能已廣泛應用於日常生活中。


基礎知識

隨着電腦運算能力和資料貯存容量的提升,加上大數據及雲端運算的應用,推動了人工智能的發展。人們透過將大量數據、影像等不同形式的資料輸入電腦,並讓電腦通過演算法找出當中規律,進而自動「學習」,並作出預測、識別等模擬人類思維的行為,從而完成某些特定任務。人工智能已廣泛應用,例如人們採用電腦視覺技術,從平面或立體圖像中獲取訊息、特徵,並進行辨別、監測,衍生出智能監控系統、人臉識別系統。另外,現時常見虛擬助理,如聊天機械人、即時語言翻譯機器等,則應用了自然語言處理技術,以人工智能識別、區分和驗證使用者的聲音和文字。


科學概念
micro:bit與人腦運作的類比The analogy between micro:bit and the human brain

應用micro:bit的一項基本原理,是要檢測環境中某項「物理量」的變化,再根據這變化作出適當的反應。這和腦部的運作相似﹕感覺器官負責探測刺激,並把信息傳送到腦。腦是身體的協調中心,負責綜合和分析來自不同感覺器官的信息,產生感覺,並決定對刺激作出甚麼反應。然後,腦會發出信息,信息沿神經傳送到肌肉,使肌肉作出反應。

Detecting the change in certain ‘physical quantities’ in the environment is the basic principle of using micro:bit. The micro:bit may then take adequate reaction according to the change. This is similar to how the human brain works. The brain integrates and interprets the signals from the sense organs, produces senses, decides on actions and sends signals to the muscles to make a response.

以我們過往製作的「自動酒精噴霧器」為例,當我們靠近該裝置,噴霧器的聲納和紅外線探測器就像「感覺器官」,負責探測外來的刺激。然後,micro:bit就如人腦一樣負責綜合和分析信息,並傳送指令至裝置上的「摩打」,使其作出反應,擠壓噴霧器的手柄以噴出消毒酒精。

Let’s use the previous activity ‘Automatic Alcohol Sprayer’ as an example. When we approach the device, the sonar and infrared temperature sensor of the sprayer, which act like the ‘sense organs’, detect the stimulus from the surroundings. Then, micro:bit acts like our brain to integrate and analyse the signals from the sensors. It then orders to the motor of the device to respond by pushing the alcohol out.

裝置設有聲納和紅外線探測器,負責探測外來的刺激(有沒有人靠近)。

Sonar and infrared temperature sensor on the device are responsible for detecting stimulus.

輸入程式後,micro:bit就像人腦,能分析信息和發出指令。

The micro:bit acts like human brain when program is imported, which analyses data and gives order.

micro:bit傳送指令至摩打,使它們作出反應。

The motor receives orders from micro:bit to make a response.

摩打擠壓噴霧器的手柄,以噴出消毒酒精。

The motor pushes the handle of the sprayer to squeeze the alcohol out.



現在,我們明白利用micro:bit進行活動時,經常需要檢測環境中的「刺激」與變化,而過程中需要使用不同的感應器作為「感覺器官」。以下是一些常見的感應器:

Now we know that when we use micro:bit to carry out activities, we often need to detect the ‘stimulus’ or changes in the surroundings. Different kinds of sensors are required to act as ‘sense organs’. Here are some commonly used sensors:

温度與濕度感應器

Temperature and humidity sensor

光強度感應器

Light intensity sensor

聲納(探測與物體的距離)

Sonar

泥土濕度感應器

Soil moisture sensor

紅外線温度感測器

Infrared temperature sensor

micro:bit本身也可用作探測温度、位置、電壓和電流等

The micro:bit can be used to detect temperature, position, voltage and current.



科學概念

了解 IoT 技術和智能家居
micro:bit可配合IoT技術使用,把探測所得的數據傳輸至互聯網作儲存和進一步分析。
The micro:bit can be used with IoT technology, which can transfer detected data to the Internet for saving and further study.
IoT技術與應用What is IoT?

IoT技術泛指一系列裝有感應器、軟件或其他科技的物件,透過互聯網使物件與物件之間能傳輸數據和資訊。透過IoT技術,不同物件得以「聯繫」起來。

IoT技術能達致「物件與物件之間的溝通」,在日常生活中有很多應用﹕

The Internet of Things (IoT) describes the network of objects that are equipped with sensors, software, or other technologies, in order to exchange data between different devices and systems through the Internet. Different things in this network can then be ‘connected’.

IoT enables ‘device-to-device communication’. It has many applications in daily life. Let’s see some examples below.

保健科技﹕一些可穿戴的儀器例如手錶可用來監測 人體的生理狀況,包括心跳率、血糖水平以至有否 憂鬱等。透過IoT技術,這些可穿戴的儀器讓我們 更清楚自己的身體狀況,並讓醫生遙距觀察病人。

Healthcare Technology: Wearables such as a watch can be used to monitor body conditions including heart rate, blood glucose levels and even depression. Those wearables using IoT enable us to better understand our own health and allow doctors to monitor patients remotely.

智能城市﹕科學家和工程師可以透過IoT技術規劃智能城市。IoT技術在城市的應用範圍包括水資源管理、廢物處理和交通控制等。例如,在洛杉磯一些街道上的感應器會把實時交通情況傳送至中央系統,系統分析數據後,便會自動調節交通燈以應付當時的交通情況。

Smart Cities: Scientists and engineers can use IoT in areas like water management, waste control and transportation. For example, in Los Angeles, sensors on the road send real-time data of traffic flow to a central platform, which will then analyse the data and automatically adjust the traffic lights to cope with the traffic situation.


1.

在互聯網上搜尋更多IoT技術的應用,並寫出其中兩個

Search information on the Internet and state TWO more applications of IoT.

2.

在互聯網上搜尋使用IoT技術的缺點,並寫出其中兩個

Search information on the Internet and state TWO disadvantages of using IoT.


IFTTT是甚麼?

IFTTT (IF This Then That)是一個新興的免費網絡服務,根據其他不同平台的條件來決定是 是否執行命令。這是其中一個例子:如果明天的天氣預測是下雨天,在今天傍晚傳送一個電郵或短訊給我。

網站: https://e-aristo.hk/r/csSTEM0002.c

What is IFTTT?

IFTTT (IF This Then That) is a free web-based service to create chains of simple conditional statements, called applets. Here is an example: if the weather forecast for tomorrow is rain, send me an email or message by this evening.

Website: https://ifttt.com/




智能家居是甚麼?What is a smart home?

智能家居是指透過應用 IoT技術來達致家居自動化。家居自動化系統能夠控制燈光、温度、影音設備 以及其他電器。此外,家居保安系統例如出入控制或警報器也是智能家居的一部分。

A smart home means building automation for your home with the application of IoT. A home automation system can control lighting, electrical appliances, entertainment systems, etc. It may also include home security such as access control and alarm systems.



家居自動化的例子Examples of home automation system

控制家中的燈光

Lighting control

聲控家居電器

Control electrical appliances by voice

温度控制

Temperature control



設計與製作智能防盜盒子Making a smart security box

我們將會製作一個智能防盜盒子。當有人嘗試打開你的盒子時,你會收到一個提示信息,警告你的盒子正被打開。智能防盜盒子的基本概念如下:

We are going to make a smart security box. When someone tries to open your box, you will receive a warning message. The basic idea is as follows.

  1. 把一個micro:bit(已連接至IoT:bit)和光強度感應器放進盒子內。
  2. 它們會檢測盒子內的光強度是否高於某特定數值,然後把已分析的數據傳送至ThingSpeak網站。
  3. 如果光強度持續高於所設的特定數值一段時間,代表盒子正被打開,ThingSpeak會「告訴」IFTTT給我們發送一個警告信息。
  1. Put a micro:bit (connected to IoT:bit) and a light sensor into the box.
  2. They will check whether the light intensity is higher than a certain value. The micro:bit will send the data to the website ThingSpeak.
  3. If the light intensity remains high for a certain time, which indicates that the box is being opened, Thingspeak will ‘tell’ IFTTT to send us a warning message.


建議材料及工具︰ Materials:

製作步驟:
Procedures:

1. 把樣本程式檔案儲存至micro:bit(連接至光強度感應器和IoT:bit):
micro:bit程式檔案 Arduino程式檔案

1. Import the sample code into the micro:bit (connected to IoT:bit, Wi-Fi and light intensity sensor):
>Program file of micro:bit Program file of Arduino

2. 把連接好的micro:bit放進盒子中。

2. Put the micro:bit and the sensor into a drawer.

完成IFTTT網站上的設定:https://e-aristo.hk/r/csSTEM0004.c

Finish the settings on IFTTT website: https://e-aristo.hk/r/csSTEM0004.e

3. 完成ThingSpeak網站上的設定:https://e-aristo.hk/r/csSTEM0005.c

3. Finish the settings on ThingSpeak website: https://e-aristo.hk/r/csSTEM0005.e

4. 如果你的盒子被打開, IFTTT上已設定的 「事件」便會被觸發。

4. If the box is opened by someone, an event will be triggered on IFTTT.

5. 一個警告信息(如email或line)便會傳送給你。

5. A message (like email or line) will be sent to you.



設計與製作智能保安門Making a smart security door

我們將會製作一道智能保安門。當有人嘗試打開門進入你的屋子時,警報器便會啟動,你也會收到一個警告信息,提醒你正有人打開你家中的大門。智能保安門的基本概念如下:

We are going to make a smart security door. When a thief tries to open the door, an alarm will be triggered and we will receive a message warning us. The basic idea is as follows.

  1. 把一個micro:bit(已連接至IoT:bit)和喇叭連接起來,並用錫紙在門和門框建立一個完整電路。
  2. micro:bit會檢測電路是否有電流通過。如檢測不到電流通過,表示門被打開,喇叭便會響起。micro:bit 也會把已分析的數據傳送至 ThingSpeak 網站。
  3. 如果門被持續打開一段時間,ThingSpeak會「告訴」IFTTT給我們發送一個警告信息。
  1. Connect a micro:bit (connected to IoT:bit) with a buzzer to two strips of aluminium foil pasted on the door frame. Another strip of aluminium foil is pasted on the door.
  2. If the door is opened, the circuit will become incomplete. The alarm will be triggered and the micro:bit will send data to the website ThingSpeak.
  3. If the door remains opened for a certain time, Thingspeak will ‘tell’ IFTTT to send us a warning message.


建議材料及工具︰ Materials:

製作步驟:
Procedures:

1. 把樣本程式檔案儲存至micro:bit(連接至喇叭和IoT:bit):
micro:bit程式檔案 Arduino程式檔案

1. Import the sample code into the micro:bit (connected to IoT:bit, Wi-fi and buzzer):
Program file of micro:bit Program file of Arduino

2. 把連接好的micro:bit放近門邊。

2. Put the micro:bit near a door.

3. 用夾把micro:bit連接至門框的兩塊錫紙。

3. Paste two aluminium strips on the door frame and connect them to the micro:bit.

4. 在門邊也加上一塊錫紙,當門關好時,電路便閉合。

4. Paste another aluminium strip on the door.

5. 完成IFTTT網站上的設定:https://e-aristo.hk/r/csSTEM0007.c

5. Finish the settings on IFTTT website: https://e-aristo.hk/r/csSTEM0007.e

6. 完成ThingSpeak網站上的設定:https://e-aristo.hk/r/csSTEM0008.c

6. Finish the settings on ThingSpeak website: https://e-aristo.hk/r/csSTEM0008.e

7. 如果門被打開, IFTTT上已設定的「事件」便會被觸發,喇叭也會響起。

7. If the door is open, an event will be triggered on IFTTT and the buzzer will beep.

8. 一個警告信息(如email或line)便會傳送給你。

8. A message (like email or line)will be sent to you.


沒有使用權限No access right

你的學校未有使用本系列資源之權限。

Your school does not have the access right to open the resources of this series.

沒有使用權限No access right

你的學校未有使用本系列資源之權限。

Your school does not have the access right to open the resources of this series.