Smart Dog Door Sensor/Alarm

by tsaiguy in Circuits > Arduino

210 Views, 1 Favorites, 0 Comments

Smart Dog Door Sensor/Alarm

IMG_6181.jpeg

I have two tiny, awesome, and less than optimally potty-trained dogs running around my house. While the little rascals have free reign to terrorize most of my home, we have put a dog fence preventing them from entering my carpeted basement. Sadly, this door has been left open for too long in the past, allowing the dogs to invade. To counter this, I added a sensor to the dog door that alerts me when it has been left open for more than 45 seconds. For added flare, I added an additional function to the door, which can be triggered from my phone, called alarm_mode. In alarm_mode, the door alerts me immediately when it's open, which will inform me that someone is entering the basement.

Supplies

  • Argon
  • Breadboard
  • Hall Sensor
  • Tape or Hot Glue
  • Neodymium Magnet

Setting Up the IFTTT App

Screen Shot 2023-01-24 at 1.07.59 PM.png
Screen Shot 2023-01-24 at 1.08.28 PM.png

We're going to set up our IFTTT account, which is how we will be receiving notifications on our phone from our Argon.

  • Head over to this link and follow the steps to make your account

Dog Door Left Open App

  • Go to this link to create your first app
  • Click on "If This"
  • Search for "WebHooks"
  • Click on WebHooks
  • Click on "Receive a web request"
  • Under Event Name, type "door_left_open"
  • Click Create Trigger
  • Click Then That
  • Search for "notifications"
  • Click on Notifications
  • Click on "Send a notification from the IFTTT app
  • Under Message, type "You left the dog door open"
  • Click Create Action

Alarm Triggered App

  • Go to this link to create your first app
  • Click on "If This"
  • Search for "WebHooks"
  • Click on WebHooks
  • Click on "Receive a web request"
  • Under Event Name, type "opened_alarm_on"
  • Click Create Trigger
  • Click Then That
  • Search for "notifications"
  • Click on Notifications
  • Click on "Send a notification from the IFTTT app
  • Under Message, type "Alarm Triggered"
  • Click Create Action
  • Click Continue



Getting Your IFTTT Key

Screen Shot 2023-01-24 at 1.15.54 PM.png
Screen Shot 2023-01-24 at 1.16.18 PM.png

Next, we are going to get our unique IFTTT key.

  • Go to this link
  • Click on documentation
  • Your key will be at the top of the page
  • Save the key for future use

Start a Particle Project

Screen Shot 2023-01-24 at 10.33.40 AM.png

If you don't already have a Particle account, you can create one here

  • Click on Argon/Boron
  • Click on Argon Wi-Fi + Mesh
  • Follow Instructions to finish setting up your device.

Next, we'll create the project that the Argon is going to be running

  • Click here to start a new project
  • Enter a title under "Current App" (For the example I called it Instructables_Dog_Door)
  • Copy and paste the code from this Google Doc into the project

Set Up Particle Webhooks

Screen Shot 2023-01-24 at 12.51.30 PM.png
Screen Shot 2023-01-24 at 12.53.54 PM.png

We are going to set up the WebHooks that will allow our Argon to talk to our phones.

First, we are going to set up our Alarm WebHook:

  • Click on this link to make a new Particle WebHook
  • In the Event Name Box, type "Alarm_Triggered"
  • In the URL Box, copy the url below into the box
  • https://maker.ifttt.com/trigger/opened_alarm_on/json/with/key/YOURKEY
  • IMPORTANT: Instead of writing "YOURKEY", write down the IFTTT access token that we created in Step 2.
  • Click the "Create Webhook" button

Secondly, we have to set up our Door_Left_Open WebHook

  • Click on this link to make a new Particle WebHook
  • In the Event Name Box, type "Door_Left_Open"
  • In the URL Box, copy the url below into the box
  • https://maker.ifttt.com/trigger/door_left_open/json/with/key/YOURKEY
  • IMPORTANT: Instead of writing "YOURKEY", write down the IFTTT access token that we created in Step 2.
  • Click the "Create Webhook" button

Create Your Unique Particle Access Token

Screen Shot 2023-01-24 at 12.44.35 PM.png

Next, we'll generate a unique access token that will (later on) allow us to talk to our Argon through the IFTTT App

  • Go to this link
  • Scroll until you see the Create a token (browser-based)
  • Type in your username and email in the text box
  • IMPORTANT: In the "Expires In" box, select "Never" from the drop down menu
  • Click the "Create token" button
  • Write down the access token for later use


Create the Final IFTTT App

Screen Shot 2023-01-26 at 10.06.58 AM.png

We're going to head back over to the IFTTT Create Page

  • Click on "If This"
  • Search for "Shortcuts"
  • Click on iOS Shortcuts
  • Click on "Shortcut automation started" //everything below needs to be changes
  • Click Then That
  • Search for "Webhooks"
  • Click on Webhooks
  • Click on "Make a web request"
  • Under url, type "https://api.particle.io/v1/devices/DEVICE_ID/toggle/?access_token=ACCESS_TOKEN"
  • Instead of "DEVICE_ID, type in your unique Argon device ID
  • To Find Device ID, go to here
  • Click on the devices button in the bottom left corner
  • Click on your username
  • Instead of "ACCESS_TOKEN", type in your unique particle access token we recorded in Step 5

  • Click Create Action
  • Click Continue
  • Name the App Toggle

Setting Up Your Phone

  • Install the IFTTT App
  • Head over to the Shortcuts App
  • Click the plus in the top right corner
  • Click on Add Action
  • Search for IFTTTT
  • Click on "Trigger Applet"
  • Select Toggle

The Easy Part

IMG_6166.jpeg
IMG_6167.jpeg
IMG_6168.jpeg

At this point, all the backend nonsense is complete. Now, we just gotta plug some things in.

Adhereing Breadboard to Dog Door

IMG_6180.jpeg

For our final step, we have to attach our machine to the door.

  • Using either tape or glue, adhere the machine to the dog door frame
  • Tape the Neodymium Magnet to the bottom left corner of the door
  • Tape the PIR Sensor facing upwards directly under the magnet

Enjoy Using Your New Dog Door

DoooogDoooor

Action at 00:48