IOT Wifi Motion Sensor With Email Notifications (IFTTT)

Introduction: IOT Wifi Motion Sensor With Email Notifications (IFTTT)

In this project we present how to build battery powered Wi-Fi PIR motion sensor with email notifications for less than £20. The device constantly monitors if there is any movement. Every time a movement is detected the device sends a notification to your email. It connects to the internet over Wi-Fi network by using Things On Edge Cricket ® Wi-Fi module, so you do not require any extra IoT HUB.

The instructions comprise with the following steps:

  • Explaining project using Fritzing schematics
  • Assembly
  • Setting-up IFTTT and email service
  • Configuring IoT module
  • Connecting IoT module to the internet

Supplies

Before you start, please make sure you have the following components:

Step 1: Video With Full Instructions

This project is also supported with a full video which includes all instructions.

Step 2: Assembly

We use the PIR sensor module (HC-SR501), which is easily accessible from Amazon and other online shops. The module detects motions and sets the OUT pin HI for selected duration (explained in more details further in the blog). This wakes up the IOT module and sends the email notification over IFTTT.

The PIR module operating voltage is 4.5-20V and we have chosen a 9V battery to power-up this sensor. However we also want to use the IOT Cricket Wi-Fi module which operates between 1V and 3.5V. We cannot connect this battery directly to the IOT module. We need to add a step down regulator DC-DC to lower down the voltage otherwise we damage the board.

We choose the MP1584EN step-down module which output voltage can be adjusted between 0.9V and 20V. We have to make sure the output voltage is set correctly to avoid damage. The module has a potentiometer to regulate the output voltage. This should be adjusted for 3.3V using a multimeter.

The motion sensor also has 2x potentiometers to regulate sensitivity and duration of the output signal. The cricket module wakes-up by providing a high signal on WAKE_UP pin, then it sends the notification to the cloud/IFTTT and powers itself down to wait for another wake_up signal. The entire process takes approx. 5 seconds. The duration for the motion sensor can be adjusted between 3s and 1 minute. We need to set this to minimum to avoid multiple notifications on a single movement detection.

The potentiometer should be turned to maxim anticlockwise. This sets the output signal to last approx 3 seconds.

Follow the schematics below to connect all components together, it can be done using breadboard but eventually this will be turned into a standalone product with 3D printed enclosure.

After assembly the circuits should work as expected, any movements detected should wake-up the Cricket board, this is indicated by LED blinking.

Step 3: Setting-up IFTTT and Email Service

Steps to follow:

  • Go to: https://ifttt.com/
  • Login or register
  • Click Create from User / Account menu (top right corner)
  • Click + to create new source event
  • Select Webhooks service
  • Click Continue
  • Click Receive a web request (on the left hand side)
  • Create event name e.g. pir_sensor
  • The source event should be set-up now, click + after Then event
  • Search email service
  • Change subject and body of the email accordingly
  • Click Finish

Nearly done, we need to get a HTTP address to which we can post events from the IoT module.

Search for Webhooks service and click on the document in the right up corner.

Next copy web links under "Make a POST or GET web request to:" you will need it later.

We have successfully assembled the device!Before we start using the device it needs to be configured in Developer Portal. Please go to the next section.

Step 4: Configure Your Device in Developer Portal

Cricket is entirely configured OTA (Over The Air) through TOE Developer Portal (https://dev.thingsonedge.com). Once the Cricket module is paired to a Wi-Fi network it retrieves a configuration from the Developer Portal automatically. Now let's configure it first.

For our Wi-Fi Motion Sensor device we want to configure Cricket to send HTTP Post Requests to the IFTTT / Webhooks when it wakes up on IO1: WAKE_UP pin. The IOT Cricket module wakes up when IO1 receives a high signal from the PIR sensor module.

Now open TOE Developer Portal from any browser either from PC or mobile. You must register/login to Developer Portal to activate and configure the device in your account. Otherwise the device won't work.

After successful login / registration you need to click "Add new" device to activate your device in the system. You need to use the unique serial number printed on a label stick on the back of Cricket.

NOTE: You must keep the serial number for yourself only. Do not share it with anyone else.

Now you can configure your device. Set the following configuration:

  • RTC: OFF
  • IO2: OFF
  • IO3: OFF
  • Battery monitor: OFF
  • Force updates on - IO1 Wake Up: On
  • Force updates on - RTC Wake Up: OFF
  • Post Events: see below

Copy / paste the link we copied from Webhooks in io1_wakeup and leave data empty.

Just two more steps:

  • replace https to http
  • replace event to pir_sensor

The link should look similar to the one shown below:

http://maker.ifttt.com/trigger/pir_sensor/with/key/hfNIx8SKn_xxxxxxxxxxxxxxxxxxxxxx_YW3xx5yFw5MGD

Once you set your configuration hit the Save button.

We are almost there! We just need to connect our device to the internet over Wi-Fi network.

Step 5: Connect to Wi-Fi Network (internet)

In a few steps you connect your device to the internet over your Wi-Fi network. All you need to do is to activate Cricket's private Wi-Fi hotspot and then open a private web page to pass your Wi-Fi network credentials. Please follow the steps below:

  • Press and hold a button on the module for 5 seconds until the LED is constantly lit.
  • Once the LED is constantly lit Cricket opened a private Wi-Fi hot spot. Connect from either a laptop or smartphone to the hot spot with the following credentials:

    SSID: toe_device
    No password is required
  • Once connected, open a private web page: http://192.168.4.1/index.html
    NOTE:make sure LED is still ON! If is OFF repeat the steps from the beginning
  • Now you can pass your Wi-Fi network credentials and click CONNECT. If you passed correct SSID and Password then after few seconds the device should report it is online and the LED will be OFF.

Now the device is live and connected to the internet!

More information on how to connect Cricket module to the internet can be found in the Developer Guide documentation: https://thingsonedge.com/documentation

Step 6: Make a Case for the Device

Now we can 3D print the case for our device. You can download stl files from GitHUB and print this case.

After that the device will get a really nice look as shown on the image.

Step 7: Testing the Device

Now we can move around in front of the sensor and we get email notifications on a smartphone.

Step 8: Feedback

If you enjoyed building this device we would really appreciate if you could spread the word among your peers. If you have any feedback or suggestions how to improve and make it easier for you and other folks please let us know.

Many thanks & Enjoy!

Be the First to Share

    Recommendations

    • Metal Contest

      Metal Contest
    • Fandom Contest

      Fandom Contest
    • Backyard Contest

      Backyard Contest

    Comments