{"id":4127,"date":"2026-05-02T09:00:00","date_gmt":"2026-05-02T09:00:00","guid":{"rendered":"https:\/\/pirhome.com\/?p=3913"},"modified":"2026-05-02T09:00:00","modified_gmt":"2026-05-02T09:00:00","slug":"pir-automatic-sink-faucet-2","status":"publish","type":"post","link":"https:\/\/www.pirhome.com\/?p=4127","title":{"rendered":"PIR Sensor for Automatic Sink Faucet"},"content":{"rendered":"<h2>Project Overview<\/h2>\n<p>This project converts a standard sink faucet into a touchless automatic faucet. When you place your hands under the faucet, a PIR sensor detects motion and opens a solenoid valve, allowing water to flow. When you remove your hands, the water stops after a short delay.<\/p>\n<p><strong>Difficulty:<\/strong> Intermediate<br \/>\n<strong>Estimated time:<\/strong> 3-4 hours<br \/>\n<strong>Estimated cost:<\/strong> $40-60<\/p>\n<h2>How It Works<\/h2>\n<p>A PIR sensor is positioned under the faucet spout, facing down toward the sink. When hands enter the detection zone, the sensor triggers an Arduino which activates a solenoid valve connected to the water line. The valve opens, water flows, and when hands are removed, the valve closes after a brief delay.<\/p>\n<h2>Materials Needed<\/h2>\n<ul>\n<li>Arduino Uno or ESP32 (1)<\/li>\n<li>HC-SR501 PIR sensor (1)<\/li>\n<li>12V solenoid valve (normally closed, 1\/2&#8243; or 3\/4&#8243; NPT)<\/li>\n<li>12V power supply (2A minimum)<\/li>\n<li>MOSFET or relay module<\/li>\n<li>Plumbing fittings to adapt to your faucet supply<\/li>\n<li>Waterproof enclosure for electronics<\/li>\n<li>Jumper wires<\/li>\n<li>Teflon tape<\/li>\n<\/ul>\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>Arduino Pin<\/th>\n<\/thead>\n<tbody>\n<th>PIR Sensor<\/th>\n<p> VCC<\/th>\n<p> 5V<\/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> Digital Pin 2<\/th>\n<th>Relay Module<\/th>\n<p> IN<\/th>\n<p> Digital Pin 3<\/th>\n<th>Solenoid Valve<\/th>\n<p> Positive<\/th>\n<p> Relay COM (power supply +)<\/th>\n<th>Solenoid Valve<\/th>\n<p> Negative<\/th>\n<p> Relay NO (to power supply -)<\/th>\n<\/tbody>\n<p>\u8868<\/p>\n<h2>Plumbing Installation<\/h2>\n<ol>\n<li>Turn off water supply under the sink<\/li>\n<li>Locate the cold water supply line to your faucet<\/li>\n<li>Install solenoid valve in-line using Teflon tape on all threaded connections<\/li>\n<li>Mount solenoid valve securely under the sink<\/li>\n<li>Turn water on briefly to check for leaks before connecting electronics<\/li>\n<\/ol>\n<h2>Arduino Code<\/h2>\n<pre><code>\/\/ Automatic Faucet with PIR Sensor\nconst int pirPin = 2;\nconst int valvePin = 3;\n\nunsigned long lastTriggerTime = 0;\nconst unsigned long waterDuration = 3000;\nconst unsigned long minInterval = 1000;\n\nbool waterOn = false;\nbool motionDetected = false;\n\nvoid setup() {\n  Serial.begin(9600);\n  pinMode(pirPin, INPUT);\n  pinMode(valvePin, OUTPUT);\n  digitalWrite(valvePin, LOW);\n  \n  delay(60000);\n}\n\nvoid turnWaterOn() {\n  digitalWrite(valvePin, HIGH);\n  waterOn = true;\n}\n\nvoid turnWaterOff() {\n  digitalWrite(valvePin, LOW);\n  waterOn = false;\n}\n\nvoid loop() {\n  bool motion = digitalRead(pirPin) == HIGH;\n  \n  if (motion && !motionDetected) {\n    motionDetected = true;\n    lastTriggerTime = millis();\n    if (!waterOn) turnWaterOn();\n  }\n  \n  if (!motion && motionDetected) {\n    motionDetected = false;\n    lastTriggerTime = millis();\n  }\n  \n  if (waterOn && !motionDetected && (millis() - lastTriggerTime > waterDuration)) {\n    turnWaterOff();\n  }\n  \n  if (waterOn && (millis() - lastTriggerTime > 30000)) {\n    turnWaterOff();\n  }\n  \n  delay(100);\n}\n<\/code><\/pre>\n<h2>Installation Steps<\/h2>\n<ol>\n<li>Install solenoid valve in water supply line<\/li>\n<li>Test for leaks before connecting electronics<\/li>\n<li>Assemble electronics in waterproof enclosure<\/li>\n<li>Mount PIR sensor under faucet spout facing downward<\/li>\n<li>Connect solenoid to relay and power supply<\/li>\n<li>Upload code and test with hand motion<\/li>\n<li>Adjust PIR sensitivity to detect only hands<\/li>\n<\/ol>\n<h2>Project Extensions<\/h2>\n<ul>\n<li>Add temperature sensor for water temperature display<\/li>\n<li>Add flow sensor to monitor water usage<\/li>\n<li>Add voice control via Alexa or Google Assistant<\/li>\n<li>Add battery backup for operation during power outages<\/li>\n<li>Add second solenoid for automatic soap dispenser<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>This touchless faucet project adds convenience and improves hygiene in your kitchen or bathroom. With proper installation, it provides years of reliable hands-free operation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Project Overview This project converts a standard sink faucet into a touchless automatic faucet. When you place your hands under the faucet, a PIR sensor detects motion and opens a solenoid valve, allowing water to flow. When you remove your hands, the water stops after a short delay. Difficulty: Intermediate Estimated time: 3-4 hours Estimated [&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-4127","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 for Automatic Sink Faucet - 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=4127\" \/>\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 for Automatic Sink Faucet - PIRHOME\" \/>\r\n<meta property=\"og:description\" content=\"Project Overview This project converts a standard sink faucet into a touchless automatic faucet. When you place your hands under the faucet, a PIR sensor detects motion and opens a solenoid valve, allowing water to flow. When you remove your hands, the water stops after a short delay. Difficulty: Intermediate Estimated time: 3-4 hours Estimated [&hellip;]\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/www.pirhome.com\/?p=4127\" \/>\r\n<meta property=\"og:site_name\" content=\"PIRHOME\" \/>\r\n<meta property=\"article:published_time\" content=\"2026-05-02T09: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=\"2 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=4127#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4127\"},\"author\":{\"name\":\"nic@nicsky.com\",\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#\\\/schema\\\/person\\\/41049b5236f9c77c9314997d070db3e3\"},\"headline\":\"PIR Sensor for Automatic Sink Faucet\",\"datePublished\":\"2026-05-02T09:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4127\"},\"wordCount\":363,\"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=4127#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4127\",\"url\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4127\",\"name\":\"PIR Sensor for Automatic Sink Faucet - PIRHOME\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#website\"},\"datePublished\":\"2026-05-02T09:00:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4127#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pirhome.com\\\/?p=4127\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4127#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\\\/\\\/www.pirhome.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PIR Sensor for Automatic Sink Faucet\"}]},{\"@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 for Automatic Sink Faucet - 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=4127","og_locale":"en_US","og_type":"article","og_title":"PIR Sensor for Automatic Sink Faucet - PIRHOME","og_description":"Project Overview This project converts a standard sink faucet into a touchless automatic faucet. When you place your hands under the faucet, a PIR sensor detects motion and opens a solenoid valve, allowing water to flow. When you remove your hands, the water stops after a short delay. Difficulty: Intermediate Estimated time: 3-4 hours Estimated [&hellip;]","og_url":"https:\/\/www.pirhome.com\/?p=4127","og_site_name":"PIRHOME","article_published_time":"2026-05-02T09:00:00+00:00","author":"nic@nicsky.com","twitter_card":"summary_large_image","twitter_misc":{"Written by":"nic@nicsky.com","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pirhome.com\/?p=4127#article","isPartOf":{"@id":"https:\/\/www.pirhome.com\/?p=4127"},"author":{"name":"nic@nicsky.com","@id":"http:\/\/www.pirhome.com\/#\/schema\/person\/41049b5236f9c77c9314997d070db3e3"},"headline":"PIR Sensor for Automatic Sink Faucet","datePublished":"2026-05-02T09:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pirhome.com\/?p=4127"},"wordCount":363,"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=4127#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pirhome.com\/?p=4127","url":"https:\/\/www.pirhome.com\/?p=4127","name":"PIR Sensor for Automatic Sink Faucet - PIRHOME","isPartOf":{"@id":"http:\/\/www.pirhome.com\/#website"},"datePublished":"2026-05-02T09:00:00+00:00","breadcrumb":{"@id":"https:\/\/www.pirhome.com\/?p=4127#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pirhome.com\/?p=4127"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pirhome.com\/?p=4127#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.pirhome.com\/"},{"@type":"ListItem","position":2,"name":"PIR Sensor for Automatic Sink Faucet"}]},{"@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\/4127","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=4127"}],"version-history":[{"count":1,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts\/4127\/revisions"}],"predecessor-version":[{"id":4647,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts\/4127\/revisions\/4647"}],"wp:attachment":[{"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4127"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4127"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}