An AllThingsTalk Experiment to detect when something is moving in a room and warn you visually via an LED (light emitting diode) and an e-mail.
With this experiment we use a PIR (passive infrared sensor) to detect movement and send an email via an automation rule configured in AllThingsTalk.
This experiment demonstrates two handy automation rules. One to activate an LED and a second to notify you via e-mail when motion is detected.
It’s a nice example how you could make a security detector, by placing the PIR sensor in a room or closet to protect valuable things you care about.
Basic knowledge how to work with an Arduino is a must, if you’ve never used an Arduino before we suggest the setup guide.
First we need to create our device. Log in to AllThingsTalk Maker and navigate to the ground in which you want to create your device. Next follow these instructions.
If you just created a new account, you will have a default ground called playground setup for you. You can use this ground to create your devices.
You find the device credentials under the SETUP tab of your device settings, which you can find behind the gear icon.
Arduino_Motion_Sensor.ino
file in your Arduino IDE which you can find under the examples and experiments folderWe are now ready to upload our sketch to the Arduino.
After the project has started, you should now see the assets created under your device in the AllThingsTalk Maker (you may need to refresh your browser).
As a few last steps, we will create an automation rule and set up a pinboard to visualise our data.
Now to setup an automation rule between the PIR sensor and the LED actuator. The rule will trigger the LED when the PIR sensor is activated.
For this we are going to use the rule manager in the AllThingsTalk Maker. The rule manager allows us to configure condition based logic triggers between assets and services.
Define the WHEN statement :
Define the THEN statement :
Define ELSE action :
To visualise our date, we will create a pinboard. For more information on pinboards, please check how to use pinboards.
Now we will pin a control (visual representation) for our PIR and_LED_ assets.
Repeat the above steps to pin the LED asset using a toggle control.
To receive ground notifications, simply turn them on in the ground. You can do this as follows:
You will now receive a notification every time something in the ground changes. You can view these notifications both in the AllThingsTalk Maker and AllThingsTalk Mobile!