DIY Online Security Camera! (takes pictures when an intruder enters) || Home Assistant Guide

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hi there, you might be asking yourself why  I am standing in front of my entrance door.  Well, the reasons is that I justed wanted  to prove to you that my Intruder Alarm   System still functions without a problem. As you can see I got a notification on my   smartphone because the on vacation  switch of the system was turned on   and the door was being opened. And if you are completely confused right now   then make sure to watch my DIY Home  Automation Intruder Alarm System video.  But anyway, with this system I feel a bit more  secure knowing that nobody is inside my apartment.  But this message on my phone alone does not really  help me when it comes to identyfing an intruder.  So in this video I will be using the ESP32-CAM  and the housing of an ordinary security camera   in order to create an online security  camera that integrates into home assistant.  This way I can not only watch a live stream of  my entrance door everywhere in the world but the   system also automatically takes photos  when my intruder alarm gets triggered.  So let's not waste anymore  time and let's get started!  This video is sponsored by Altium. I recently  switched over to their Altium Designer software   and used it to create a couple of PCB s. What I  can say is that it might take a bit of time to   get used to, but the software offers pretty much  everything you could ever need to design a PCB. So   feel free to test the Altium Designer by yourself  by following the link in the video description.  The heart of this online security camera  is, like already mentioned, this ESP32-CAM   board that you can get for just 6$ from Ebay. This board is basically an ESP32 development board   to which you can hook up  this OV2640 camera module.  You can actually find the datasheet for  the camera chip which comes with plenty   of interesting information on how difficult  it is to get all the required data from it.  For example the array size of it is 1632 by  1232 which equals a total of 2.010.624 pixels   which look something like this  according to the datasheet.  So if you theoretically have to sample each pixel  individually in order to create a recording at   full resolution with a frame rate of 15fps, then  you would only get around 33ns of time to sample   the data of each pixel and thus you would require  a clock signal with a frequency of around 30MHz.  Of course this was just a simple  example and if you want more information   then feel free to dive a lot deeper into  the datasheet to get all the juicy details.  But what I wanted to demonstrate is  that working with such a camera module   requires not only a rather fast microcontroller  like the ESP32 but also lots of efficient and thus   not easy to create code which due to the Internet  and smarter programmer than me luckily does exist.  So for starters let's have a look at the  ESP32-CAM example revisited project on   GitHub created by easytarget. After downloading it, I opened   the esp32-cam-webserver file and continued by  installing the ESP32 boards for the Arduino IDE.  At this point I chose the correct development  board and was about to click upload but   then I noticed that the ESP32-Cam board does  not come with a USB jack for programming.  Instead we have to use such  an FTDI breakout board.  After setting its voltage levels  to 3.3V, I connected the breakout   board pins to the development board  according to this wiring diagram.  And as soon as I connected the GPIO0 of the  board to GND to put it into programming mode,   I hooked up the FTDI board to my  computer and finally uploaded the code.  Next I removed the wire from GPIO0, as well  as the FTDI wires and instead hooked up two   wires to the 5V pin and GND in order to power  the board through my lab bench power supply.  After then connecting to it by  entering the password InsecurePassword,   I opened a browser and typed in its IP Address  which sadly did not work for me at all.  The only way I got this to work was by  using the browser on my phone and only   there I was able to confirm that the camera  can take pictures without a problem, awesome.  So time to end this initial test and hook up the  FTDI breakout board once again just like before.  This time though I logged into my home  assistant server and created a new node   in Esp Home which I called camera.  And after choosing the AI-THINKER ESP32-CAM  as the board, I entered my WiFi information   and continued by compiling this first example  code in order to download it as a binary file.  I used this file and the Esp Home flasher in  order to upload the created code to the board   and as you can see that worked out as well because  after hooking the board up to 5V power once again   the created node was available online  and thus it was time to edit its code.  Thankfully the ESP32-CAM is supported by home  assistant so all I had to do was to copy a bit   of code, edit the resolution and add a few  lines to add the onboard LED to the system.  After then uploading this code through WiFi, I  added the entities to the dashboard and edited it   in order to display the LED light  switch and the camera picture/stream.  As you can see the camera can stream  a live image of what it is seeing and   we can turn on and off the LED of the  board which will come in handy later.  But anyway, next we need to use the  file editor add on of home assistant   in order to edit the configuration file in which  we have to add three lines to use the folder tmp   for external applications. After then creating this folder   we can open developer tools and then services  in order to select the camer.snaphost service.  And as soon as we enter the correct service  data which defines the file path and name   of our screenshot, we can hit call service. And as expected in this newly created folder   we can now find a picture which  is the snapshot we just took,   perfect. As a side note though,   the camera does not support recordings  which I otherwise would have also utilized.  But nevertheless next it was time to  edit my door alarm automation sequence.  So I firstly added the command to turn on the  LED light of the board, followed by the command   to take one snapshot, then I let the system wait  for 05 seconds and then take a second snapshot.  After saving this sequence, I did a small  test with my door alarm trigger and it seems   like everything worked out just fine, brilliant. And that bring me to my enclosure for this project   for which I ordered this all metal security  camera for a pretty reasonable price.  As you can see it already got some damages because  I tried to take it apart for half an hour but I   had to give up at some point and instead used the  always reliable method of commencing hammer time.  The funny thing though was that the camera  itself was super simple to take apart.  On the inside we can find a  PCB with lots of infrared LEDs   as well as the main camera board underneath. At this point I was wondering whether I could   use the infrared LEDs for night vision snapshots  and thus I powered the security camera with 12V.  First off the infrared LED  board directly works with 12V   and it also detects on its own whether  it is dark or not through a photo sensor   which basically means we can toss out the  camera board without feeling bad about it.  The best thing though was that the ESP32-CAM does  not come with an infrared filter which means the   infrared light was able to illuminate its picture. So I came up with this wiring diagram to power   and control the infrared LEDs  through the ESP32-Cam board.  As you can see we will need a boost  converter that creates 12V for the LEDs.  Then we also need to add a MOSFET which will  turn on the infrared LEDs when the GPIO4   of the ESP board gets activated to which  the onboard LED was currently hooked up.  So the first thing I did was not only  getting rid of the male headers of the board   but also desoldering the onboard LED. Afterwards I connected all of the   components to one another according  to the wiring diagram I just showed.  And at the end I used hot glue to mount  the components inside the enclosure   along with the original screw mounting method. It is important to note though that I also   used hot glue to secure the camera  right in the middle of the LED ring   and to power everything up later on I also added  a chopped up Micro USB cable to the power wires.  And with that being said the  online security camera was done   but before reinserting it back into its frame,   I positioned it on my wall to mark the mounting  holes for it and then created them with my drill.  After then adding wall plugs,  I secured the frame to the wall   into which I then pressed the camera ball. Last but not I added cable conduits to my wall   so that I could hide the power wire in there and  finally powered it all with a 5V power supply   positioned in the nearest outlet. And just like that you can create   an online security camera which takes  pictures of intruders without any problems.  I hope you liked this project. If so don't forget to like,   share, subscribe and hit the notification bell. Stay creative and I will see you next time.
Info
Channel: GreatScott!
Views: 123,198
Rating: undefined out of 5
Keywords: esp32, esp, 32, cam, esp32cam, esp32-cam, home, assistant, automation, automate, tutorial, guide, beginner, beginners, make, project, how, to, do, it, yourself, arduino, web, server, online, security, camera, raspberry, pi, browser, stream, live, video, picture, snapshot, recording, cloud, sensor, pixel, resolution, night, vision, ir, led, infrared, livestream, intruder, burglar, alarm, trigger, door, apartment, smartphone, system, electronic, electronics, greatscott, greatscott!, esp8266
Id: qspHm1RKsPc
Channel Id: undefined
Length: 11min 44sec (704 seconds)
Published: Sun Dec 20 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.