Easy Remote Video Monitoring Using the ESP32-CAM From Your Smartphone

Remote video monitoring is essential in many instances, but buying a camera outright can be quite expensive. Luckily, you can find alternative solutions.

Do you need a quick, inexpensive way to check up on things from your smartphone? We will see how we can use the inexpensive ESP32-CAM module to set up a remote, web-enabled camera for monitoring, surveillance, or video doorbell applications!

Gathering Supplies for This Project

For this project, you will need:

  • An ESP32-CAM board with either a programming daughter board or a built-in USB port
  • A micro USB cable
  • A USB charger
  • The network name and password for your wireless access point
  • A smartphone or tablet

Choosing a Suitable ESP32-CAM Board

For this project, you will need a way to program the ESP32-CAM board from your computer and a way to power it when it is no longer connected to your computer. Both of these functions are easily accomplished if your board has a USB connector.

For this reason, you should buy either an ESP32-CAM with an ESP32-CAM-MB daughter board or a newer ESP32-CAM-CH340. Both come with the necessary USB port for programming and power. Avoid purchasing a bare ESP32-CAM board, as this will require additional components you may not have.

Setting Up the Arduino IDE

To program the ESP32-CAM, you will need the Arduino IDE from the Arduino website. At the time this article was written, 1.8.19 was the current version.

MAKEUSEOF VIDEO OF THE DAY

Once the download is complete, launch the application. The first time you run it, you might get an unrecognized application warning from Windows. It is safe to click More infofollowed by Run Anyway.

Once the Arduino IDE starts up, it will look like this:


A screenshot of the Arduino IDE version 1.8.19

You will need to make some changes to allow the Arduino IDE to recognize the ESP32-CAM. First, open Preferences from the File menu. Where it says Additional Boards Manager URLspaste in the following line:

https://dl.espressif.com/dl/package_esp32_index.json

Then, click OK.

Now, open the Tools menu and hover your mouse over the menu item that starts with Board: (it may be something like Board: Arduino Uno). From the submenu that appears, select Boards Manager. This will bring up a new window with a search bar at the top. Type ESP32 in the search bar. Doing so should allow you to select esp32 by Espressif Systems. Click Install. When the download finishes, click OK to exit the Boards Manager.


Now, return to the Tools menu and again open the submenu that starts with the word Board. This time, you should see an ESP32 Arduino item that was not there before. This is a submenu with a long list of board names. Find AI Thinker ESP32-CAM and select that.

That’s it; the Arduino IDE is now configured for the ESP32-CAM!

Compiling and Loading the CameraWebServer

The Arduino IDE comes with a great example called CameraWebServer that shows the full capabilities of the ESP32-CAM. Let’s try it out! From the File menu, select Examples and find the section called Examples for the AI ​​Tinker ESP32-CAM.

Underneath that, select ESP32then Camera—and finally CameraWebServer.

We will need to do a couple modifications to get this to run with your ESP32-CAM. Find the lines that look like this:


// Select camera model
#define CAMERA_MODEL_WROVER_KIT // Has PSRAM
//#define CAMERA_MODEL_ESP_EYE // Has PSRAM
//#define CAMERA_MODEL_M5STACK_PSRAM // Has PSRAM
//#define CAMERA_MODEL_M5STACK_V2_PSRAM // M5Camera version B Has PSRAM
//#define CAMERA_MODEL_M5STACK_WIDE // Has PSRAM
//#define CAMERA_MODEL_M5STACK_ESP32CAM // No PSRAM
//#define CAMERA_MODEL_AI_THINKER // Has PSRAM
//#define CAMERA_MODEL_TTGO_T_JOURNAL // No PSRAM

This is a list of several camera board names, each preceded with #define. One of these lines is active, while the others are inactive. The lines that start with // are inactive, while any without the slashes are active. We want to modify it so only the line for CAMERA_MODEL_AI_THINKER is active. To do so, make it look like this:

// Select camera model
//#define CAMERA_MODEL_WROVER_KIT // Has PSRAM
//#define CAMERA_MODEL_ESP_EYE // Has PSRAM
//#define CAMERA_MODEL_M5STACK_PSRAM // Has PSRAM
//#define CAMERA_MODEL_M5STACK_V2_PSRAM // M5Camera version B Has PSRAM
//#define CAMERA_MODEL_M5STACK_WIDE // Has PSRAM
//#define CAMERA_MODEL_M5STACK_ESP32CAM // No PSRAM
#define CAMERA_MODEL_AI_THINKER // Has PSRAM
//#define CAMERA_MODEL_TTGO_T_JOURNAL // No PSRAM

Next, we need to tell the ESP32-CAM about our wireless network. Find the following lines:

const char* ssid = "*********";
const char* password = "*********";

Now replace the asterisks with your network name (SSID) and the network password for your wireless access point. Replace only the asterisks and keep the double quotes.

Now, click the round checkmark button in the Arduino IDE toolbar (alternatively, select Verify/Compile from the Sketch menu). The Arduino IDE will say Compiling sketch. After some time, it will say Done compiling. If instead of seeing that, you get an error, it means you mistyped something. Verify your changes carefully, correct any errors and try again!

Once the compilation succeeds, the last step is to upload the program to the board. Connect the ESP32-CAM to your computer using a USB cable. Then, go to the Tools menu and look for an item that begins with “Port:and choose a serial port from the submenu. Then click the button that looks like an arrow in a circle from the Arduino toolbar (alternatively, select Upload from the Tools menu). The Arduino IDE will recompile, say Uploading for a while, and then finally say Done Uploading.

If you get an error that says your board is not connected, go to the Tools menu and select a different serial port from the submenu. Try each until you find one that works!

Now, click the button that looks like a magnifying glass in a box on the right side of the Arduino toolbar (alternatively, select Serial Monitor from the Tools menu). This will bring up a new window on your computer for output from the ESP32-CAM.

After resetting the above steps, push the small button on the right side of the ESP32-CAM-MB. This button should be labeled rst. As soon as you do this, you should see text in the Serial Monitor window. Look for the lines that look like this:

WiFi connected
Starting web server on port: '80'
Starting stream server on port: '81'
Camera Ready! Use 'http://192.168.1.9' to connect

On your smartphone, type the HTTP web address into a web browser. You will get a web page with a lot of different configuration options. Scroll down until you see the Start Stream button. Click that to get a live view of whatever the ESP32-CAM is seeing. Bookmark this web page so that you can return to it later!

Once you have verified that it works, you can disconnect the ESP32-CAM from your computer and take it anywhere you want to monitor and power it using a regular USB charger. From your smartphone, connect to the page you bookmarked to see the live view!

Now It’s Time to Apply What You’ve Learned

So, there you have it—a simple way to use the ESP32-CAM as a smartphone-accessible web camera! Use this to monitor your home, as a baby monitor or as a smart doorbell! Be aware that if you wish to monitor your ESP32-CAM from outside your home network, you will need to configure port forwarding on your Internet router.


ESP32-CAM in a 3D printed case on a tripod

How to Capture a Time-Lapse on a Low Budget Using the ESP32-CAM

Read Next


About The Author

Leave a Comment