{"id":4136,"date":"2026-05-10T09:00:00","date_gmt":"2026-05-10T09:00:00","guid":{"rendered":"https:\/\/pirhome.com\/?p=3921"},"modified":"2026-05-10T09:00:00","modified_gmt":"2026-05-10T09:00:00","slug":"pir-ifttt-integration-smart-home-2","status":"publish","type":"post","link":"https:\/\/www.pirhome.com\/?p=4136","title":{"rendered":"PIR Sensor with IFTTT Integration: Trigger Anything in Your Smart Home"},"content":{"rendered":"<h2>Project Overview<\/h2>\n<p>This project connects a PIR sensor to IFTTT (If This Then That), allowing you to trigger thousands of smart home actions. When motion is detected, you can turn on lights, send notifications, log data to spreadsheets, control smart plugs, or trigger security cameras.<\/p>\n<p><strong>Difficulty:<\/strong> Intermediate<br \/>\n<strong>Estimated time:<\/strong> 1-2 hours<br \/>\n<strong>Estimated cost:<\/strong> $15-25<\/p>\n<h2>How It Works<\/h2>\n<p>An ESP32 detects motion from a PIR sensor and sends an HTTP request to IFTTT&#8217;s Webhooks service. IFTTT then triggers any action you have configured. Since the ESP32 uses Wi-Fi, it needs to be within range of your network, but the IFTTT integration works from anywhere.<\/p>\n<h2>Materials Needed<\/h2>\n<ul>\n<li>ESP32 or ESP8266 (1)<\/li>\n<li>HC-SR501 PIR sensor (1)<\/li>\n<li>Jumper wires<\/li>\n<li>Power supply (5V USB)<\/li>\n<li>IFTTT account (free)<\/li>\n<\/ul>\n<h2>IFTTT Setup<\/h2>\n<ol>\n<li>Create an account at ifttt.com<\/li>\n<li>Click Create \u2192 If This<\/li>\n<li>Search for and select Webhooks<\/li>\n<li>Select Receive a web request<\/li>\n<li>Enter an event name (e.g., motion_detected) \u2192 Create trigger<\/li>\n<li>Click Then That and choose your desired action (Philips Hue, Smart Life, Email, SMS)<\/li>\n<li>Configure the action (e.g., turn on living room light)<\/li>\n<li>Click Continue \u2192 Finish<\/li>\n<li>Go to Webhooks service page \u2192 Documentation to get your API key<\/li>\n<\/ol>\n<h2>Circuit Diagram<\/h2>\n<h3>Connection Table<\/h3>\n<table border=\"1\">\n<thead>\n<th>Component<\/th>\n<th>Pin<\/th>\n<th>ESP32 Pin<\/th>\n<\/thead>\n<tbody>\n<th>PIR Sensor<\/th>\n<p> VCC<\/th>\n<p> 3.3V<\/th>\n<th>PIR Sensor<\/th>\n<p> GND<\/th>\n<p> GND<\/th>\n<th>PIR Sensor<\/th>\n<p> OUT<\/th>\n<p> GPIO 4<\/th>\n<\/tbody>\n<p>\u8868<\/p>\n<h2>Arduino Code<\/h2>\n<pre><code>\/\/ PIR Sensor with IFTTT Integration\n#include &lt;WiFi.h&gt;\n#include &lt;HTTPClient.h&gt;\n\nconst char* ssid = \"YourWiFiSSID\";\nconst char* password = \"YourWiFiPassword\";\n\nconst char* iftttKey = \"YourIFTTTKey\";\nconst char* eventName = \"motion_detected\";\n\nconst int pirPin = 4;\n\nunsigned long lastTriggerTime = 0;\nconst unsigned long minInterval = 10000;\n\nvoid setup() {\n  Serial.begin(115200);\n  pinMode(pirPin, INPUT);\n  \n  WiFi.begin(ssid, password);\n  while (WiFi.status() != WL_CONNECTED) delay(500);\n  \n  delay(60000);\n}\n\nvoid triggerIFTTT() {\n  if (WiFi.status() == WL_CONNECTED) {\n    HTTPClient http;\n    String url = \"http:\/\/maker.ifttt.com\/trigger\/\" + String(eventName) + \"\/with\/key\/\" + String(iftttKey);\n    http.begin(url);\n    int httpCode = http.GET();\n    http.end();\n  }\n}\n\nvoid loop() {\n  bool motion = digitalRead(pirPin) == HIGH;\n  \n  if (motion && (millis() - lastTriggerTime > minInterval)) {\n    lastTriggerTime = millis();\n    triggerIFTTT();\n  }\n  \n  delay(100);\n}\n<\/code><\/pre>\n<h2>Enhanced Version with Data<\/h2>\n<pre><code>void triggerIFTTTWithData(int sensorId) {\n  if (WiFi.status() == WL_CONNECTED) {\n    HTTPClient http;\n    String url = \"http:\/\/maker.ifttt.com\/trigger\/\" + String(eventName) + \"\/with\/key\/\" + String(iftttKey);\n    http.begin(url);\n    http.addHeader(\"Content-Type\", \"application\/json\");\n    String payload = \"{\\\"value1\\\":\\\"\" + String(sensorId) + \"\\\",\\\"value2\\\":\\\"\" + String(millis()) + \"\\\"}\";\n    http.POST(payload);\n    http.end();\n  }\n}\n<\/code><\/pre>\n<h2>Low-Power Battery Version with p<\/h2>\n<pre><code>#include &lt;esp_sleep.h&gt;\n\nvoid setup() {\n  esp_sleep_enable_ext0_wakeup((gpio_num_t)pirPin, 1);\n}\n\nvoid loop() {\n  triggerIFTTT();\n  delay(5000);\n  esp_deep_sleep_start();\n}\n<\/code><\/pre>\n<h2>Installation Steps<\/h2>\n<ol>\n<li>Set up IFTTT account and create Webhooks trigger<\/li>\n<li>Create desired actions (lights, notifications, etc.)<\/li>\n<li>Get IFTTT API key from Webhooks documentation<\/li>\n<li>Update code with Wi-Fi credentials and IFTTT key<\/li>\n<li>Upload to ESP32 and test with hand motion<\/li>\n<li>Verify IFTTT triggers in activity log<\/li>\n<li>Place sensor in desired location<\/li>\n<\/ol>\n<h2>Popular IFTTT Actions for PIR Sensors<\/h2>\n<ul>\n<li>Send SMS via Twilio<\/li>\n<li>Send push notification via IFTTT app<\/li>\n<li>Send email to yourself or family<\/li>\n<li>Turn on Philips Hue lights<\/li>\n<li>Activate TP-Link Kasa smart plug<\/li>\n<li>Control Sonos speakers<\/li>\n<li>Add row to Google Sheets<\/li>\n<li>Log to Google Drive<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>This IFTTT integration opens up countless possibilities for your PIR sensor. With minimal coding, you can connect your sensor to virtually any smart home device or online service.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Project Overview This project connects a PIR sensor to IFTTT (If This Then That), allowing you to trigger thousands of smart home actions. When motion is detected, you can turn on lights, send notifications, log data to spreadsheets, control smart plugs, or trigger security cameras. Difficulty: Intermediate Estimated time: 1-2 hours Estimated cost: $15-25 How [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-4136","post","type-post","status-publish","format-standard","hentry","category-projects"],"blocksy_meta":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\r\n<title>PIR Sensor with IFTTT Integration: Trigger Anything in Your Smart Home - PIRHOME<\/title>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/www.pirhome.com\/?p=4136\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"PIR Sensor with IFTTT Integration: Trigger Anything in Your Smart Home - PIRHOME\" \/>\r\n<meta property=\"og:description\" content=\"Project Overview This project connects a PIR sensor to IFTTT (If This Then That), allowing you to trigger thousands of smart home actions. When motion is detected, you can turn on lights, send notifications, log data to spreadsheets, control smart plugs, or trigger security cameras. Difficulty: Intermediate Estimated time: 1-2 hours Estimated cost: $15-25 How [&hellip;]\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/www.pirhome.com\/?p=4136\" \/>\r\n<meta property=\"og:site_name\" content=\"PIRHOME\" \/>\r\n<meta property=\"article:published_time\" content=\"2026-05-10T09:00:00+00:00\" \/>\r\n<meta name=\"author\" content=\"nic@nicsky.com\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"nic@nicsky.com\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4136#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4136\"},\"author\":{\"name\":\"nic@nicsky.com\",\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#\\\/schema\\\/person\\\/41049b5236f9c77c9314997d070db3e3\"},\"headline\":\"PIR Sensor with IFTTT Integration: Trigger Anything in Your Smart Home\",\"datePublished\":\"2026-05-10T09:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4136\"},\"wordCount\":355,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#organization\"},\"articleSection\":[\"Projects\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pirhome.com\\\/?p=4136#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4136\",\"url\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4136\",\"name\":\"PIR Sensor with IFTTT Integration: Trigger Anything in Your Smart Home - PIRHOME\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#website\"},\"datePublished\":\"2026-05-10T09:00:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4136#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pirhome.com\\\/?p=4136\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4136#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\\\/\\\/www.pirhome.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PIR Sensor with IFTTT Integration: Trigger Anything in Your Smart Home\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#website\",\"url\":\"http:\\\/\\\/www.pirhome.com\\\/\",\"name\":\"PIRHOME\",\"description\":\"PIR &amp; Motion Sensor\",\"publisher\":{\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\\\/\\\/www.pirhome.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#organization\",\"name\":\"PIRHOME\",\"url\":\"http:\\\/\\\/www.pirhome.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.pirhome.com\\\/wp-content\\\/uploads\\\/2026\\\/02\\\/cropped-\u5fae\u4fe1\u56fe\u7247_2026-02-19_222409_472.jpg\",\"contentUrl\":\"https:\\\/\\\/www.pirhome.com\\\/wp-content\\\/uploads\\\/2026\\\/02\\\/cropped-\u5fae\u4fe1\u56fe\u7247_2026-02-19_222409_472.jpg\",\"width\":512,\"height\":512,\"caption\":\"PIRHOME\"},\"image\":{\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#\\\/schema\\\/person\\\/41049b5236f9c77c9314997d070db3e3\",\"name\":\"nic@nicsky.com\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/271d4eaab48e299e4fce771a8c43c537be3ac77a3115cc7de802a6c8b692d971?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/271d4eaab48e299e4fce771a8c43c537be3ac77a3115cc7de802a6c8b692d971?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/271d4eaab48e299e4fce771a8c43c537be3ac77a3115cc7de802a6c8b692d971?s=96&d=mm&r=g\",\"caption\":\"nic@nicsky.com\"},\"sameAs\":[\"http:\\\/\\\/www.pirhome.com\"],\"url\":\"https:\\\/\\\/www.pirhome.com\\\/?author=1\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PIR Sensor with IFTTT Integration: Trigger Anything in Your Smart Home - PIRHOME","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pirhome.com\/?p=4136","og_locale":"en_US","og_type":"article","og_title":"PIR Sensor with IFTTT Integration: Trigger Anything in Your Smart Home - PIRHOME","og_description":"Project Overview This project connects a PIR sensor to IFTTT (If This Then That), allowing you to trigger thousands of smart home actions. When motion is detected, you can turn on lights, send notifications, log data to spreadsheets, control smart plugs, or trigger security cameras. Difficulty: Intermediate Estimated time: 1-2 hours Estimated cost: $15-25 How [&hellip;]","og_url":"https:\/\/www.pirhome.com\/?p=4136","og_site_name":"PIRHOME","article_published_time":"2026-05-10T09:00:00+00:00","author":"nic@nicsky.com","twitter_card":"summary_large_image","twitter_misc":{"Written by":"nic@nicsky.com","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pirhome.com\/?p=4136#article","isPartOf":{"@id":"https:\/\/www.pirhome.com\/?p=4136"},"author":{"name":"nic@nicsky.com","@id":"http:\/\/www.pirhome.com\/#\/schema\/person\/41049b5236f9c77c9314997d070db3e3"},"headline":"PIR Sensor with IFTTT Integration: Trigger Anything in Your Smart Home","datePublished":"2026-05-10T09:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pirhome.com\/?p=4136"},"wordCount":355,"commentCount":0,"publisher":{"@id":"http:\/\/www.pirhome.com\/#organization"},"articleSection":["Projects"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pirhome.com\/?p=4136#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pirhome.com\/?p=4136","url":"https:\/\/www.pirhome.com\/?p=4136","name":"PIR Sensor with IFTTT Integration: Trigger Anything in Your Smart Home - PIRHOME","isPartOf":{"@id":"http:\/\/www.pirhome.com\/#website"},"datePublished":"2026-05-10T09:00:00+00:00","breadcrumb":{"@id":"https:\/\/www.pirhome.com\/?p=4136#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pirhome.com\/?p=4136"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pirhome.com\/?p=4136#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.pirhome.com\/"},{"@type":"ListItem","position":2,"name":"PIR Sensor with IFTTT Integration: Trigger Anything in Your Smart Home"}]},{"@type":"WebSite","@id":"http:\/\/www.pirhome.com\/#website","url":"http:\/\/www.pirhome.com\/","name":"PIRHOME","description":"PIR &amp; Motion Sensor","publisher":{"@id":"http:\/\/www.pirhome.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.pirhome.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/www.pirhome.com\/#organization","name":"PIRHOME","url":"http:\/\/www.pirhome.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.pirhome.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.pirhome.com\/wp-content\/uploads\/2026\/02\/cropped-\u5fae\u4fe1\u56fe\u7247_2026-02-19_222409_472.jpg","contentUrl":"https:\/\/www.pirhome.com\/wp-content\/uploads\/2026\/02\/cropped-\u5fae\u4fe1\u56fe\u7247_2026-02-19_222409_472.jpg","width":512,"height":512,"caption":"PIRHOME"},"image":{"@id":"http:\/\/www.pirhome.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"http:\/\/www.pirhome.com\/#\/schema\/person\/41049b5236f9c77c9314997d070db3e3","name":"nic@nicsky.com","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/271d4eaab48e299e4fce771a8c43c537be3ac77a3115cc7de802a6c8b692d971?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/271d4eaab48e299e4fce771a8c43c537be3ac77a3115cc7de802a6c8b692d971?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/271d4eaab48e299e4fce771a8c43c537be3ac77a3115cc7de802a6c8b692d971?s=96&d=mm&r=g","caption":"nic@nicsky.com"},"sameAs":["http:\/\/www.pirhome.com"],"url":"https:\/\/www.pirhome.com\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts\/4136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4136"}],"version-history":[{"count":1,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts\/4136\/revisions"}],"predecessor-version":[{"id":4658,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts\/4136\/revisions\/4658"}],"wp:attachment":[{"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}