{"id":4142,"date":"2026-05-16T09:00:00","date_gmt":"2026-05-16T09:00:00","guid":{"rendered":"https:\/\/pirhome.com\/?p=3927"},"modified":"2026-05-16T09:00:00","modified_gmt":"2026-05-16T09:00:00","slug":"pir-rv-security-system","status":"publish","type":"post","link":"https:\/\/www.pirhome.com\/?p=4142","title":{"rendered":"PIR Sensor for RV Security System"},"content":{"rendered":"<h2>Project Overview<\/h2>\n<p>This project creates a low-power security system specifically designed for RVs, motorhomes, and campers. When motion is detected inside or around your vehicle, the system sends an SMS alert to your phone and can trigger an alarm. The system is designed for low power consumption to preserve battery when off-grid.<\/p>\n<p><strong>Difficulty:<\/strong> Intermediate<br \/>\n<strong>Estimated time:<\/strong> 2-3 hours<br \/>\n<strong>Estimated cost:<\/strong> $35-50<\/p>\n<h2>How It Works<\/h2>\n<p>One or more PIR sensors monitor entry points and interior of the RV. When motion is detected, the ESP32 wakes from p, sends an SMS via GSM module, sounds a siren, and logs the event. The system uses p to conserve battery.<\/p>\n<h2>Materials Needed<\/h2>\n<ul>\n<li>ESP32 (1)<\/li>\n<li>HC-SR501 PIR sensors (2-3)<\/li>\n<li>SIM800L GSM module (1)<\/li>\n<li>SIM card with SMS capability<\/li>\n<li>Buzzer or small siren<\/li>\n<li>12V to 5V converter for RV power<\/li>\n<li>Battery pack (3&#215;18650) for off-grid<\/li>\n<li>TP4056 charging module<\/li>\n<li>Waterproof enclosure for exterior sensor<\/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>ESP32 Pin<\/th>\n<\/thead>\n<tbody>\n<th>Interior PIR<\/th>\n<p> OUT<\/th>\n<p> GPIO 4<\/th>\n<th>Exterior PIR<\/th>\n<p> OUT<\/th>\n<p> GPIO 5<\/th>\n<th>SIM800L TX<\/th>\n<p> &#8211;<\/th>\n<p> GPIO 16<\/th>\n<th>SIM800L RX<\/th>\n<p> &#8211;<\/th>\n<p> GPIO 17<\/th>\n<th>Buzzer\/Siren<\/th>\n<p> Positive<\/th>\n<p> GPIO 2<\/th>\n<th>Status LED<\/th>\n<p> Anode<\/th>\n<p> GPIO 15<\/th>\n<\/tbody>\n<p>\u8868<\/p>\n<h2>Arduino Code<\/h2>\n<pre><code>\/\/ RV Security System with SMS Alerts\n#include &lt;WiFi.h&gt;\n#include &lt;SoftwareSerial.h&gt;\n\nconst int interiorPirPin = 4;\nconst int exteriorPirPin = 5;\nconst int sirenPin = 2;\nconst int ledPin = 15;\n\nSoftwareSerial gsm(16, 17);\n\nconst char* phoneNumber = \"+1234567890\";\nbool armed = true;\nunsigned long lastAlertTime = 0;\nconst unsigned long alertCooldown = 600000;\n\nvoid setup() {\n  Serial.begin(115200);\n  gsm.begin(9600);\n  \n  pinMode(interiorPirPin, INPUT);\n  pinMode(exteriorPirPin, INPUT);\n  pinMode(sirenPin, OUTPUT);\n  pinMode(ledPin, OUTPUT);\n  \n  digitalWrite(sirenPin, LOW);\n  digitalWrite(ledPin, LOW);\n  \n  sendATCommand(\"AT\", 1000);\n  sendATCommand(\"AT+CMGF=1\", 1000);\n  sendATCommand(\"AT+CNMI=2,2,0,0,0\", 1000);\n  \n  delay(60000);\n  sendSMS(\"RV Security System ONLINE\");\n}\n\nvoid sendATCommand(String cmd, int timeout) {\n  gsm.println(cmd);\n  delay(timeout);\n  while (gsm.available()) Serial.write(gsm.read());\n}\n\nvoid sendSMS(String message) {\n  gsm.print(\"AT+CMGS=\\\"\");\n  gsm.print(phoneNumber);\n  gsm.println(\"\\\"\");\n  delay(500);\n  gsm.print(message);\n  delay(500);\n  gsm.write(26);\n  delay(3000);\n}\n\nvoid activateAlarm(String location) {\n  if (millis() - lastAlertTime > alertCooldown) {\n    lastAlertTime = millis();\n    \n    String msg = \"ALERT: Motion detected at \" + location + \" in your RV!\";\n    sendSMS(msg);\n    \n    if (armed) {\n      for (int i = 0; i < 10; i++) {\n        digitalWrite(sirenPin, HIGH);\n        digitalWrite(ledPin, HIGH);\n        delay(200);\n        digitalWrite(sirenPin, LOW);\n        digitalWrite(ledPin, LOW);\n        delay(200);\n      }\n    }\n  }\n}\n\nvoid loop() {\n  bool interiorMotion = digitalRead(interiorPirPin) == HIGH;\n  bool exteriorMotion = digitalRead(exteriorPirPin) == HIGH;\n  \n  if (armed) {\n    if (interiorMotion) activateAlarm(\"Interior\");\n    if (exteriorMotion) activateAlarm(\"Exterior\");\n  }\n  \n  delay(100);\n}\n<\/code><\/pre>\n<h2>Low-Power p Version<\/h2>\n<pre><code>#include &lt;esp_sleep.h&gt;\n\nRTC_DATA_ATTR bool alarmSent = false;\n\nvoid setup() {\n  esp_sleep_enable_ext0_wakeup((gpio_num_t)interiorPirPin, 1);\n  esp_sleep_enable_ext1_wakeup((1ULL << exteriorPirPin), ESP_EXT1_WAKEUP_ANY_HIGH);\n  \n  if (esp_sleep_get_wakeup_cause() != ESP_SLEEP_WAKEUP_UNDEFINED) {\n    bool interior = digitalRead(interiorPirPin) == HIGH;\n    bool exterior = digitalRead(exteriorPirPin) == HIGH;\n    \n    if (!alarmSent) {\n      gsm.begin(9600);\n      sendATCommand(\"AT\", 1000);\n      sendATCommand(\"AT+CMGF=1\", 1000);\n      \n      String location = interior ? \"Interior\" : \"Exterior\";\n      sendSMS(\"ALERT: Motion at \" + location + \" in RV!\");\n      alarmSent = true;\n      \n      for (int i = 0; i < 10; i++) {\n        digitalWrite(ledPin, HIGH);\n        delay(250);\n        digitalWrite(ledPin, LOW);\n        delay(250);\n      }\n    }\n  }\n  \n  if (millis() > 3600000) alarmSent = false;\n  esp_deep_sleep_start();\n}\n<\/code><\/pre>\n<h2>Installation Steps<\/h2>\n<ol>\n<li>Mount interior sensor near main entry door<\/li>\n<li>Mount exterior sensor in weatherproof enclosure outside<\/li>\n<li>Install GSM module with antenna for good reception<\/li>\n<li>Connect to RV 12V system or battery pack<\/li>\n<li>Test each sensor to verify SMS is received<\/li>\n<li>Adjust sensitivity to avoid false triggers<\/li>\n<\/ol>\n<h2>Project Extensions<\/h2>\n<ul>\n<li>Add GPS module to report vehicle location<\/li>\n<li>Add ESP32-CAM to capture images<\/li>\n<li>Control arming via SMS commands<\/li>\n<li>Add temperature sensor for hot\/cold alerts<\/li>\n<li>Add gas leak detection for safety<\/li>\n<li>Add solar panel for off-grid charging<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>This RV security system provides peace of mind when camping or storing your vehicle with SMS alerts.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Project Overview This project creates a low-power security system specifically designed for RVs, motorhomes, and campers. When motion is detected inside or around your vehicle, the system sends an SMS alert to your phone and can trigger an alarm. The system is designed for low power consumption to preserve battery when off-grid. Difficulty: Intermediate 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-4142","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 RV Security System - 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=4142\" \/>\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 RV Security System - PIRHOME\" \/>\r\n<meta property=\"og:description\" content=\"Project Overview This project creates a low-power security system specifically designed for RVs, motorhomes, and campers. When motion is detected inside or around your vehicle, the system sends an SMS alert to your phone and can trigger an alarm. The system is designed for low power consumption to preserve battery when off-grid. Difficulty: Intermediate Estimated [&hellip;]\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/www.pirhome.com\/?p=4142\" \/>\r\n<meta property=\"og:site_name\" content=\"PIRHOME\" \/>\r\n<meta property=\"article:published_time\" content=\"2026-05-16T09: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=4142#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4142\"},\"author\":{\"name\":\"nic@nicsky.com\",\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#\\\/schema\\\/person\\\/41049b5236f9c77c9314997d070db3e3\"},\"headline\":\"PIR Sensor for RV Security System\",\"datePublished\":\"2026-05-16T09:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4142\"},\"wordCount\":294,\"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=4142#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4142\",\"url\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4142\",\"name\":\"PIR Sensor for RV Security System - PIRHOME\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#website\"},\"datePublished\":\"2026-05-16T09:00:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4142#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pirhome.com\\\/?p=4142\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4142#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\\\/\\\/www.pirhome.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PIR Sensor for RV Security System\"}]},{\"@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 RV Security System - 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=4142","og_locale":"en_US","og_type":"article","og_title":"PIR Sensor for RV Security System - PIRHOME","og_description":"Project Overview This project creates a low-power security system specifically designed for RVs, motorhomes, and campers. When motion is detected inside or around your vehicle, the system sends an SMS alert to your phone and can trigger an alarm. The system is designed for low power consumption to preserve battery when off-grid. Difficulty: Intermediate Estimated [&hellip;]","og_url":"https:\/\/www.pirhome.com\/?p=4142","og_site_name":"PIRHOME","article_published_time":"2026-05-16T09: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=4142#article","isPartOf":{"@id":"https:\/\/www.pirhome.com\/?p=4142"},"author":{"name":"nic@nicsky.com","@id":"http:\/\/www.pirhome.com\/#\/schema\/person\/41049b5236f9c77c9314997d070db3e3"},"headline":"PIR Sensor for RV Security System","datePublished":"2026-05-16T09:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pirhome.com\/?p=4142"},"wordCount":294,"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=4142#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pirhome.com\/?p=4142","url":"https:\/\/www.pirhome.com\/?p=4142","name":"PIR Sensor for RV Security System - PIRHOME","isPartOf":{"@id":"http:\/\/www.pirhome.com\/#website"},"datePublished":"2026-05-16T09:00:00+00:00","breadcrumb":{"@id":"https:\/\/www.pirhome.com\/?p=4142#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pirhome.com\/?p=4142"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pirhome.com\/?p=4142#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.pirhome.com\/"},{"@type":"ListItem","position":2,"name":"PIR Sensor for RV Security System"}]},{"@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\/4142","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=4142"}],"version-history":[{"count":1,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts\/4142\/revisions"}],"predecessor-version":[{"id":4666,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts\/4142\/revisions\/4666"}],"wp:attachment":[{"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}