{"id":3660,"date":"2023-07-04T02:15:46","date_gmt":"2023-07-04T02:15:46","guid":{"rendered":"https:\/\/projectkitsandparts.com\/?p=3660"},"modified":"2023-08-31T04:07:09","modified_gmt":"2023-08-31T04:07:09","slug":"pir-sensor-interfacing-with-arduino","status":"publish","type":"post","link":"https:\/\/projectkitsandparts.com\/index.php\/2023\/07\/04\/pir-sensor-interfacing-with-arduino\/","title":{"rendered":"PIR sensor Interfacing With Arduino"},"content":{"rendered":"\n<p class=\"has-vivid-cyan-blue-color has-text-color\"><strong>Introduction to PIR Sensor:<\/strong><\/p>\n\n\n\n<p>A PIR sensor is a device that can detect the presence of humans or animals by measuring the infrared radiation emitted by their bodies. It is commonly used in security systems, motion-activated lighting, and other applications that require motion detection.<\/p>\n\n\n\n<figure class=\"wp-block-image size-medium\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"291\" src=\"https:\/\/projectkitsandparts.com\/wp-content\/uploads\/2023\/08\/PIR-module-300x291.jpg\" alt=\"\" class=\"wp-image-3661\" srcset=\"https:\/\/projectkitsandparts.com\/wp-content\/uploads\/2023\/08\/PIR-module-300x291.jpg 300w, https:\/\/projectkitsandparts.com\/wp-content\/uploads\/2023\/08\/PIR-module.jpg 499w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/figure>\n\n\n\n<p class=\"has-vivid-cyan-blue-color has-text-color\"><strong>Working Principle:<\/strong><\/p>\n\n\n\n<p>A PIR sensor detects changes in infrared radiation within its field of view. The sensor consists of two halves, each containing a pyroelectric sensor. When an object emits infrared radiation, the sensor detects the difference in heat between the two halves, triggering an output signal.<\/p>\n\n\n\n<p class=\"has-vivid-cyan-blue-color has-text-color\"><strong>Specification of PIR Sensor:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Detection range: up to 7 meters<\/li>\n\n\n\n<li>Detection angle: 110 degrees<\/li>\n\n\n\n<li>Operating voltage: DC 4.5V &#8211; 12V DC<\/li>\n\n\n\n<li>Output signal: 3.3V digital output<\/li>\n\n\n\n<li>Delay time: adjustable from 0.3 seconds to 5 minutes<\/li>\n\n\n\n<li>Operating temperature: -15\u00b0C to +70\u00b0C<\/li>\n\n\n\n<li>Sensitivity: Adjustable<\/li>\n\n\n\n<li>&nbsp;<\/li>\n<\/ul>\n\n\n\n<p class=\"has-vivid-cyan-blue-color has-text-color\"><strong>Adjusting PIR Sensor Sensitivity:<\/strong><\/p>\n\n\n\n<p>Some PIR sensors have a sensitivity adjustment potentiometer. By adjusting this potentiometer, you can control the detection range and sensitivity of the sensor.<\/p>\n\n\n\n<p class=\"has-vivid-cyan-blue-color has-text-color\"><strong>Components Required<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\" type=\"1\">\n<li>Arduino UNO<\/li>\n\n\n\n<li>PIR Sensor<\/li>\n\n\n\n<li>Power supply&nbsp;<\/li>\n\n\n\n<li>Connecting wires<\/li>\n<\/ol>\n\n\n\n<p class=\"has-vivid-cyan-blue-color has-text-color\"><strong>Hardware Connections:<\/strong><\/p>\n\n\n\n<p>To connect the PIR sensor to an Arduino board, follow these steps:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<ol class=\"wp-block-list\" type=\"1\">\n<li>VCC pin&#8211;5V pin of the Arduino board.<\/li>\n\n\n\n<li>&nbsp;GND pin&#8211;GND pin of the Arduino board.<\/li>\n<\/ol>\n\n\n\n<p>&nbsp;     3. OUT pin&#8211;Connect it to digital pin 9 of the Arduino.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-luminous-vivid-amber-color has-text-color\">Circuit Connection:<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/projectkitsandparts.com\/wp-content\/uploads\/2023\/08\/PIR-sensor-connection-1024x547.png\" alt=\"\" class=\"wp-image-3662\" style=\"width:840px;height:448px\" width=\"840\" height=\"448\" srcset=\"https:\/\/projectkitsandparts.com\/wp-content\/uploads\/2023\/08\/PIR-sensor-connection-1024x547.png 1024w, https:\/\/projectkitsandparts.com\/wp-content\/uploads\/2023\/08\/PIR-sensor-connection-300x160.png 300w, https:\/\/projectkitsandparts.com\/wp-content\/uploads\/2023\/08\/PIR-sensor-connection-768x410.png 768w, https:\/\/projectkitsandparts.com\/wp-content\/uploads\/2023\/08\/PIR-sensor-connection-600x320.png 600w, https:\/\/projectkitsandparts.com\/wp-content\/uploads\/2023\/08\/PIR-sensor-connection.png 1116w\" sizes=\"auto, (max-width: 840px) 100vw, 840px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">CODE:<\/h2>\n\n\n\n<p>int pirPin = 9; \u00a0\u00a0\u00a0\u00a0<a href=\"https:\/\/projectkitsandparts.com\/\">\/\/projectkitsandparts.com\/<\/a> develop by Surabhi.N.Bhivsenkar<\/p>\n\n\n\n<p>void setup() {<\/p>\n\n\n\n<p>&nbsp; Serial.begin(9600);<\/p>\n\n\n\n<p>&nbsp; pinMode(pirPin, INPUT);<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>void loop() {<\/p>\n\n\n\n<p>&nbsp; int motion = digitalRead(pirPin);<\/p>\n\n\n\n<p>&nbsp; if (motion == HIGH) {<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp; Serial.println(&#8220;Motion detected!&#8221;);<\/p>\n\n\n\n<p>&nbsp; } else {<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp; Serial.println(&#8220;No motion detected.&#8221;);<\/p>\n\n\n\n<p>&nbsp; }<\/p>\n\n\n\n<p>&nbsp; delay(1000);<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Code Explanation:<\/strong><\/p>\n\n\n\n<p>1&nbsp; In the `setup()` function, we initialize the serial communication at a baud rate of 9600 and set the PIR pin as an input.<\/p>\n\n\n\n<p>2&nbsp; &nbsp;In the `loop()` function, we read the state of the PIR sensor using `digitalRead(pirPin)`. If motion is detected (the PIR sensor outputs a HIGH signal), it prints &#8220;Motion detected!&#8221; to the serial monitor. Otherwise, it prints &#8220;No motion detected.&#8221;<\/p>\n\n\n\n<p>3 &nbsp;We introduce a delay of 1 second between readings using `delay(1000)`.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">OUTPUT<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/projectkitsandparts.com\/wp-content\/uploads\/2023\/08\/PIR-sensor-output-1024x576.jpg\" alt=\"\" class=\"wp-image-3663\" srcset=\"https:\/\/projectkitsandparts.com\/wp-content\/uploads\/2023\/08\/PIR-sensor-output-1024x576.jpg 1024w, https:\/\/projectkitsandparts.com\/wp-content\/uploads\/2023\/08\/PIR-sensor-output-300x169.jpg 300w, https:\/\/projectkitsandparts.com\/wp-content\/uploads\/2023\/08\/PIR-sensor-output-768x432.jpg 768w, https:\/\/projectkitsandparts.com\/wp-content\/uploads\/2023\/08\/PIR-sensor-output-600x337.jpg 600w, https:\/\/projectkitsandparts.com\/wp-content\/uploads\/2023\/08\/PIR-sensor-output.jpg 1366w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Introduction to PIR Sensor: A PIR sensor is a device that can detect the presence of humans or animals by measuring the infrared radiation emitted by their bodies. It is commonly used in security systems, motion-activated lighting, and other applications that require motion detection. Working Principle: A PIR sensor detects changes in infrared radiation within &hellip; <a href=\"https:\/\/projectkitsandparts.com\/index.php\/2023\/07\/04\/pir-sensor-interfacing-with-arduino\/\" class=\"more-link\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":3664,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[415],"tags":[429,418,435,432,443,444,430],"class_list":["post-3660","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","tag-arduino","tag-arduino-uno","tag-cool-mad-kits","tag-dolphin-labs","tag-pir","tag-pir-interface","tag-project-kits"],"_links":{"self":[{"href":"https:\/\/projectkitsandparts.com\/index.php\/wp-json\/wp\/v2\/posts\/3660","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/projectkitsandparts.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/projectkitsandparts.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/projectkitsandparts.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/projectkitsandparts.com\/index.php\/wp-json\/wp\/v2\/comments?post=3660"}],"version-history":[{"count":4,"href":"https:\/\/projectkitsandparts.com\/index.php\/wp-json\/wp\/v2\/posts\/3660\/revisions"}],"predecessor-version":[{"id":3735,"href":"https:\/\/projectkitsandparts.com\/index.php\/wp-json\/wp\/v2\/posts\/3660\/revisions\/3735"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/projectkitsandparts.com\/index.php\/wp-json\/wp\/v2\/media\/3664"}],"wp:attachment":[{"href":"https:\/\/projectkitsandparts.com\/index.php\/wp-json\/wp\/v2\/media?parent=3660"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/projectkitsandparts.com\/index.php\/wp-json\/wp\/v2\/categories?post=3660"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/projectkitsandparts.com\/index.php\/wp-json\/wp\/v2\/tags?post=3660"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}