{"id":4046,"date":"2026-04-12T09:00:00","date_gmt":"2026-04-12T09:00:00","guid":{"rendered":"https:\/\/pirhome.com\/?p=3908"},"modified":"2026-04-12T09:00:00","modified_gmt":"2026-04-12T09:00:00","slug":"pir-dog-bark-stopper-2","status":"publish","type":"post","link":"https:\/\/www.pirhome.com\/?p=4046","title":{"rendered":"PIR Dog Bark Stopper (Ultrasonic Deterrent)"},"content":{"rendered":"<h2>Project Overview<\/h2>\n<p>This project creates a humane dog bark deterrent that uses ultrasonic sound to discourage excessive barking. The system activates only when motion is detected, saving battery life and preventing constant noise. When the sensor detects a dog (or person), it emits a high-frequency sound (25-30 kHz) that is unpleasant to dogs but inaudible to humans.<\/p>\n<p><strong>Difficulty:<\/strong> Intermediate<br \/>\n<strong>Estimated time:<\/strong> 2-3 hours<br \/>\n<strong>Estimated cost:<\/strong> $25-35<\/p>\n<h2>How It Works<\/h2>\n<p>A PIR sensor detects motion (the dog approaching). When motion is detected, the system activates an ultrasonic transducer that emits a high-frequency tone. Dogs find this sound unpleasant and learn to associate the area with the sound, eventually reducing barking behavior. An optional sound sensor can be added to only activate when barking is actually occurring.<\/p>\n<h2>Materials Needed<\/h2>\n<ul>\n<li>Arduino Nano or ESP32 (1)<\/li>\n<li>HC-SR501 PIR sensor (1)<\/li>\n<li>Ultrasonic transducer (25-30 kHz, e.g., Murata MA40S4S)<\/li>\n<li>ULN2003 Darlington array or MOSFET (to drive transducer)<\/li>\n<li>Sound sensor module (LM393-based, optional)<\/li>\n<li>LED for status indication<\/li>\n<li>220\u03a9 resistor<\/li>\n<li>Jumper wires<\/li>\n<li>Power supply (5V 1A)<\/li>\n<li>Weatherproof enclosure (if outdoor use)<\/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>Ultrasonic Transducer (+)<\/th>\n<p> &#8211;<\/th>\n<p> Digital Pin 9 (via ULN2003)<\/th>\n<th>Ultrasonic Transducer (-)<\/th>\n<p> &#8211;<\/th>\n<p> GND<\/th>\n<th>Sound Sensor<\/th>\n<p> DO<\/th>\n<p> Digital Pin 3<\/th>\n<th>Status LED<\/th>\n<p> Anode<\/th>\n<p> Digital Pin 13 (via 220\u03a9)<\/th>\n<\/tbody>\n<p>\u8868<\/p>\n<h2>Arduino Code<\/h2>\n<pre><code>\/\/ PIR Dog Bark Stopper\n\nconst int pirPin = 2;\nconst int ultrasonicPin = 9;\nconst int soundSensorPin = 3;\nconst int ledPin = 13;\n\nconst int halfPeriod = 20;\nunsigned long lastTriggerTime = 0;\nconst unsigned long deterrentDuration = 3000;\nconst unsigned long cooldownPeriod = 60000;\nbool deterrentActive = false;\nunsigned long deterrentStart = 0;\n\nvoid setup() {\n  Serial.begin(9600);\n  \n  pinMode(pirPin, INPUT);\n  pinMode(ultrasonicPin, OUTPUT);\n  pinMode(soundSensorPin, INPUT);\n  pinMode(ledPin, OUTPUT);\n  \n  digitalWrite(ultrasonicPin, LOW);\n  digitalWrite(ledPin, LOW);\n  \n  Serial.println(\"Dog Bark Stopper Ready\");\n  delay(60000);\n}\n\nvoid generateUltrasonicTone() {\n  for (int i = 0; i < 1000; i++) {\n    digitalWrite(ultrasonicPin, HIGH);\n    delayMicroseconds(halfPeriod);\n    digitalWrite(ultrasonicPin, LOW);\n    delayMicroseconds(halfPeriod);\n  }\n}\n\nvoid activateDeterrent() {\n  if (millis() - lastTriggerTime > cooldownPeriod) {\n    deterrentActive = true;\n    deterrentStart = millis();\n    lastTriggerTime = millis();\n    \n    digitalWrite(ledPin, HIGH);\n    \n    while (millis() - deterrentStart < deterrentDuration) {\n      generateUltrasonicTone();\n    }\n    \n    digitalWrite(ledPin, LOW);\n    deterrentActive = false;\n  }\n}\n\nbool isBarking() {\n  return digitalRead(soundSensorPin) == HIGH;\n}\n\nvoid loop() {\n  bool motionDetected = digitalRead(pirPin) == HIGH;\n  bool barking = isBarking();\n  \n  if (motionDetected) {\n    activateDeterrent();\n  }\n  \n  delay(100);\n}\n<\/code><\/pre>\n<h2>Installation Steps<\/h2>\n<ol>\n<li>Assemble circuit on breadboard and test with oscilloscope<\/li>\n<li>Test with a known dog to verify reaction (look for ear perk, head tilt)<\/li>\n<li>Adjust frequency for different dogs (20-30kHz)<\/li>\n<li>Mount unit where the dog frequents at appropriate height (0.5-1m)<\/li>\n<li>Observe behavior over several days to see if barking reduces<\/li>\n<\/ol>\n<h2>Safety Considerations<\/h2>\n<ul>\n<li>This device is meant to discourage excessive barking, not to punish<\/li>\n<li>The deterrent should only activate briefly when motion is detected<\/li>\n<li>The sound should be inaudible to humans; if you can hear it, the frequency is too low<\/li>\n<li>Not for use on puppies (very young dogs may be more sensitive)<\/li>\n<li>Check local regulations regarding ultrasonic devices<\/li>\n<\/ul>\n<h2>Project Extensions<\/h2>\n<ul>\n<li>Add sound sensor to only trigger when barking is actually occurring<\/li>\n<li>Add ESP32 to send notifications when the deterrent activates<\/li>\n<li>Track how often the device activates to measure barking frequency<\/li>\n<li>Add Bluetooth to manually trigger from phone<\/li>\n<li>Add water sprayer for stubborn dogs (less humane)<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>This humane bark deterrent can help reduce excessive barking without causing pain or distress. Combined with positive reinforcement training, it can be an effective tool for managing nuisance barking.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Project Overview This project creates a humane dog bark deterrent that uses ultrasonic sound to discourage excessive barking. The system activates only when motion is detected, saving battery life and preventing constant noise. When the sensor detects a dog (or person), it emits a high-frequency sound (25-30 kHz) that is unpleasant to dogs but inaudible [&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-4046","post","type-post","status-publish","format-standard","hentry","category-projects"],"blocksy_meta":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\r\n<title>PIR Dog Bark Stopper (Ultrasonic Deterrent) - 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=4046\" \/>\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 Dog Bark Stopper (Ultrasonic Deterrent) - PIRHOME\" \/>\r\n<meta property=\"og:description\" content=\"Project Overview This project creates a humane dog bark deterrent that uses ultrasonic sound to discourage excessive barking. The system activates only when motion is detected, saving battery life and preventing constant noise. When the sensor detects a dog (or person), it emits a high-frequency sound (25-30 kHz) that is unpleasant to dogs but inaudible [&hellip;]\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/www.pirhome.com\/?p=4046\" \/>\r\n<meta property=\"og:site_name\" content=\"PIRHOME\" \/>\r\n<meta property=\"article:published_time\" content=\"2026-04-12T09: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=4046#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4046\"},\"author\":{\"name\":\"nic@nicsky.com\",\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#\\\/schema\\\/person\\\/41049b5236f9c77c9314997d070db3e3\"},\"headline\":\"PIR Dog Bark Stopper (Ultrasonic Deterrent)\",\"datePublished\":\"2026-04-12T09:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4046\"},\"wordCount\":413,\"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=4046#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4046\",\"url\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4046\",\"name\":\"PIR Dog Bark Stopper (Ultrasonic Deterrent) - PIRHOME\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#website\"},\"datePublished\":\"2026-04-12T09:00:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4046#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pirhome.com\\\/?p=4046\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4046#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\\\/\\\/www.pirhome.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PIR Dog Bark Stopper (Ultrasonic Deterrent)\"}]},{\"@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 Dog Bark Stopper (Ultrasonic Deterrent) - 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=4046","og_locale":"en_US","og_type":"article","og_title":"PIR Dog Bark Stopper (Ultrasonic Deterrent) - PIRHOME","og_description":"Project Overview This project creates a humane dog bark deterrent that uses ultrasonic sound to discourage excessive barking. The system activates only when motion is detected, saving battery life and preventing constant noise. When the sensor detects a dog (or person), it emits a high-frequency sound (25-30 kHz) that is unpleasant to dogs but inaudible [&hellip;]","og_url":"https:\/\/www.pirhome.com\/?p=4046","og_site_name":"PIRHOME","article_published_time":"2026-04-12T09: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=4046#article","isPartOf":{"@id":"https:\/\/www.pirhome.com\/?p=4046"},"author":{"name":"nic@nicsky.com","@id":"http:\/\/www.pirhome.com\/#\/schema\/person\/41049b5236f9c77c9314997d070db3e3"},"headline":"PIR Dog Bark Stopper (Ultrasonic Deterrent)","datePublished":"2026-04-12T09:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pirhome.com\/?p=4046"},"wordCount":413,"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=4046#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pirhome.com\/?p=4046","url":"https:\/\/www.pirhome.com\/?p=4046","name":"PIR Dog Bark Stopper (Ultrasonic Deterrent) - PIRHOME","isPartOf":{"@id":"http:\/\/www.pirhome.com\/#website"},"datePublished":"2026-04-12T09:00:00+00:00","breadcrumb":{"@id":"https:\/\/www.pirhome.com\/?p=4046#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pirhome.com\/?p=4046"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pirhome.com\/?p=4046#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.pirhome.com\/"},{"@type":"ListItem","position":2,"name":"PIR Dog Bark Stopper (Ultrasonic Deterrent)"}]},{"@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\/4046","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=4046"}],"version-history":[{"count":1,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts\/4046\/revisions"}],"predecessor-version":[{"id":4351,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts\/4046\/revisions\/4351"}],"wp:attachment":[{"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4046"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4046"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4046"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}