{"id":4131,"date":"2026-05-05T09:00:00","date_gmt":"2026-05-05T09:00:00","guid":{"rendered":"https:\/\/pirhome.com\/?p=3916"},"modified":"2026-05-05T09:00:00","modified_gmt":"2026-05-05T09:00:00","slug":"pir-esp-now-wireless-notification-2","status":"publish","type":"post","link":"https:\/\/www.pirhome.com\/?p=4131","title":{"rendered":"PIR Sensor Wireless Notification System with ESP-NOW"},"content":{"rendered":"<h2>Project Overview<\/h2>\n<p>This project creates a wireless motion notification system that uses ESP-NOW protocol to send alerts between ESP32 boards without requiring a Wi-Fi network. It is perfect for monitoring remote locations like workshops, sheds, or entry gates where Wi-Fi may not reach.<\/p>\n<p><strong>Difficulty:<\/strong> Intermediate<br \/>\n<strong>Estimated time:<\/strong> 2-3 hours<br \/>\n<strong>Estimated cost:<\/strong> $20-30<\/p>\n<h2>How It Works<\/h2>\n<p>Two ESP32 boards communicate via ESP-NOW, a low-power, connectionless protocol. The transmitter unit has a PIR sensor. When motion is detected, it sends a packet to the receiver unit. The receiver unit displays an alert via LED, buzzer, or LCD, and can also send notifications to a phone via Wi-Fi if available.<\/p>\n<h2>Materials Needed<\/h2>\n<ul>\n<li>ESP32 development boards (2)<\/li>\n<li>HC-SR501 PIR sensor (1)<\/li>\n<li>LED for alert indication<\/li>\n<li>Buzzer (optional)<\/li>\n<li>LCD 16&#215;2 with I2C (optional)<\/li>\n<li>220\u03a9 resistors for LEDs<\/li>\n<li>Jumper wires<\/li>\n<li>Power supplies (5V USB or batteries)<\/li>\n<li>Enclosures for weatherproofing<\/li>\n<\/ul>\n<h2>Get MAC Addresses<\/h2>\n<p>Upload this code to both ESP32 boards to get their MAC addresses:<\/p>\n<pre><code>#include &lt;WiFi.h&gt;\n\nvoid setup() {\n  Serial.begin(115200);\n  WiFi.mode(WIFI_STA);\n  Serial.print(\"MAC Address: \");\n  Serial.println(WiFi.macAddress());\n}\n\nvoid loop() {}\n<\/code><\/pre>\n<p>Note the MAC address of the receiver board for the transmitter code.<\/p>\n<h2>Transmitter Code<\/h2>\n<pre><code>\/\/ ESP-NOW Motion Sensor Transmitter\n#include &lt;esp_now.h&gt;\n#include &lt;WiFi.h&gt;\n\nconst int pirPin = 4;\nconst int ledPin = 2;\n\n\/\/ Replace with receiver's MAC address\nuint8_t receiverAddress[] = {0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX};\n\ntypedef struct struct_message {\n  int motionDetected;\n  int sensorId;\n  unsigned long timestamp;\n} struct_message;\n\nstruct_message motionData;\n\nunsigned long lastSendTime = 0;\nconst unsigned long sendCooldown = 5000;\n\nvoid OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) {\n  digitalWrite(ledPin, status == ESP_NOW_SEND_SUCCESS ? HIGH : LOW);\n  delay(100);\n  digitalWrite(ledPin, LOW);\n}\n\nvoid setup() {\n  Serial.begin(115200);\n  pinMode(pirPin, INPUT);\n  pinMode(ledPin, OUTPUT);\n  digitalWrite(ledPin, LOW);\n  \n  WiFi.mode(WIFI_STA);\n  \n  esp_now_init();\n  esp_now_register_send_cb(OnDataSent);\n  \n  esp_now_peer_info_t peerInfo;\n  memcpy(peerInfo.peer_addr, receiverAddress, 6);\n  peerInfo.channel = 0;\n  peerInfo.encrypt = false;\n  esp_now_add_peer(&peerInfo);\n  \n  delay(60000);\n}\n\nvoid loop() {\n  bool motion = digitalRead(pirPin) == HIGH;\n  \n  if (motion && (millis() - lastSendTime > sendCooldown)) {\n    motionData.motionDetected = 1;\n    motionData.sensorId = 1;\n    motionData.timestamp = millis();\n    \n    esp_now_send(receiverAddress, (uint8_t *) &motionData, sizeof(motionData));\n    lastSendTime = millis();\n  }\n  \n  delay(100);\n}\n<\/code><\/pre>\n<h2>Receiver Code<\/h2>\n<pre><code>\/\/ ESP-NOW Motion Sensor Receiver\n#include &lt;esp_now.h&gt;\n#include &lt;WiFi.h&gt;\n#include &lt;Wire.h&gt;\n#include &lt;LiquidCrystal_I2C.h&gt;\n\nLiquidCrystal_I2C lcd(0x27, 16, 2);\n\nconst int alertLedPin = 2;\nconst int buzzerPin = 5;\n\nunsigned long lastAlertTime = 0;\nconst unsigned long alertDuration = 5000;\n\nbool alertActive = false;\nint lastMotionCount = 0;\n\ntypedef struct struct_message {\n  int motionDetected;\n  int sensorId;\n  unsigned long timestamp;\n} struct_message;\n\nstruct_message motionData;\n\nvoid OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) {\n  memcpy(&motionData, incomingData, sizeof(motionData));\n  \n  lastMotionCount++;\n  lastAlertTime = millis();\n  alertActive = true;\n  \n  digitalWrite(alertLedPin, HIGH);\n  tone(buzzerPin, 2000, 500);\n  \n  lcd.clear();\n  lcd.setCursor(0, 0);\n  lcd.print(\"Motion detected!\");\n  lcd.setCursor(0, 1);\n  lcd.print(\"Count: \");\n  lcd.print(lastMotionCount);\n}\n\nvoid setup() {\n  Serial.begin(115200);\n  pinMode(alertLedPin, OUTPUT);\n  pinMode(buzzerPin, OUTPUT);\n  digitalWrite(alertLedPin, LOW);\n  \n  lcd.init();\n  lcd.backlight();\n  lcd.print(\"ESP-NOW Monitor\");\n  lcd.setCursor(0, 1);\n  lcd.print(\"Ready\");\n  \n  WiFi.mode(WIFI_STA);\n  \n  esp_now_init();\n  esp_now_register_recv_cb(OnDataRecv);\n}\n\nvoid loop() {\n  if (alertActive && (millis() - lastAlertTime > alertDuration)) {\n    digitalWrite(alertLedPin, LOW);\n    alertActive = false;\n    lcd.clear();\n    lcd.setCursor(0, 0);\n    lcd.print(\"System Ready\");\n    lcd.setCursor(0, 1);\n    lcd.print(\"Total: \");\n    lcd.print(lastMotionCount);\n  }\n  \n  delay(100);\n}\n<\/code><\/pre>\n<h2>Power-Saving Deep Sleep Version<\/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  \/\/ Send notification then deep sleep\n  esp_deep_sleep_start();\n}\n<\/code><\/pre>\n<h2>Installation Steps<\/h2>\n<ol>\n<li>Get MAC addresses of both boards<\/li>\n<li>Update receiver MAC address in transmitter code<\/li>\n<li>Upload transmitter and receiver code to respective boards<\/li>\n<li>Test communication within range<\/li>\n<li>Mount transmitter unit at desired monitoring location<\/li>\n<li>Place receiver unit where you can see\/hear alerts<\/li>\n<\/ol>\n<h2>Project Extensions<\/h2>\n<ul>\n<li>Add Wi-Fi gateway to forward alerts to phone<\/li>\n<li>Add SD card module to log events<\/li>\n<li>Add DS18B20 to send temperature data<\/li>\n<li>Add voltage divider to send battery level<\/li>\n<li>Add multiple receivers for larger coverage<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>This ESP-NOW wireless notification system provides a low-power, long-range solution for monitoring remote locations without Wi-Fi.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Project Overview This project creates a wireless motion notification system that uses ESP-NOW protocol to send alerts between ESP32 boards without requiring a Wi-Fi network. It is perfect for monitoring remote locations like workshops, sheds, or entry gates where Wi-Fi may not reach. Difficulty: Intermediate Estimated time: 2-3 hours Estimated cost: $20-30 How It Works [&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-4131","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 Wireless Notification System with ESP-NOW - 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=4131\" \/>\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 Wireless Notification System with ESP-NOW - PIRHOME\" \/>\r\n<meta property=\"og:description\" content=\"Project Overview This project creates a wireless motion notification system that uses ESP-NOW protocol to send alerts between ESP32 boards without requiring a Wi-Fi network. It is perfect for monitoring remote locations like workshops, sheds, or entry gates where Wi-Fi may not reach. Difficulty: Intermediate Estimated time: 2-3 hours Estimated cost: $20-30 How It Works [&hellip;]\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/www.pirhome.com\/?p=4131\" \/>\r\n<meta property=\"og:site_name\" content=\"PIRHOME\" \/>\r\n<meta property=\"article:published_time\" content=\"2026-05-05T09: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=4131#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4131\"},\"author\":{\"name\":\"nic@nicsky.com\",\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/#\\\/schema\\\/person\\\/41049b5236f9c77c9314997d070db3e3\"},\"headline\":\"PIR Sensor Wireless Notification System with ESP-NOW\",\"datePublished\":\"2026-05-05T09:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4131\"},\"wordCount\":280,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/#organization\"},\"articleSection\":[\"Projects\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pirhome.com\\\/?p=4131#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4131\",\"url\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4131\",\"name\":\"PIR Sensor Wireless Notification System with ESP-NOW - PIRHOME\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/#website\"},\"datePublished\":\"2026-05-05T09:00:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4131#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pirhome.com\\\/?p=4131\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4131#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pirhome.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PIR Sensor Wireless Notification System with ESP-NOW\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/#website\",\"url\":\"https:\\\/\\\/www.pirhome.com\\\/\",\"name\":\"PIRHOME\",\"description\":\"PIR &amp; Motion Sensor\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pirhome.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/#organization\",\"name\":\"PIRHOME\",\"url\":\"https:\\\/\\\/www.pirhome.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/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\":\"https:\\\/\\\/www.pirhome.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/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 Wireless Notification System with ESP-NOW - 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=4131","og_locale":"en_US","og_type":"article","og_title":"PIR Sensor Wireless Notification System with ESP-NOW - PIRHOME","og_description":"Project Overview This project creates a wireless motion notification system that uses ESP-NOW protocol to send alerts between ESP32 boards without requiring a Wi-Fi network. It is perfect for monitoring remote locations like workshops, sheds, or entry gates where Wi-Fi may not reach. Difficulty: Intermediate Estimated time: 2-3 hours Estimated cost: $20-30 How It Works [&hellip;]","og_url":"https:\/\/www.pirhome.com\/?p=4131","og_site_name":"PIRHOME","article_published_time":"2026-05-05T09: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=4131#article","isPartOf":{"@id":"https:\/\/www.pirhome.com\/?p=4131"},"author":{"name":"nic@nicsky.com","@id":"https:\/\/www.pirhome.com\/#\/schema\/person\/41049b5236f9c77c9314997d070db3e3"},"headline":"PIR Sensor Wireless Notification System with ESP-NOW","datePublished":"2026-05-05T09:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pirhome.com\/?p=4131"},"wordCount":280,"commentCount":0,"publisher":{"@id":"https:\/\/www.pirhome.com\/#organization"},"articleSection":["Projects"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pirhome.com\/?p=4131#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pirhome.com\/?p=4131","url":"https:\/\/www.pirhome.com\/?p=4131","name":"PIR Sensor Wireless Notification System with ESP-NOW - PIRHOME","isPartOf":{"@id":"https:\/\/www.pirhome.com\/#website"},"datePublished":"2026-05-05T09:00:00+00:00","breadcrumb":{"@id":"https:\/\/www.pirhome.com\/?p=4131#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pirhome.com\/?p=4131"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pirhome.com\/?p=4131#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pirhome.com\/"},{"@type":"ListItem","position":2,"name":"PIR Sensor Wireless Notification System with ESP-NOW"}]},{"@type":"WebSite","@id":"https:\/\/www.pirhome.com\/#website","url":"https:\/\/www.pirhome.com\/","name":"PIRHOME","description":"PIR &amp; Motion Sensor","publisher":{"@id":"https:\/\/www.pirhome.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pirhome.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.pirhome.com\/#organization","name":"PIRHOME","url":"https:\/\/www.pirhome.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/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":"https:\/\/www.pirhome.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/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\/4131","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=4131"}],"version-history":[{"count":1,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts\/4131\/revisions"}],"predecessor-version":[{"id":4650,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts\/4131\/revisions\/4650"}],"wp:attachment":[{"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}