In this tutorial we are going to learn how to setup ESP32 CAM module for live video streaming where the live video can be access via your local Wi-Fi network. We will see how to mount ESP-32 CAM on an RC car with couple of additional components using which you can turn your boring RC car into a cool RC controlled surveillance car. We will also see how to use this ESP32 camera module for multipurpose surveillance like: home surveillance, baby monitoring, spy camera etc.
We will see:
- How to upload code to ESP32 CAM and start video stream.
- How to mount ESP32 CAM on RC car.
- How to convert ESP32 CAM into multipurpose surveillance camera.
- How to trouble shoot issues with ESP32 CAM module.
ESP32 Camera Module:
How to upload code to ESP32 CAM for video streaming:
I have divided the process into small simple steps which you can follow easily to get live video stream on any web browser in your local Wi-Fi network.
Installing ESP32 board package to Arduino IDE:
Here we are going to download the core files for ESP32 board and you need internet for this step:
- Copy this link: https://dl.espressif.com/dl/package_esp32_index.json
- Open Arduino IDE and select File > Preferences:
- A window will pop-up; paste the link provided as shown. If there are some links already, separate it with a comma. Press OK.
- Now go to Tools > Boards > Boards Manager as shown below:
- Now a window will pop-up and type “ESP32” in the search bar:
Select the latest version and click install. Download will take some time depending on your internet speed.
Setting up hardware for programming:
Since ESP32 CAM doesn’t come with a USB connector we have to use FTDI programmer to upload code. Please only use “FT232R” or “FT232RL” model FTDI programmer. Several readers informed that by using some other types of FTDI programmers the code could not get uploaded.
Use FTDI programmer board that look like this (FT232R / FT232RL):
Circuit for uploading code to ESP32 CAM:
- Select 5V using the jumper provided on FTDI programmer (not 3.3V).
- Don’t forget to connect IO0 and GND.
Now open Arduino IDE select File > Examples > ESP32 > Camera > CameraWebServer as shown below:
You will see a code like this:
- You have to replace “*****” with your Wi-Fi “SSID” and “Password”.
- You have to command #define CAMERA_MODEL_WROVER_KIT and uncommand #define CAMERA_MODEL_AI_THINKER as shown below:
Now select Tools and change the following settings:
- Now press reset button provided on ESP32 CAM module (Important).
- Click upload on Arduino IDE.
On successful program upload you will see this:
- Now disconnect IO0 and GND (Important).
- Open the serial monitor with 115200 baud rate.
- Press reset button on ESP32 CAM module once again.
- You will get an IP address and you have to enter it in your browser.
- Initially the camera interface will load, you have to press “start streaming” and you will see live stream from your ESP32 CAM.
You can even stream from your phone:
Some useful observations:
- Higher the resolution you select, lower the frame rate you will get and vice-versa.
- You will get lower frame rate, if you are far from your Wi-Fi router and vice-versa.
- When the camera is not streaming it consumes 90mA, when streaming at lower resolution it consumes 160mA and at high resolution it consumes 200mA on average.
How to stream video from RC car using ESP32 CAM
In this tutorial we are going to learn how can we mount ESP32 CAM on a RC car with just additional to components.
The two additional components are:
- 3.7V Li-ion battery.
- 5V boost converter.
Here you need to apply your creativity skills for mounting the camera, battery and the boost converter; you need to find an optimal position for the camera. For my car mounting at the top was the best choice.
Here I used a 3.7V 18650 li-ion cell salvaged from an old laptop which has capacity of 2000mAh. For 5V boost converter I salvaged one from cheap Chinese single cell power bank, the advantage of using such boost converter is that it has built-in charger circuit and a under voltage cut-off function.
Here is a quick short video demonstrating the above setup:
ESP32 CAM as Multipurpose Camera
In this section we are going to see how to use ESP32 CAM module for general purpose surveillance. We are going to use the exact same setup as mentioned in previous section. The only change here we are going to make is mounting the camera, battery and the voltage booster in a small junk box as shown below:
Charging the battery:
As a surveillance camera:
You can use this camera for home surveillance, baby monitoring, pet monitoring etc. You can stream live footage within your local Wi-Fi network. I am using this camera as home surveillance to see who is at my door step when someone rings the bell.
As a spy camera:
You may use your creativity to mount the camera inside a doll or hide the camera inside an everyday object which doesn’t looks suspicious to others; this will make an effective spy camera.
How long ESP32 CAM can operate on battery?
I have used a 2000mAh battery and ESP32 CAM consumes 200mA which gives 2000mAh / 200mA = 10 hour. But in real life after considering losses and cut-off voltage, you will get around 5 hours of continuous operation on single charge.
Can ESP32 camera record the footage?
Unfortunately using the given example code we can only live stream and it cannot record. But, we can use screen recorder software to record the footage from the browser.
Can it record voice?
No, ESP32 CAM doesn’t come with a microphone but we can write a program and connect a microphone to it, but this is a subject for another project.
Can I attach an external antenna?
ESP32 CAM comes with a tiny antenna port close to PCB etched antenna. But I soldered a simple wire with length of 10 cm to the PCB etched antenna. Surprisingly this hack did boost the signal quite a bit and I was getting decent frame rate far away from my Wi-Fi router, you can spot a yellow wire on the prototype.
Troubleshooting with ESP32 CAM:
Here I am going to share some of the difficulties I faced while working with ESP32 CAM module.
Program code not uploading to ESP32 CAM:
If the code did not upload you see this error, the reasons and fixes are explained below.
1) Wrong FTDI Programmer:
Initially I did not use a FTDI programmer, instead I used an Arduino Uno board with microcontroller removed to utilize its built-in USB to serial converter which can be accessed at Tx and Rx pins. This method worked for several Arduino and IoT boards which don’t come with USB connector and I assumed same for ESP32 CAM module.
But to my surprise I couldn’t upload any program to ESP32 CAM and decided to spend some bucks for a FTDI programmer and searched online and found several types: CH340, FT232R etc. After a little in depth research some of the hobbyists mentioned that they could not get the program uploaded with CH340 USB to serial converter FTDI and some mentioned some other models.
Finally, I found that FT232R / FT232RL can upload code to ESP32 CAM without any issue. If you want assured success please use the mentioned FTDI programmer model and thankfully it is very commonly available.
2) You did not press reset the button on ESP32 CAM before uploading:
You have to press the reset button provided on-board only then it can accept the incoming program code.
3) You did not connect IO0 to GND:
You have to connect IO0 to GND for programming. Once you uploaded the code successfully you should remove it.
4) Program uploaded but no IP address on serial monitor:
If you successfully uploaded the program but if you get a blank serial monitor, do the following:
- You should open the serial monitor with 115200 baud rate.
- You have to remove IO0 and GND.
- You have to press reset button on the ESP32 CAM after the above two steps only then IP address will be displayed.
5) No FTDI driver installed:
When you plug your FTDI programmer to a PC, windows will automatically find a suitable driver for the FTDI programmer, but this is not the case always. When I plugged my FTDI to PC, windows could not recognize it. On the device manager it was showing this:
If you find yourself in the same situation, you have install FTDI driver which you can download it from here.
- Select 32 or 64 bit depending on your processor architecture and unzip it:
You can also download for Mac OS.
- Right click on the FT232R (device manager) which has to be fixed and click on update driver, you will be prompted with two options. Click on browse driver from my computer.
- Browse the location and select the unzipped folder:
- Press next and finish. Your FTDI programmer will function properly.
If you have any question regarding this project/tutorial feel free to ask us in the comment section, you will get a guaranteed reply from us.