Search

IOT Door sensor - with Cricket



In this blog we present how you can easily build a battery powered Wi-Fi Door sensor with IOT Cricket Wi-Fi module. We also show how to integrate Cricket's messages with IFTTT and convert them to phone notifications. When a door opens the Cricket sends notifications to your phone.


NOTE: this blog is to showcase how you can easily put together a prototype door sensor in a few minutes. However to make a fully fledged door sensor you might want to spend a bit more time to optimise the design for your needs.


In principle it works like that. When the magnet part is near to the reed sensor part (door closed) it disconnects IO1 from BATT, if the magnet move apart from reed sensor (door opened) it connects BATT voltage to IO1_Wakeup signal and wakes the board up.


We configure Cricket to send HTTP POST requests to the IFFTT where it is converted to push notifications, which are sent to a phone. Additionally all notifications include information about a battery level and an ambient temperature from the Cricket's built-in temperature sensor.


The instructions comprise with the following steps:

  • Explaining project using schematics

  • IFTTT setup with Pushbullet service

  • Configuring IOT Cricket module

  • Connecting IOT Cricket to the internet over Wi-Fi


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

  1. Cricket Wi-Fi module (https://www.thingsonedge.com/)

  2. Door Window Magnetic Switch

  3. Battery Holder

  4. 2xAAA batteries


If you are ready let's get started!


Assembly

We use the NC reed sensor. Follow the schematics below to connect all components together.





Once you assemble, the circuits should work as follow. When a door is opened it wakes-up the Cricket indicated by LED blinking.


Your device is almost ready. Now let's configure IFTTT to send push notification on the door open event.



IFTTT setup with an Pushbullet 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. door_sensor

  • The source event should be set-up now, click + after Then event

  • Search pushbullet service

  • Change Event Name to door_sensor

  • Change Title accordingly

  • Change Message to Door open battery = {{Value1}} temp = {{Value2}}

  • Click Finish


Almost there, now you 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.


Before we start using the device it needs to be configured in Developer Portal. Please go to the next section.


Configure your device in Developer Portal

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.


Set the following configuration:

RTC: OFF
IO2: OFF
Battery monitor: ON
Temperature Sensor: ON
Force updates on - IO1 Wake Up: Yes
Force updates on - RTC Wake Up: No
Post Events: see below

Copy / paste the link we copied from Webhooks in io1_wakeup:

URL:

  • replace https to http

  • replace event to door_sensor

the link should look like this below:

http://maker.ifttt.com/trigger/door_sensor/with/key/{key} 

Data:

{"value1":"#batt","value2":"#temp"}

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.



Connect to Wi-Fi network (internet)

Press the button on the Cricket for 5 seconds until the LED is constantly lit. Then connect from any device with web browser capabilities (smartphone, laptop, ...) to toe_device Circket's private Wi-Fi network. Open http://192.168.4.1/index.html page and pass your Wi-Fi credentials. That's it.



More information how to provision Cricket with your Wi-Fi network can be found in Cricket's IOT Developer Guide documentation.


Now our device is live and connected to the internet!


Fetch the configuration from Developer Portal

Just one more step. Press the on board button for 1 second to fetch the configuration from Developer Portal. Now you are all set and you should keep receiving notifications on your phone when a door is open.



About us

Things On Edge is a company based in Cambridge, UK. We designed ultra-low battery powered Cricket ® Wi-Fi module to allow you to connect electronic devices to smartphones or other internet services literally in minutes. It doesn't require any programming and coding. It allows you to integrate your device to a huge IOT ecosystem services over MQTT and HTTP POST requests.



Feedback

We hope it was an enjoyable experience for you building a door sensor with Cricket! Please help us improve the the technology if you have any feedback or suggestions. If you liked the project please help us spread the word.


Thank you!

74 views
logo.png

Legal: THINGS ON EDGE LTD

         Registered in United Kingdom

         Number: 11445097

Things On Edge Ltd

Cambridge, UK

CB25 9LT

  • LinkedIn - White Circle
  • White Facebook Icon
  • White Twitter Icon
  • White YouTube Icon

Copyright © 2018 Things On Edge Limited. All rights reserved.