In this instructable, we will build a motion detector and trigger IFTTT events from that device.
You may create IFTTT recipes for receiving email if someone is inside the house or switching a Belkin WeMo when you walk into a room.
As the motion detector cannot directly contact IFTTT, we will use Lithouse as the broker.
Step 1: DIY Motion Detector
You will need the following components:
- LED, Breadboard and some Wires.
Please connect these components as shown in the image.
- Mount the Ethernet Shield on Arduino.
- Connect the 5V and GND pin of the PIR to the respective heads of the Arduino Ethernet Shield.
- Connect the PIR’s output pin to the pin #2 of the Ethernet Shield.
- Connect the negative (short) leg of the LED to GND of the Shield.
- Connect the positive (long) leg of the LED to one of the end of the 330 Ohm resistor.
- Connect the other end of the 330 Ohm resistor to the pin #7 of the Shield.
Step 2: Register With Lithouse
Step 3: Software Setup
We are going to setup the Arduino development environment and configure the device:
- Download and install Arduino IDE.
- Download Lithouse Arduino library.
- Go to the Arduino IDE’s home folder. Then go inside the libraries folder. Now, unzip Lithouse client library here and rename it to Lithouse.
- Launch the Arduino IDE. Open LithousePIR (File > Examples > Lithouse > LithousePIR).
You may have noticed that the device key is missing in the LithousePIR sketch:
char deviceKey  = "YOUR_DEVICE_KEY";
We need to update this with an actual key.
- Go back to Devices tab and expand the group you just created by clicking the '+' on the left of group name.
- Then click the 'copy' icon beside the device key to copy it into the clipboard.
- Paste the device key in your sketch.
The program is now ready. Please upload it to Arduino.
You can test by moving a hand in front of the PIR sensor. The LED should turn on.
For more information regarding setup and debugging, please visit our tutorial.
Step 4: Activate IFTTT
At this stage, the device is connected to Lithouse. But, it cannot trigger IFTTT events yet. That will happen once you activate IFTTT on Lithouse:
- Login to Lithouse portal.
- Open your profile and click on activate.
- On the resultant pop-up, please provide your IFTTT email channel's address.
- Once you hit Verify, you will receive a verification email from Amazon Web Service (We use AWS for sending emails to email@example.com on your behalf).
- Please check your inbox and accept the verification request.