ESP32-CAM - Guide to making YOUR first DIY Security Camera

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this video is sponsored by brilliant here's how you can get started with the ESP32-CAM for DIY Security Cameras or Home Monitoring by the end of this video you should be well set to creating your own Wi-Fi Security Camera with a complete web interface containing loads of unique features and capabilities getting the most out of your ESP32-CAM I'm Max and I'm here to guide you through step-by-step learning about the ESP32-CAM but most importantly getting a Hands-On approach to getting it started off with the most well-developed camera web server code that we'll be programming it with some of you may remember the Wi-Fi security camera I made in the video back in 2021 showing how to make it however I'll admit I went a little too fast on the instructional part so in this video I'll improve on that and cover things in more depth with everything you need to know about getting set up with the Fantastic little camera board the esp32 cam module is really just the camera equipped version of its bigger brother the ESP32 Development board which is basically a faster and more advanced Arduino board but on steroids the camera board can be obtained for 10 US dollars or less and is found to be used in various types of DIY projects such as in surveillance cameras home automation face recognition applications object tracking and robots and even fpv video streaming and RC vehicles or aircraft and even more that's just to tell you how capable of a board it really is but in this video we'll mainly stick to setting it up as a surveillance camera to get more familiarized with the ESP32-CAM, here's some features I believe are worth noting about the board such as the micro SD card slot that can fit a memory card up to 4 gigabytes for storing recorded video files and photos among the pin headers it features 10 general purpose input and output gpio pins for sensors and small loads though unfortunately most of these are taken up when the camera sensor is in use there are also 5 volt and 3.3 volt pins through which the board can be powered a surface mounted LED for blinking or using as a flashlight a tiny push button on the back as the reset button which is also needed when programming at the front we have the actual camera sensor the ov2640 a quarter inch 2 megapixel sensor that can achieve a resolution as high as 1600 by 1200 pixels known as uxga almost 1080p resolution but a little more narrow and a lower quality [Music] last but not least to the core of operations the esp32s that supports Wi-Fi and Bluetooth connectivity a microprocessor unlike the slower microcontroller that you'd find on an Arduino board making the esp32 a far more capable and faster unit enough with the specs let's see what we need to get one of these cameras going first of course the camera board itself an ftdi or USB to serial converter for programming and powering the camera because as you notice a major downside to the esp32 cam is that it has no USB port so we'll need to use this board for communicating with the ESP we'll also need a set of five jumper wires a four gigabyte micro SD card a USB cable for plugging the ftdi converter into your computer the programming software known as the Arduino IDE installed on your computer lastly a Wi-Fi network rather than using the type of ftdi programmer I have you can simplify connections and make programming easier for the camera board with an MB USB programming adapter all of the parts can be purchased through my affiliate links also in the video description starting from the ftdi let's plug the four female to female jumper wires onto the corresponding pins including a green wire to the TX pin and a blue wire to the RX pin these are for serial communication we'll also connect a black wire for ground and a red wire for VCC which is usually 5 volts we're gonna plug these loose wires coming from the converter board to the camera board starting from the red wire going strictly to the 5 volt pin the black wire to one of the esp's ground pins the blue wire to pin u0t then the green wire to the board's receiving pin labeled u0r this completes the connections but before plugging in the converter board we must make sure the onboard VCC selector jumper is on the correct side to get 5 volts and not 3.3 volts now let's hook things up to the PC through a USB cable and open up the Arduino IDE if you don't yet have the programming software you may find a link in the video description to where you can download it make sure it is version 1.8 or higher once the software is installed on your computer a code box like this will pop up before loading up any code we need to First install the esp32 boards add-on into the Arduino IDE the way to do that would be to first go to the GitHub page you can find the link to it below the video then copy the whole dot Json URL next we'll return back to the IDE and go under file preferences and next to where it says additional board manager URLs paste the URL in this window if you need to keep more than one then be sure to separate them with a comma be sure to press ok to save the changes after doing this you may need to reload the program then up here let's Click On Tools board then go into the boards manager in the search bar type esp32 and you should see the board's Library package check that you've installed it with a version of 2.0.5 or higher closing the board manager let's check the entered board parameters under Tools check that you've selected esp32 Dev module as your board unless you're on a different chip other than the esp32s no need to change the upload speed frequency or any other details apart from making sure that your partition scheme is set to huge app three megabytes and if that doesn't work then use the minimal spips 1.9 megabytes option PS Ram should be set to enabled also check that your esp's com Port is selected if you don't see it here it may pay to go to your PC's control panel then in device manager to check whether it's labeled under the com ports drop down if it is then it may just need updating otherwise this could mean there's something wrong with your board or just the hardware connection the usual routes defining the original camera code would be to go to file and under examples here you'll see the list of example codes for the esp32 then under esp32 camera you have the camera web server code which one would normally use however we won't be using this code but I'm way more developed version of the code that enables the esp32 cam to not only stream video through to a web server but also to save footage to an SD card transfer files to our own FTP server record on Demand with motion triggering have different sensors pan and tilt Servo Motors etc etc so to get this very same code loaded into the IDE we'll first go to the code author's GitHub repository which is found linked below the video actually full code credits go to s60sc on GitHub and everyone else who contributed click on the green button here and download the zip file containing the code once we've located the file we can unzip it and rename this folder removing Dash master from its name to avoid facing code folder issues opening the esp32cam mjpeg2sd.eno file with the surrounding library and extension codes will open the main code with all of the extensions as functional tabs that each player own role in making everything work in the tab called app globals.h is where you need to first check the selected camera model based on the one that you're using in the case of using the ESP cam we've got the default one selected should be the AI thinker model so we don't need to change anything here unless it's a different camera model than uncommenting the matching camera model will make it work to configure a Wi-Fi network which the camera will be working from we need to go to the utils tab at the far top right corner and it lines 23 through 25 is where we'll enter the credentials enter your router's SSID or network name and your Wi-Fi Network's password make sure you double check that these two are indeed correct according to your network we'll be able to enter the rest of the information later once we've gotten the web server up and running other details would include making a static IP setting an access point as well as setting up an FTP server this will help get the saved video files on the SD card transferred across the internet safely to a server on a PC though we won't cover that in this video speaking of the SD card there's something we need to copy onto it first that the camera needs in order to function the data folder with the config file containing internet and other parameters which come with the code when you download it from GitHub you'll want to copy and paste the data folder to the MicroSD card this is a necessary step to take so you don't get an error message at the serial Monitor and so that given configuration updates can be transferred remotely to the ESP can now before we hit the upload button we're going to take a jumper wire and connect it to the board shorting pins IO 0 and ground then press the reset button once this puts the esp32 in flashing mode for programming now we can hit upload and wait a minute for the compilation and uploading to finish once done we can unplug the same jumper wire and press the reset button again to take it out of flashing mode the camera is now up and running but to access its web server we need to open the serial Monitor and first obtain its access point IP which it automatically generates on Startup on a device that uses Wi-Fi such as a laptop or a phone will go to the network settings and connect to the esp32 Cam's access point then we'll enter this IP 192.168.4.1 into the web browser leading to the temporary camera web server where we need to re-enter a network credential going to the configurations button down here let's enter the router's SSID in this blank space above the password and press save this now has to be done for some reason due to the latest changes of this code we can then disconnect from the access point Network and go back into the serial monitor on our computer to obtain the IP address that it throws at us as its final IP you may have to press the reset button once for the serial monitor to give an output there we have it its Owen Dynamic IP we can copy this IP address and paste it into the web browser on any device getting us to the advanced web server that we programmed to the ESP camera with an access point is sort of like another router with its own network yet the esp32 only provided us with a connection to it but not internet as in free Wi-Fi in Normal operation with its station IP and operates just like any other device such as a phone connected through Wi-Fi to a router so up here we can click on the start stream button to see live footage of what the camera is currently seeing the code also enables this camera to both record on Demand with the button here and record through Visual motion detection when something or someone moves in front of the camera you see now it has started recording and it only stops when any movement is no longer detected there are even more features we'll be covering in a minute with what this capable code has programmed to the camera to do but have you ever wondered where to start learning the programming and electronics for camera systems like the one in the palm of my hands just go to brilliant.org whatever level you're at brilliant will help you ramp up and master the skills you need to help achieve your goals quicker the platform offers the most impactful way of learning math and computer science interactively as that saying goes the best way to learn anything is by doing and Brilliant proves just that through the thousands of Hands-On lessons from basic to Advanced programming mathematics data science and more with new lessons added monthly what I love most about Brilliance is it cuts away the boring Theory and gets you right to the point of learning beneficial lessons such as programming for an interactive moving object this Mars Rover with a live streaming camera sort of like the esp32 can hey that's one idea to try everything brilliant has to offer for free up until 30 days visit brilliant.org maximagination or click on the link in the description below the first 200 of you will get 20 off brilliant's annual premium subscription sign up today to become a lifelong learner heading back to the camera web server let's explore all of its other features up in the top panel we've also got a button for taking a still image from the stream and right next to it we have the start playback button for playing back selected footage from the memory card which we'll try out in the moment [Music] thank you on the left side panel there's a tab for camera control where you can change the resolution at which the camera films during streaming uxga is the highest but only makes the videos record at 5 frames per second which is too hacky whereas a much smaller resolution that's acceptable for first person view integration like CIF may give 30 FPS but it cripples the quality by a lot so what I normally choose is SVGA which is 800 by 600 pixels and is a balance between the two play around with other resolutions to see what suits best for you the other features down here such as microphone gain camera Servo tilt and pan we may cover in a future video and then there's lamp brightness control which turns on the lamp on board the ESP camera at variable brightness as you see here but in order for this feature to work you may first have to activate it and this can be done in the camera web server settings down here in the motion detect and recording tab you can toggle settings on and off such as recording through motion detection with sensitivity control saving captured videos showing Motion in black and white the camera actually detects movement this way and taking time lapse video which could be handy to use in outdoor locations with this slider you can even alter the minimum time the camera records for after being triggered in the playback and file transfers tab you can open folders in the micro SD card and select a file to be played back in the video stream panel by clicking the start playback button but since the played back files Lag Way Too Much you may instead choose to download the videos individually and play them back in your device you can even delete certain files from here and even have them automatically transfer to your FTP server I have linked the video Below in the description showing how to go about setting one up on your computer this is really handy say if you have a security camera set up somewhere and gets the recorded files transferring straight away to a PC all through the internet instead of the hassle of having to retrieve a memory card every time you want to empty the files the tab called picture settings covers the control of the visual aspects such as flipping video horizontally or vertically and the last tab stores info like your Wi-Fi network credentials FTP settings web server authentication details and more all of which can be edited at any given time all of what we've covered is all under the main camera tab other major tabs up here cover technical things like info logging additional Hardware configurations and uploading updates to the camera over the air this web server is pretty well rigged but it isn't that secure quite yet to give our system an extra layer of security we can fill out some authentication details such as a name and password in these two boxes down here when we reload the web server we should now be prompted to fill out these boxes with the authentication name and password that we set there we go we're in since the station IP we're using for this web server is a dynamic IP it frequently changes making it pretty unreliable when you want to access it to fix this we can give it a fixed IP address known as a static IP one that never changes and you can actually rely on this can be done in the web server all for free let's go to the edit config tab under Wi-Fi we can type in an IP that starts with 192. 168.1 and ends on any number from 0 to 255. I'll put 184 at the end something to distinguish it far from other devices we'll also enter the router's Gateway IP which usually ends in 1.1 but in your case it could be different so it's worth first checking after saving the info by pressing the button up here it can now be accessed with one IP that you can remember this covers a lot of what the extended camera web server has to offer pretty developed for such a small camera but to truly get the most out of this camera and its new web server being able to access it from any other Wi-Fi network around the world would be way more handy ways you can do that is through port forwarding the camera's static IP address in your router settings you use your public IP with the forwarded Port your camera is on and enter those details into the web from another Wi-Fi network when you're out and about another way would be to set up the camera with a cloud-based service with its own servers to stream this web server over the Internet with access from anywhere in the world such as the blink iot app which supports the esp32 cam but with several limitations I couldn't yet manage to get my camera set up through any of these methods so if you have any suggestions on how this can be done better don't be shy please leave them in the comments below to really get the most out of the esp32 Cam's Hardware capabilities here's a couple more things you need to know the camera sensor itself has a threaded lens and can turn for adjusting focus in most cases the lens on your camera may be super glued but if you carefully scrape the glue loose you'll be able to turn the lens during use to focus on near or distant objects another thing is knowing how to get a greater range out of the esp32 on the board you'll see a zero Ohm resistor from the ESP connected to the PCB antenna this may not give enough range in cases where you need to have the esp32 camera placed further from your router so to change that desoldering the resistor from the PCB antenna path and re-soldering it but this time connecting to the antenna connector will now allow you to use external antennas of any size to achieve a much better Wi-Fi range for your projects [Music] so you saw how the 2 megapixel image sensor works but I think we can agree that the quality really isn't the best but if you use the ov5640 a 5 megapixel image sensor with autofocus you can achieve greater resolution video with your esp32 since the code already supports the ov5640 software wise there's nothing you need to do but in terms of Hardware you'll have to solder a wire coming from the 3.3 volt pin to the very last pin on this camera connector this supplies the necessary voltage the image sensor runs on thank you [Music] [Music] since I know many of you will happen to face some forms of issues or bumps along the way from uploading the code to getting your esp32 camera going it's all part of the process so I thought I'd include this section in the video for troubleshooting if you face compilation errors while trying to upload to the board such as when the terminal complains that the sketch is too big most of the time this is pinned down to having the wrong partition scheme selected so try using a smaller one like the 1.9 megabyte minimal spiffs partition scheme also if you get a compilation error regarding a certain Library this might mean that you need to update one of those libraries you can do that in the library manager facing uploading issues is most common when working with the esp32 cam if you get these kind of error messages in the terminal it most likely means you have your communication wires TX and RX swapped around the wrong way so be sure to change their connection it could also mean you forgot to put the esp32 into flashing mode by shorting pins gpio zero and ground then pressing the reset button once before uploading or this could mean you simply don't have your esp's com Port selected or maybe one of your jumper wires is the culprit and has gone faulty be sure to check your wires with a multimeter to ensure there is indeed a connection so let's say you successfully uploaded code to your board but when you go to open the serial monitor nothing appears make sure you have the flashing wire disconnected then press on the camera's reset button for the info to appear and if you're still not getting anything be sure to check you have the matching baud rate of 115200 selected now if you're getting this message in the monitor mentioning a brown out error this means your camera is getting insufficient power try using a better quality cable that delivers sufficient current or simply use a different USB port on your PC brownouts can also sometimes be the cause of uploading issues so be sure to check your Hardware really well to troubleshoot further on other issues that may come about visit the esp32 cam troubleshooting guide on random nerdtutorials.com for more help so we've seen how the esp32 cam can be powered through USB from a PC but how about other powering options for making it portable when it comes to supplying stable power from a battery to the camera for your projects it all comes down to the voltage you want to run the ESP with for one cell 3.7 volt batteries like a Lithium Polymer or with lithium ion battery we can use one of these low-cost power bank modules that contain a boost converter on board for stepping up the battery's 3.7 volts to a 5 volt output the output of this converter can be connected to the ESP Cam's 5 volt pin and power it without a problem powering the camera through a power bank module also allows you to recharge the battery through USB for a decent run time I recommend using batteries with a current capacity of at least 500 milliamp hours which is the same as a battery that lasts the camera two or more hours for outdoor security camera applications using 2200 milliamp hour lithium ion batteries with solar panels would ensure 24 7 operation speaking of solar panels if you're mounting your DIY security camera Outdoors it would be smart to run it solar powered in parallel with a battery through a mini mppt charge controller board like this one from DF robot it brings the most out of a solar panel through maximum PowerPoint tracking to recharge a lithium battery storing that energy to then power a device such as the esp32 cam turning it into a solar powered security camera speaking of which I'll be making one in the next video stay tuned for that in this video we learned how to get set up with the esp32km board as a Wi-Fi security camera with a very extensive code although it didn't cover how to get set up with the other Advanced capabilities that this code has to offer such as linking it to an FTP server for automatic file transfer SMTP email or even making this camera accessible from anywhere in the world if I get enough requests I may cover this in a future video if you found this video guide helpful kindly leave a thumbs up and consider subscribing after watching if you still have any doubts about getting set up then feel free to leave them in the comments below see you in the next video where we'll be making the fully equipped security camera bye for now [Music] oh [Music]
Info
Channel: Max Imagination
Views: 393,461
Rating: undefined out of 5
Keywords: max imagination, diy security camera, esp32, esp32-cam, esp32 cam security camera, esp32 camera, wifi security camera, wifi camera, diy surveillance camera, ov2640, ov5640, arduino security camera, esp32 cam projects, esp32 cam arduino, esp32 cam module, esp32 cam with arduino, esp32 cctv camera, esp32 cam live streaming, diy security camera esp32, diy wifi security camera esp32 cam rechargeable, arduino based camera, diy wifi security camera, arduino camera, esp32cam, esp32 cam
Id: k_PJLkfqDuI
Channel Id: undefined
Length: 24min 55sec (1495 seconds)
Published: Sat Mar 11 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.