In this tutorial, we’re going to go over setting up the ESP32-CAM, an Arduino-based microcontroller that comes with a built-in camera module and Wifi capabilities. Let’s start with configuring the hardware and software for the board to provide a minimum working example of this module’s capabilities.
We need to set up our development environment. This is how we configure the computer you are using to flash (save, download, embed, etc.) code onto our microcontroller.
First, Open the Arduino IDE. If you haven’t installed it yet, go to this link and download it from Arduino:
6. Search ESP32 in the search bar for “All” and click “Install”. (Note, The Install button appears when you move your mouse).
7. Select your board using one of the following options
8. There are open source libraries and plenty of existing modules that allow us to save, stream, and view video data from our camera modules. We’ll be setting up CameraWebServer, a minimalist streaming app that comes with the ESP-32 Board Manager software and using it to launch a simple surveillance camera. After the libraries from previous steps are installed, you can select the Web Server example for the camera by going to Go to File > Examples > ESP32 > Camera > CameraWebServer
9. Open the project and take a brief look at the code. It’s a lot, so if you are a beginner, don’t get intimidated! This is a fairly complicated embedded app, as it’s made to provide a high level of out-of-the-box functionality for various ESP modules; however, what the code does is simple enough to understand. This program makes your board connect to the local wifi, start shooting a continuous stream of photos, launch a web server on the network, and provides a viewing page with the camera stream and controls to anyone on wifi who requests it. You should make note of the following before getting ready to flash the code:
10. You’ll have to navigate to the following line of code at the top of the main file and uncomment it in order to get the test example working with your board: #define CAMERA_MODEL_AI_THINKER. If you are using a different ESP-Cam module with this tutorial, please get the model name of your board and uncomment that line instead! The relevant passage of code should be right at the beginning before #include “camera_pins.h”
11. You’ll notice the void loop () {} activity is in app_httpd.cpp
12.Upload Code to ESP Cam & Test Stream
13. Select your board, and your port, and then press ‘Upload Sketch’.
Conclusion:
If you’re seeing a result similar to the above then congrats-you just set up and programmed your own live-streaming video surveillance camera! In subsequent tutorials, we’ll discuss additional topics like mounting, sensors, privacy, databases, and integrating AI.
Want to print your doc? This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (