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

科學 X 電腦 (S1–S3)Science x ICT (S1–S3)智能家居 II:利用 IoT 技術和 IFTTT 製作保安設備Household project II: Making security devices using IoT and IFTTT
學習技能:Learning skill: micro:bitmicro:bit ArduinoArduino IoT:bitIoT:bit

前言Introduction

在這個活動,我們會應用IoT技術和IFTTT,製作一個智能防盜盒子和一道智能保安門。

In this activity, we will apply IoT technology and IFTTT to make a smart security box and a smart security door.



科學Science
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.



電腦ICT
了解IoT技術和智能家居Understanding IoT and smart home
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/isifttt.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://e-aristo.hk/r/isifttt.e




智能家居是甚麼?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

試寫出一些利用IoT技術,在家中製作「智能保安設備」的主意。

Search information on the Internet and write down some ideas that you can make your home ‘smart’.



製作智能防盜盒子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:

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

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

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

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

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

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

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

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

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

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

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

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


你應去查看是誰偷偷打開你的盒子了!

You should now find out who opened your box!



製作智能保安門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:

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

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

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

Put the micro:bit near a door.

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

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

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

Paste another aluminium strip on the door.

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

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

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

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

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

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

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

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



活動回顧Activities Review

除了智能防盜盒子和智能保安門,過去我們亦應用IoT技術進行了一系列的活動,現在就讓我們重温一下吧!

Besides smart security box and smart security door, we have applied IoT technology to carry out a series of activities in the past. Let’s have a review now!


智能雪櫃
Smart fridge

把micro:bit作為温度感應器,當高温持續一段時間,表示雪櫃門沒有關好,便會透過IFTTT給我們傳送信息。

觀看影片:https://e-aristo.hk/r/isfridgevideo1.c

Use micro:bit as a temperature sensor. If the temperature inside the fridge remains high for a period of time, the door of the fridge might be left open and a message will be sent to us through IFTTT.

Watch the video: https://e-aristo.hk/r/isfridgevideo1.e


智能水龍頭
Smart water tap

把micro:bit作為位置感應器,當位置和預設的不一樣,表示水龍頭沒有關好,便會透過IFTTT給我們傳送信息。

觀看影片:https://e-aristo.hk/r/istapvideo1.c

Use micro:bit as a position sensor. If the position of the tap is different to that of the default position for a period of time, the tap might not be turned off properly and a message will be sent to us through IFTTT.

Watch the video: https://e-aristo.hk/r/istapvideo1.e


温室
Greenhouse

用温度與濕度感應器探測温室內的情況,並透過IoT:bit把資訊記錄在ThingSpeak網站,隨時供我們查看。

觀看影片:https://e-aristo.hk/r/isghvideo1.c

Use temperature and humidity sensor to detect the conditions inside a greenhouse. The data will then be transferred to the website ThingSpeak through IoT:bit, which we can check anytime.

Watch the video: https://e-aristo.hk/r/isghvideo1.e


沒有使用權限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.