Search

IOT Door sensor - with Cricket

Updated: Dec 26, 2020



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.


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


NOTE: in this project we 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. For example this prototype keeps sending notifications when the sensor is closed. There might be many ways to solve it by e.g. either you can shift two parts apart so that when doors are being closed/opened the sensor closes for a fraction of a second to generate a pulse and send a notification once (not ideal but improves the design) or an extra circuit to generate pulse only once when the switch is closed (recommended).


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 a 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.




Connect your device to WiFi

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.


Configure your device


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"}

More information how to configure Cricket can be found in Cricket's IOT Developer Guide documentation.



Your device is ready

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!

1,309 views17 comments

Recent Posts

See All