1 Overview

在本课中将用PIR Sensor和蜂鸣器制作一个报警器,当PIR检测到有人移动时候,蜂鸣器报警并向指定邮箱发送报警信息。

2 Hardware Preparation

UNO R3 Board x1

Ethernet Shield W5100 x1

USB cable x1

HC-SR501 PIR motion sensor x1

buzzer x1

Breadboard (Optional) x1

Jumper wires

3 Hardware connection

PIR接D3

蜂鸣器接D4

(图自己画一下)

4 Add new device

Log in Cayenne IOT platfrom, Add new…->Device/Widget

Choose Sensors->”Motion”

Choose: Digital motor Sensor

Setting the datasheet as followed:

In you dashboard, click”Step 1:Sketch File”, the sample sketch will be displayed, in this example,we creat a new sketch. please download the skecth from: here

Choose the Board type Arduino Uno and corret Port, remember to use your authentication token. upload the sketch to Uno board, in your Cayenne dashboad click”Setp 2 :Add Actuators” .

Once the Arduino connects to the Dashboard it should automatically update the Digital Motion Sensor widget with data

5 Setting up triggers

Click the setting button at the upper right corner of the Digital Motion Sensor, click Trigger:

The Create Trigger screen appears. please set the , you can fill in all the details required for creation of your trigger. in this examples, we creat a trigger: if the Digtal Motion Sensor on(1), then send email or tex message for notification.

1) give the trigger a name: Alarm.

2) drag & drop the Arduino device into the IF statement.

3)choose whether we want to trigger an action if pir motion sensor is on or off.

4) We want to receive a notification once the buzzer on, then we add email or mobile phone into the Then statement area.

5) Click save, we’re done.

Once completed our trigger, we’ll return to the Triggers list where our new trigger is shown as below.

如果pir检测到有人移动蜂鸣器将响起,同时凯宴平台向你的邮箱发送邮件。