{"id":3315,"date":"2026-02-22T00:30:00","date_gmt":"2026-02-22T00:30:00","guid":{"rendered":"https:\/\/pirhome.com\/?p=3314"},"modified":"2026-02-22T00:30:00","modified_gmt":"2026-02-22T00:30:00","slug":"pir-people-counting-techniques","status":"publish","type":"post","link":"http:\/\/www.pirhome.com\/?p=3315","title":{"rendered":"PIR Sensor for People Counting: Techniques and Algorithms"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>Counting people entering and exiting a space is valuable for retail analytics, building occupancy management, and security. While cameras are common, PIR sensors offer a privacy-preserving alternative.<\/p>\n<h2>Challenges of People Counting with PIR<\/h2>\n<ul>\n<li>Single sensor cannot determine direction (entry vs. exit).<\/li>\n<li>Multiple people walking together appear as one event.<\/li>\n<li>Sensor has gaps in coverage.<\/li>\n<li>Signal varies with walking speed and direction.<\/li>\n<\/ul>\n<h2>Method 1: Dual-Sensor Direction Detection<\/h2>\n<p>Two PIR sensors placed side by side with overlapping fields. The order of triggering indicates direction:<\/p>\n<ul>\n<li>Sensor A then Sensor B: moving in one direction (e.g., entry).<\/li>\n<li>Sensor B then Sensor A: opposite direction (exit).<\/li>\n<\/ul>\n<p>This is the most common and reliable method for counting at doorways.<\/p>\n<h3>Implementation<\/h3>\n<pre><code>if (sensorA.triggered() && !sensorB.triggered()) {\n    lastTrigger = A;\n    triggerTimeA = millis();\n}\nif (sensorB.triggered() && !sensorA.triggered()) {\n    if (lastTrigger == A && (millis() - triggerTimeA) < maxDelay) {\n        if (directionFlag) count++; else count--;\n    }\n    lastTrigger = B;\n}\n<\/code><\/pre>\n<h2>Method 2: Single Sensor with Special Lens<\/h2>\n<p>A single sensor with a specialized lens that creates two separate detection zones can sometimes indicate direction based on signal pattern. This is less reliable.<\/p>\n<h2>Method 3: Sensor Array (2\u00d72)<\/h2>\n<p>Four sensors arranged in a square can track movement across quadrants, enabling more sophisticated counting and even tracking.<\/p>\n<h2>Method 4: Machine Learning on Analog Signal<\/h2>\n<p>With a single analog sensor, researchers have used neural networks to classify patterns and estimate the number of people. This requires extensive training data.<\/p>\n<h2>Signal Features for ML<\/h2>\n<ul>\n<li>Peak amplitude.<\/li>\n<li>Pulse width.<\/li>\n<li>Time between pulses.<\/li>\n<li>Zero-crossing rate.<\/li>\n<li>Energy in frequency bands.<\/li>\n<\/ul>\n<h2>Commercial People Counters Using PIR<\/h2>\n<ul>\n<li><strong>SensMax People Counter:<\/strong> Uses dual PIR sensors.<\/li>\n<li><strong>Echoflex Occupancy Sensor:<\/strong> PIR array.<\/li>\n<li><strong>Irisys:<\/strong> Uses thermal array (not PIR).<\/li>\n<\/ul>\n<h2>Accuracy Expectations<\/h2>\n<p>With dual sensors in a controlled doorway, accuracy can exceed 95%. In open spaces with multiple people, accuracy drops significantly.<\/p>\n<h2>Calibration<\/h2>\n<p>Counting systems need calibration for the specific installation:<\/p>\n<ol>\n<li>Measure sensor placement and field overlap.<\/li>\n<li>Set time windows for direction determination.<\/li>\n<li>Test with known counts and adjust thresholds.<\/li>\n<\/ol>\n<h2>Conclusion<\/h2>\n<p>People counting with PIR is feasible and privacy-friendly. Dual-sensor direction detection is the most practical approach for most applications.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Counting people entering and exiting a space is valuable for retail analytics, building occupancy management, and security. While cameras are common, PIR sensors offer a privacy-preserving alternative. Challenges of People Counting with PIR Single sensor cannot determine direction (entry vs. exit). Multiple people walking together appear as one event. Sensor has gaps in coverage. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-3315","post","type-post","status-publish","format-standard","hentry","category-reference"],"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 Sensor for People Counting: Techniques and Algorithms - 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=3315\" \/>\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 People Counting: Techniques and Algorithms - PIRHOME\" \/>\r\n<meta property=\"og:description\" content=\"Introduction Counting people entering and exiting a space is valuable for retail analytics, building occupancy management, and security. While cameras are common, PIR sensors offer a privacy-preserving alternative. Challenges of People Counting with PIR Single sensor cannot determine direction (entry vs. exit). Multiple people walking together appear as one event. Sensor has gaps in coverage. [&hellip;]\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/www.pirhome.com\/?p=3315\" \/>\r\n<meta property=\"og:site_name\" content=\"PIRHOME\" \/>\r\n<meta property=\"article:published_time\" content=\"2026-02-22T00:30: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=3315#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=3315\"},\"author\":{\"name\":\"nic@nicsky.com\",\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#\\\/schema\\\/person\\\/41049b5236f9c77c9314997d070db3e3\"},\"headline\":\"PIR Sensor for People Counting: Techniques and Algorithms\",\"datePublished\":\"2026-02-22T00:30:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=3315\"},\"wordCount\":314,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#organization\"},\"articleSection\":[\"Reference\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pirhome.com\\\/?p=3315#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=3315\",\"url\":\"https:\\\/\\\/www.pirhome.com\\\/?p=3315\",\"name\":\"PIR Sensor for People Counting: Techniques and Algorithms - PIRHOME\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#website\"},\"datePublished\":\"2026-02-22T00:30:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=3315#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pirhome.com\\\/?p=3315\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=3315#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\\\/\\\/www.pirhome.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PIR Sensor for People Counting: Techniques and Algorithms\"}]},{\"@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\":\"http:\\\/\\\/www.pirhome.com\\\/wp-content\\\/uploads\\\/2026\\\/02\\\/cropped-\u5fae\u4fe1\u56fe\u7247_2026-02-19_222409_472.jpg\",\"contentUrl\":\"http:\\\/\\\/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\":\"http:\\\/\\\/www.pirhome.com\\\/?author=1\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PIR Sensor for People Counting: Techniques and Algorithms - 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=3315","og_locale":"en_US","og_type":"article","og_title":"PIR Sensor for People Counting: Techniques and Algorithms - PIRHOME","og_description":"Introduction Counting people entering and exiting a space is valuable for retail analytics, building occupancy management, and security. While cameras are common, PIR sensors offer a privacy-preserving alternative. Challenges of People Counting with PIR Single sensor cannot determine direction (entry vs. exit). Multiple people walking together appear as one event. Sensor has gaps in coverage. [&hellip;]","og_url":"https:\/\/www.pirhome.com\/?p=3315","og_site_name":"PIRHOME","article_published_time":"2026-02-22T00:30: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=3315#article","isPartOf":{"@id":"https:\/\/www.pirhome.com\/?p=3315"},"author":{"name":"nic@nicsky.com","@id":"http:\/\/www.pirhome.com\/#\/schema\/person\/41049b5236f9c77c9314997d070db3e3"},"headline":"PIR Sensor for People Counting: Techniques and Algorithms","datePublished":"2026-02-22T00:30:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pirhome.com\/?p=3315"},"wordCount":314,"commentCount":0,"publisher":{"@id":"http:\/\/www.pirhome.com\/#organization"},"articleSection":["Reference"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pirhome.com\/?p=3315#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pirhome.com\/?p=3315","url":"https:\/\/www.pirhome.com\/?p=3315","name":"PIR Sensor for People Counting: Techniques and Algorithms - PIRHOME","isPartOf":{"@id":"http:\/\/www.pirhome.com\/#website"},"datePublished":"2026-02-22T00:30:00+00:00","breadcrumb":{"@id":"https:\/\/www.pirhome.com\/?p=3315#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pirhome.com\/?p=3315"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pirhome.com\/?p=3315#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.pirhome.com\/"},{"@type":"ListItem","position":2,"name":"PIR Sensor for People Counting: Techniques and Algorithms"}]},{"@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":"http:\/\/www.pirhome.com\/wp-content\/uploads\/2026\/02\/cropped-\u5fae\u4fe1\u56fe\u7247_2026-02-19_222409_472.jpg","contentUrl":"http:\/\/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":"http:\/\/www.pirhome.com\/?author=1"}]}},"_links":{"self":[{"href":"http:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts\/3315","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3315"}],"version-history":[{"count":1,"href":"http:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts\/3315\/revisions"}],"predecessor-version":[{"id":3346,"href":"http:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts\/3315\/revisions\/3346"}],"wp:attachment":[{"href":"http:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3315"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}