Development of an IoT Enabled Smart Security System Using PIR (Motion Sensor) and Esp32cam Micro-Controller

in STEMGeekslast year (edited)

Hi, I'm @techlhab and it's my pleasure to share this with you. Which is an IoT-enabled smart security system using PIR (Passive Infrared) Motion Sensor, and ESP32CAM Microcontroller .



In developing this project I used the following hardware components:

  1. ESP32CAM
  2. PIR (Passive Infrared) Motion Sensor
  3. Control Switch
  4. Relay Module
  5. TP4056 Lithium Battery Charger
  6. 2000mAH 3.7v Lithium Battery
  7. Indicating LED (Light Emitting Diode)
  8. DC-DC step up converter
  9. Female USB Port
  10. Resistor
  11. Connecting Wires
  12. 12v Power Jack


  1. Arduino IDE (Integrated and Development Environment)
  2. Embedded C/C++
  3. HTML (HyperText Markup Language)
  4. CSS (Cascading Style Sheet)


The project was developed to solve problems relating to security and lightening smartly.

ESP32 CAM is an advance and modern IoT-enabled microcontroller that has Bluetooth, a Camera, Wifi (Wireless Fidelity), Micro SD (Secure Digital) Card Slot, and a very Bright LED embedded in it which makes it very useful and capable of performing many functions.

When the device is been put on, by pressing the power control switch, a power LED (Light Emitting Diode) comes on. The ESP32Cam connects to the Internet and hence has its own unique static IP (Internet Protocol) Address. When the IP of the device is been navigated on a web browser it displays that which is below.


When the device senses movement through the PIR (Passive Infrared) Motion Sensor, the ESP32Cam takes picture of the instance and the LED (Light Emitting Diode) embedded on the micro-controller flashes simultaneously.

In the absence of movement, the device continues to display the video of what the camera sees on the webpage as shown above.

The webpage interface was developed with HTML (Hypertext Markup Language) for providing the structure of the webpage and CSS (Cascading Style Sheet) for styling the webpage. Arduino IDE (Integrated Development Environment) was used for writing the codes used for the project and C/C++ programming language was also used in the development of the software part of the project.

The buttons on the webpage are used to control the lights on the ESP32Cam and also the 5v output of the Female USB (Universal Serial Bus) port on the device which is been connected to a relay module for easy switching.

Below is the schematic diagram I designed for the project and the first image shown above is the wiring diagram.

PIR WITH ESP32 CAM_schem.png

You can find the codes and other resources relating to the project through this link.

Thanks for reading 🤝, don't forget to like ❤️, comment ✍️, and share.

Posted with STEMGeeks


This looks to be largely open source?

Posted using Dapplr

Yeah, so that many can benefit from it or use it as a guide towards building or developing their.

I also dropped the link to the GitHub repo where I pushed the codes and other resources relating to the project to.

Awesome. That's the stuff I am looking for. Thanks!

u wlc And thanks for the support and nice comments 🤝.

Greetings, your work has many possibilities of commercial application, I hope you have the best of luck. It is an interesting application with Arduino.

Thanks for the nice comment @soltecno 🤝. This still seems to be a prototype but I am open to contributors and investors towards making it commercial and better. As u know it's very costly when it comes to starting a mass production.

Work with Arduino to fix refrigeration equipment and ice makers. So when I see other people's work it brings back great memories, it's very useful and there is no limit to what can be achieved. I really wish you much encouragement and good luck.