{"id":42413,"date":"2021-06-29T11:58:58","date_gmt":"2021-06-29T09:58:58","guid":{"rendered":"https:\/\/botland.com.pl\/blog\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\/"},"modified":"2024-04-04T09:52:55","modified_gmt":"2024-04-04T07:52:55","slug":"esp32-connection-with-sr501-pir-motion-detector-oled-screen","status":"publish","type":"post","link":"https:\/\/botland.store\/blog\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\/","title":{"rendered":"ESP32 &#8211; connection with SR501 PIR motion detector &#038; OLED screen"},"content":{"rendered":"<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Reading time:<\/span> <span class=\"rt-time\"> 2<\/span> <span class=\"rt-label rt-postfix\">min.<\/span><\/span>\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"42413\" class=\"elementor elementor-42413 elementor-25615\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-6a28535d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"6a28535d\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-10aa0bd4\" data-id=\"10aa0bd4\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-26cccc4 elementor-widget elementor-widget-text-editor\" data-id=\"26cccc4\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><strong>Another ESP32<\/strong> series tutorial. This time we will connect a PIR motion sensor and an OLED display. The motion sensor can be successfully used as a component to for example turn on the light or turn on the alarm when motion is detected. We will also use the OLED display, which we have also used in previous articles, on which we will display information when motion is detected. In this article we will also use an LED that will be switched on when movement is detected by the SR501 PIR sensor.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9666e79 elementor-widget elementor-widget-heading\" data-id=\"9666e79\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">What will you need to create the project?<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-19e9760 elementor-widget elementor-widget-text-editor\" data-id=\"19e9760\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>To complete the project we will need an ESP32 module, an SR501 PIR sensor, an LED and an OLED display. All necessary accessories can also be found in the kit we prepared with the ESP32 module.<br \/>The full list of components used can be found below:<\/p><ul style=\"font-size: 16px; background-color: #ffffff;\"><li style=\"font-size: 16px;\"><span style=\"font-weight: bold;\"><a href=\"https:\/\/botland.store\/esp32-wifi-and-bt-modules\/8893-esp32-wifi-bt-42-platform-with-module.html\" data-wpel-link=\"internal\">ESP32 module<\/a><\/span><\/li><li style=\"font-size: 16px;\"><span style=\"font-weight: bold;\"><a href=\"https:\/\/botland.store\/motion-sensors\/1655-pir-hc-sr501-motion-detector-green-5903351241359.html\" data-wpel-link=\"internal\">SR501 PIR motion sensor<\/a><\/span><\/li><li style=\"font-size: 16px;\"><span style=\"font-weight: bold;\"><a href=\"https:\/\/botland.store\/oled-displays\/8867-oled-blue-graphic-display-13-128x64px-i2c-v2-blue-characters-5903351241182.html\" data-wpel-link=\"internal\">OLED 1.3\u2033 display<\/a><\/span><\/li><li style=\"font-size: 16px;\"><span style=\"font-weight: bold;\"><a href=\"https:\/\/botland.store\/through-hole-resistors-tht\/4544-tht-cf-carbon-resistor-14w-330-30pcs.html\" data-wpel-link=\"internal\">330 \u03a9 resistor<\/a><\/span><\/li><li style=\"font-size: 16px;\"><span style=\"font-weight: bold;\"><a href=\"https:\/\/botland.store\/82-various-wires\" data-wpel-link=\"internal\">Male-to-male and female-to-male connection wires<\/a><\/span><\/li><li style=\"font-size: 16px;\"><span style=\"font-weight: bold;\"><a href=\"https:\/\/botland.store\/476-usb-20-cables\" data-wpel-link=\"internal\">MicroUSB cable<\/a><\/span><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9449ddd elementor-widget elementor-widget-heading\" data-id=\"9449ddd\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">ESP32 - connecting components<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7601f57 elementor-widget elementor-widget-text-editor\" data-id=\"7601f57\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Due to its design, the SR501 PIR motion sensor cannot be just plugged into a contact board, so we connected it to the ESP32 using female-to-male wires. PIR communicates through a digital pin. It is powered by 5 V, but it can also be done by pin on the jumper to which the 3.3 V voltage regulator has been pulled up. The sensor is connected to pin 4. The LED should be connected using a 330 \u03a9 resistor to pin 2, and the display respectively to I2C pins 21 and 22.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-6d3a7bd elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"6d3a7bd\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-inner-column elementor-element elementor-element-3e319f4\" data-id=\"3e319f4\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-4199ed1 elementor-widget elementor-widget-image\" data-id=\"4199ed1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/123.jpg\" data-elementor-open-lightbox=\"yes\" data-elementor-lightbox-title=\"123\" data-e-action-hash=\"#elementor-action%3Aaction%3Dlightbox%26settings%3DeyJpZCI6Nzc5NzUsInVybCI6Imh0dHBzOlwvXC9ib3RsYW5kLnN0b3JlXC9ibG9nXC93cC1jb250ZW50XC91cGxvYWRzXC8yMDIxXC8wNlwvMTIzLmpwZyJ9\" data-wpel-link=\"internal\">\n\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"800\" height=\"611\" src=\"https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/123-1024x782.jpg\" class=\"attachment-large size-large wp-image-77975\" alt=\"\" srcset=\"https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/123-1024x782.jpg 1024w, https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/123-300x229.jpg 300w, https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/123-768x587.jpg 768w, https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/123.jpg 1080w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-inner-column elementor-element elementor-element-73c519c\" data-id=\"73c519c\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-166a4dd elementor-widget elementor-widget-image\" data-id=\"166a4dd\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/456.jpg\" data-elementor-open-lightbox=\"yes\" data-elementor-lightbox-title=\"456\" data-e-action-hash=\"#elementor-action%3Aaction%3Dlightbox%26settings%3DeyJpZCI6Nzc5NzksInVybCI6Imh0dHBzOlwvXC9ib3RsYW5kLnN0b3JlXC9ibG9nXC93cC1jb250ZW50XC91cGxvYWRzXC8yMDIxXC8wNlwvNDU2LmpwZyJ9\" data-wpel-link=\"internal\">\n\t\t\t\t\t\t\t<img decoding=\"async\" width=\"800\" height=\"479\" src=\"https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/456-1024x613.jpg\" class=\"attachment-large size-large wp-image-77979\" alt=\"\" srcset=\"https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/456-1024x613.jpg 1024w, https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/456-300x180.jpg 300w, https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/456-768x460.jpg 768w, https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/456.jpg 1482w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<div class=\"elementor-element elementor-element-a32ab73 elementor-widget elementor-widget-spacer\" data-id=\"a32ab73\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"spacer.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-spacer\">\n\t\t\t<div class=\"elementor-spacer-inner\"><\/div>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-cdfc74d elementor-widget elementor-widget-heading\" data-id=\"cdfc74d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Required Arduino libraries<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6fddbc0 elementor-widget elementor-widget-text-editor\" data-id=\"6fddbc0\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>In this project only libraries are required for the OLED display to work properly with the SH1106 controller:<\/p><ul style=\"font-size: 16px; background-color: #ffffff; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;\"><li style=\"font-size: 16px; font-family: Roboto;\"><a href=\"https:\/\/github.com\/nhatuan84\/esp32-sh1106-oled\" target=\"_blank\" rel=\"noopener nofollow external noreferrer\" data-wpel-link=\"external\">https:\/\/github.com\/nhatuan84\/esp32-sh1106-oled<\/a><\/li><li style=\"font-size: 16px; font-family: Roboto;\"><a href=\"https:\/\/github.com\/adafruit\/Adafruit-GFX-Library\" target=\"_blank\" rel=\"noopener nofollow external noreferrer\" data-wpel-link=\"external\">https:\/\/github.com\/adafruit\/Adafruit-GFX-Library<\/a><\/li><\/ul><p>The libraries downloaded as a .zip package are installed in the Arduino IDE environment in Sketch menu.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b011113 elementor-widget elementor-widget-image\" data-id=\"b011113\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/678.jpg\" data-elementor-open-lightbox=\"yes\" data-elementor-lightbox-title=\"678\" data-e-action-hash=\"#elementor-action%3Aaction%3Dlightbox%26settings%3DeyJpZCI6Nzc5ODMsInVybCI6Imh0dHBzOlwvXC9ib3RsYW5kLnN0b3JlXC9ibG9nXC93cC1jb250ZW50XC91cGxvYWRzXC8yMDIxXC8wNlwvNjc4LmpwZyJ9\" data-wpel-link=\"internal\">\n\t\t\t\t\t\t\t<img decoding=\"async\" width=\"800\" height=\"726\" src=\"https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/678.jpg\" class=\"attachment-large size-large wp-image-77983\" alt=\"\" srcset=\"https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/678.jpg 826w, https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/678-300x272.jpg 300w, https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/678-768x697.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0ac51e1 elementor-widget elementor-widget-text-editor\" data-id=\"0ac51e1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>A window will appear where you search for the location of the downloaded packages, then select the .zip library and select the Open button.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2167032 elementor-widget elementor-widget-heading\" data-id=\"2167032\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Program for ESP32 module<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a6a11f3 elementor-widget elementor-widget-text-editor\" data-id=\"a6a11f3\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>After connecting the modules to the ESP32 and uploading the libraries for the OLED display, you can start programming the chip. Following code will make the LED light up when motion is detected and the appropriate message will appear on the OLED screen.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4e26cd0 elementor-widget elementor-widget-code-highlight\" data-id=\"4e26cd0\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp>#include <SPI.h>\r\n#include <Wire.h>\r\n#include <Adafruit_GFX.h>\r\n#include <Adafruit_SH1106.h>\r\n\/\/definiujemy piny I2C, do kt\u00f3rych pod\u0142\u0105czony zosta\u0142 wy\u015bwietlacz\r\n#define OLED_SDA 21\r\n#define OLED_SCL 22\r\n\r\nint inputPin = 4; \/\/definiujemy pin, do kt\u00f3rego pod\u0142\u0105czony zosta\u0142 czujnik ruchu\r\n\r\nAdafruit_SH1106 display(21, 22); \/\/definiujemy piny, do kt\u00f3rych pod\u0142\u0105czony zosta\u0142 wy\u015bwietlacz\r\n\r\nvoid setup() {\r\n  pinMode(inputPin, INPUT);  \/\/deklarujemy pin 4 jako INPUT\r\n  pinMode(2, OUTPUT);  \/\/definiujemy pin, do kt\u00f3rego pod\u0142\u0105czona zosta\u0142a dioda LED i ustawiamy go na OUTPUT\r\n  display.begin(SH1106_SWITCHCAPVCC, 0x3C); \/\/definiujemy rodzaj u\u017cytego wy\u015bwietlacza oraz adres I2C\r\n}\r\n\r\nvoid loop() {\r\n  int val = digitalRead(inputPin);\r\n  \/\/gdy na pinie 4 pojawi si\u0119 stan wysoki, pin 2 przejdzie w stan wysoki i na ekranie pojawi si\u0119 stosowny komunikat\r\n  if (val == HIGH) {\r\n    display.setTextColor(WHITE);\r\n    display.setCursor(0, 0);\r\n    display.println(\"Wykryto ruch!\");\r\n    display.display();\r\n    display.clearDisplay();\r\n    digitalWrite(2, HIGH);\r\n  }\r\n  \/\/gdy na pinie 4 pojawi si\u0119 stan niski, pin 2 przejdzie w stan niski i na ekranie pojawi si\u0119 stosowny komunikat\r\n  else {\r\n    display.setTextColor(WHITE);\r\n    display.setCursor(0, 0);\r\n    display.println(\"Nie wykryto ruchu!\");\r\n    display.display();\r\n    display.clearDisplay();\r\n    digitalWrite(2, LOW);\r\n  }\r\n  delay(1000);\r\n}<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-dc1fee7 elementor-widget elementor-widget-text-editor\" data-id=\"dc1fee7\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>The final result:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-d235f6b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"d235f6b\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-inner-column elementor-element elementor-element-c6acbee\" data-id=\"c6acbee\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-57f5c51 elementor-widget elementor-widget-image\" data-id=\"57f5c51\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/12.jpg\" data-elementor-open-lightbox=\"yes\" data-elementor-lightbox-title=\"12\" data-e-action-hash=\"#elementor-action%3Aaction%3Dlightbox%26settings%3DeyJpZCI6Nzc5ODgsInVybCI6Imh0dHBzOlwvXC9ib3RsYW5kLnN0b3JlXC9ibG9nXC93cC1jb250ZW50XC91cGxvYWRzXC8yMDIxXC8wNlwvMTIuanBnIn0%3D\" data-wpel-link=\"internal\">\n\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"600\" src=\"https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/12.jpg\" class=\"attachment-large size-large wp-image-77988\" alt=\"\" srcset=\"https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/12.jpg 1024w, https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/12-300x225.jpg 300w, https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/12-768x576.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-inner-column elementor-element elementor-element-097cfa3\" data-id=\"097cfa3\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-a9c042e elementor-widget elementor-widget-image\" data-id=\"a9c042e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/13.jpg\" data-elementor-open-lightbox=\"yes\" data-elementor-lightbox-title=\"13\" data-e-action-hash=\"#elementor-action%3Aaction%3Dlightbox%26settings%3DeyJpZCI6Nzc5OTIsInVybCI6Imh0dHBzOlwvXC9ib3RsYW5kLnN0b3JlXC9ibG9nXC93cC1jb250ZW50XC91cGxvYWRzXC8yMDIxXC8wNlwvMTMuanBnIn0%3D\" data-wpel-link=\"internal\">\n\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"600\" src=\"https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/13.jpg\" class=\"attachment-large size-large wp-image-77992\" alt=\"\" srcset=\"https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/13.jpg 1024w, https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/13-300x225.jpg 300w, https:\/\/botland.store\/blog\/wp-content\/uploads\/2021\/06\/13-768x576.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<div class=\"elementor-element elementor-element-27fa370 elementor-widget elementor-widget-text-editor\" data-id=\"27fa370\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>We also invite you to read other articles on our blog!<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Just another tutorial in the ESP32 module series. Today we will be connecting it with PIR motion sensor and OLED display.<\/p>\n","protected":false},"author":10,"featured_media":42414,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[339,341],"tags":[],"class_list":["post-42413","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-electronics","category-tips"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>ESP32 - connection with SR501 PIR motion detector &amp; OLED screen - Botland<\/title>\n<meta name=\"description\" content=\"Just another tutorial in the ESP32 module series. Today we will be connecting it with PIR motion sensor and OLED display.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/botland.store\/blog\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ESP32 - connection with SR501 PIR motion detector &amp; OLED screen - Botland\" \/>\n<meta property=\"og:description\" content=\"Just another tutorial in the ESP32 module series. Today we will be connecting it with PIR motion sensor and OLED display.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/botland.store\/blog\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\/\" \/>\n<meta property=\"og:site_name\" content=\"Botland\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/Botland\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-29T09:58:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-04T07:52:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/botland.store\/blog\/wp-content\/uploads\/2022\/07\/ESP32-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1510\" \/>\n\t<meta property=\"og:image:height\" content=\"1510\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Oskar Pacelt\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oskar Pacelt\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/botland.store\\\/blog\\\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/botland.store\\\/blog\\\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\\\/\"},\"author\":{\"name\":\"Oskar Pacelt\",\"@id\":\"https:\\\/\\\/botland.com.pl\\\/blog\\\/#\\\/schema\\\/person\\\/54e9a88fc0d20263f2d6e9b2f4eace11\"},\"headline\":\"ESP32 &#8211; connection with SR501 PIR motion detector &#038; OLED screen\",\"datePublished\":\"2021-06-29T09:58:58+00:00\",\"dateModified\":\"2024-04-04T07:52:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/botland.store\\\/blog\\\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\\\/\"},\"wordCount\":394,\"publisher\":{\"@id\":\"https:\\\/\\\/botland.com.pl\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/botland.store\\\/blog\\\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/botland.store\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/ESP32-1.jpg\",\"articleSection\":[\"Electronics\",\"Tips\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/botland.store\\\/blog\\\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\\\/\",\"url\":\"https:\\\/\\\/botland.store\\\/blog\\\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\\\/\",\"name\":\"ESP32 - connection with SR501 PIR motion detector & OLED screen - Botland\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/botland.com.pl\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/botland.store\\\/blog\\\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/botland.store\\\/blog\\\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/botland.store\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/ESP32-1.jpg\",\"datePublished\":\"2021-06-29T09:58:58+00:00\",\"dateModified\":\"2024-04-04T07:52:55+00:00\",\"description\":\"Just another tutorial in the ESP32 module series. Today we will be connecting it with PIR motion sensor and OLED display.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/botland.store\\\/blog\\\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/botland.store\\\/blog\\\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/botland.store\\\/blog\\\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\\\/#primaryimage\",\"url\":\"https:\\\/\\\/botland.store\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/ESP32-1.jpg\",\"contentUrl\":\"https:\\\/\\\/botland.store\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/ESP32-1.jpg\",\"width\":1510,\"height\":1510},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/botland.store\\\/blog\\\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Strona g\u0142\u00f3wna\",\"item\":\"https:\\\/\\\/botland.store\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ESP32 &#8211; connection with SR501 PIR motion detector &#038; OLED screen\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/botland.com.pl\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/botland.com.pl\\\/blog\\\/\",\"name\":\"Botland\",\"description\":\"Blog Raspberry Pi, Arduino, elektronika i robotyka - Botland\",\"publisher\":{\"@id\":\"https:\\\/\\\/botland.com.pl\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/botland.com.pl\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/botland.com.pl\\\/blog\\\/#organization\",\"name\":\"Botland\",\"url\":\"https:\\\/\\\/botland.com.pl\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/botland.com.pl\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/botland.store\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/logo_kolor_WP_2-1.png\",\"contentUrl\":\"https:\\\/\\\/botland.store\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/logo_kolor_WP_2-1.png\",\"width\":250,\"height\":57,\"caption\":\"Botland\"},\"image\":{\"@id\":\"https:\\\/\\\/botland.com.pl\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/facebook.com\\\/Botland\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/botland.com.pl\\\/blog\\\/#\\\/schema\\\/person\\\/54e9a88fc0d20263f2d6e9b2f4eace11\",\"name\":\"Oskar Pacelt\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/botland.store\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/Oskar-Pacelt-150x150.png\",\"url\":\"https:\\\/\\\/botland.store\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/Oskar-Pacelt-150x150.png\",\"contentUrl\":\"https:\\\/\\\/botland.store\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/Oskar-Pacelt-150x150.png\",\"caption\":\"Oskar Pacelt\"},\"description\":\"Fan dobrej literatury i muzyki. Wierzy, \u017ce udany tekst jest jak list wys\u0142any w przysz\u0142o\u015b\u0107. W \u017cyciu najbardziej interesuje go prawda, pozosta\u0142ych zainteresowa\u0144 zliczy\u0107 nie spos\u00f3b. Kocha p\u0142ywa\u0107.\",\"url\":\"https:\\\/\\\/botland.store\\\/blog\\\/author\\\/oskar\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ESP32 - connection with SR501 PIR motion detector & OLED screen - Botland","description":"Just another tutorial in the ESP32 module series. Today we will be connecting it with PIR motion sensor and OLED display.","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:\/\/botland.store\/blog\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\/","og_locale":"en_US","og_type":"article","og_title":"ESP32 - connection with SR501 PIR motion detector & OLED screen - Botland","og_description":"Just another tutorial in the ESP32 module series. Today we will be connecting it with PIR motion sensor and OLED display.","og_url":"https:\/\/botland.store\/blog\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\/","og_site_name":"Botland","article_publisher":"https:\/\/facebook.com\/Botland\/","article_published_time":"2021-06-29T09:58:58+00:00","article_modified_time":"2024-04-04T07:52:55+00:00","og_image":[{"width":1510,"height":1510,"url":"https:\/\/botland.store\/blog\/wp-content\/uploads\/2022\/07\/ESP32-1.jpg","type":"image\/jpeg"}],"author":"Oskar Pacelt","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Oskar Pacelt","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/botland.store\/blog\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\/#article","isPartOf":{"@id":"https:\/\/botland.store\/blog\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\/"},"author":{"name":"Oskar Pacelt","@id":"https:\/\/botland.com.pl\/blog\/#\/schema\/person\/54e9a88fc0d20263f2d6e9b2f4eace11"},"headline":"ESP32 &#8211; connection with SR501 PIR motion detector &#038; OLED screen","datePublished":"2021-06-29T09:58:58+00:00","dateModified":"2024-04-04T07:52:55+00:00","mainEntityOfPage":{"@id":"https:\/\/botland.store\/blog\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\/"},"wordCount":394,"publisher":{"@id":"https:\/\/botland.com.pl\/blog\/#organization"},"image":{"@id":"https:\/\/botland.store\/blog\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\/#primaryimage"},"thumbnailUrl":"https:\/\/botland.store\/blog\/wp-content\/uploads\/2022\/07\/ESP32-1.jpg","articleSection":["Electronics","Tips"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/botland.store\/blog\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\/","url":"https:\/\/botland.store\/blog\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\/","name":"ESP32 - connection with SR501 PIR motion detector & OLED screen - Botland","isPartOf":{"@id":"https:\/\/botland.com.pl\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/botland.store\/blog\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\/#primaryimage"},"image":{"@id":"https:\/\/botland.store\/blog\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\/#primaryimage"},"thumbnailUrl":"https:\/\/botland.store\/blog\/wp-content\/uploads\/2022\/07\/ESP32-1.jpg","datePublished":"2021-06-29T09:58:58+00:00","dateModified":"2024-04-04T07:52:55+00:00","description":"Just another tutorial in the ESP32 module series. Today we will be connecting it with PIR motion sensor and OLED display.","breadcrumb":{"@id":"https:\/\/botland.store\/blog\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/botland.store\/blog\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/botland.store\/blog\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\/#primaryimage","url":"https:\/\/botland.store\/blog\/wp-content\/uploads\/2022\/07\/ESP32-1.jpg","contentUrl":"https:\/\/botland.store\/blog\/wp-content\/uploads\/2022\/07\/ESP32-1.jpg","width":1510,"height":1510},{"@type":"BreadcrumbList","@id":"https:\/\/botland.store\/blog\/esp32-connection-with-sr501-pir-motion-detector-oled-screen\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Strona g\u0142\u00f3wna","item":"https:\/\/botland.store\/blog\/"},{"@type":"ListItem","position":2,"name":"ESP32 &#8211; connection with SR501 PIR motion detector &#038; OLED screen"}]},{"@type":"WebSite","@id":"https:\/\/botland.com.pl\/blog\/#website","url":"https:\/\/botland.com.pl\/blog\/","name":"Botland","description":"Blog Raspberry Pi, Arduino, elektronika i robotyka - Botland","publisher":{"@id":"https:\/\/botland.com.pl\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/botland.com.pl\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/botland.com.pl\/blog\/#organization","name":"Botland","url":"https:\/\/botland.com.pl\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/botland.com.pl\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/botland.store\/blog\/wp-content\/uploads\/2018\/04\/logo_kolor_WP_2-1.png","contentUrl":"https:\/\/botland.store\/blog\/wp-content\/uploads\/2018\/04\/logo_kolor_WP_2-1.png","width":250,"height":57,"caption":"Botland"},"image":{"@id":"https:\/\/botland.com.pl\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/facebook.com\/Botland\/"]},{"@type":"Person","@id":"https:\/\/botland.com.pl\/blog\/#\/schema\/person\/54e9a88fc0d20263f2d6e9b2f4eace11","name":"Oskar Pacelt","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/botland.store\/blog\/wp-content\/uploads\/2020\/09\/Oskar-Pacelt-150x150.png","url":"https:\/\/botland.store\/blog\/wp-content\/uploads\/2020\/09\/Oskar-Pacelt-150x150.png","contentUrl":"https:\/\/botland.store\/blog\/wp-content\/uploads\/2020\/09\/Oskar-Pacelt-150x150.png","caption":"Oskar Pacelt"},"description":"Fan dobrej literatury i muzyki. Wierzy, \u017ce udany tekst jest jak list wys\u0142any w przysz\u0142o\u015b\u0107. W \u017cyciu najbardziej interesuje go prawda, pozosta\u0142ych zainteresowa\u0144 zliczy\u0107 nie spos\u00f3b. Kocha p\u0142ywa\u0107.","url":"https:\/\/botland.store\/blog\/author\/oskar\/"}]}},"_links":{"self":[{"href":"https:\/\/botland.store\/blog\/wp-json\/wp\/v2\/posts\/42413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/botland.store\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/botland.store\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/botland.store\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/botland.store\/blog\/wp-json\/wp\/v2\/comments?post=42413"}],"version-history":[{"count":0,"href":"https:\/\/botland.store\/blog\/wp-json\/wp\/v2\/posts\/42413\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/botland.store\/blog\/wp-json\/wp\/v2\/media\/42414"}],"wp:attachment":[{"href":"https:\/\/botland.store\/blog\/wp-json\/wp\/v2\/media?parent=42413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/botland.store\/blog\/wp-json\/wp\/v2\/categories?post=42413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/botland.store\/blog\/wp-json\/wp\/v2\/tags?post=42413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}