In this project we’re going to build an IP surveillance camera with the ESP32-CAM board. The ESP32 camera is going to host a video streaming web server that you can access with any device in your network.
You can integrate this video streaming web server with popular home automation platforms like Home Assistant or Node-RED. In this tutorial, we’ll show you how to integrate it with Home Assistant and Node-RED.
Watch the Video Tutorial
You can watch the video tutorial or keep reading this page for the written instructions.
Parts Required
To follow this tutorial you need the following components:
- ESP32-CAM with OV2640 – read Best ESP32-CAM Dev Boards
- FTDI programmer
- Female-to-female jumper wires
- Fake/dummy dome security camera
- 5V power supply for ESP32-CAM
- Optional – Home Assistant on Raspberry Pi:
You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!
Introducing the ESP32-CAM
The ESP32-CAM is a very small camera module with the ESP32-S chip that costs less than $10. You can read our getting started guide for the ESP32-CAM and learn how to use the Video Streaming and Face Recognition example.
Video Streaming Server
Follow the next steps to build a video streaming web server with the ESP32-CAM that you can access on your local network.
1. Install the ESP32 add-on
In this example, we use Arduino IDE to program the ESP32-CAM board. So, you need to have Arduino IDE installed as well as the ESP32 add-on. Follow one of the next tutorials to install the ESP32 add-on, if you haven’t already:
- Installing the ESP32 Board in Arduino IDE (Windows instructions)
- Installing the ESP32 Board in Arduino IDE (Mac and Linux instructions)
2. Video Streaming Web Server Code
After that, copy the code below to your Arduino IDE.
/*********
Rui Santos
Complete project details at https://RandomNerdTutorials.com/esp32-cam-video-streaming-web-server-camera-home-assistant/
IMPORTANT!!!
- Select Board "AI Thinker ESP32-CAM"
- GPIO 0 must be connected to GND to upload a sketch
- After connecting GPIO 0 to GND, press the ESP32-CAM on-board RESET button to put your board in flashing mode
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
*********/
#include "esp_camera.h"
#include <WiFi.h>
#include "esp_timer.h"
#include "img_converters.h"
#include "Arduino.h"
#include "fb_gfx.h"
#include "soc/soc.h" //disable brownout problems
#include "soc/rtc_cntl_reg.h" //disable brownout problems
#include "esp_http_server.h"
//Replace with your network credentials
const char* ssid = "REPLACE_WITH_YOUR_SSID";
const char* password = "REPLACE_WITH_YOUR_PASSWORD";
#define PART_BOUNDARY "123456789000000000000987654321"
// This project was tested with the AI Thinker Model, M5STACK PSRAM Model and M5STACK WITHOUT PSRAM
#define CAMERA_MODEL_AI_THINKER
//#define CAMERA_MODEL_M5STACK_PSRAM
//#define CAMERA_MODEL_M5STACK_WITHOUT_PSRAM
// Not tested with this model
//#define CAMERA_MODEL_WROVER_KIT
#if defined(CAMERA_MODEL_WROVER_KIT)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 21
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 19
#define Y4_GPIO_NUM 18
#define Y3_GPIO_NUM 5
#define Y2_GPIO_NUM 4
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22
#elif defined(CAMERA_MODEL_M5STACK_PSRAM)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 25
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 32
#define VSYNC_GPIO_NUM 22
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21
#elif defined(CAMERA_MODEL_M5STACK_WITHOUT_PSRAM)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 25
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 17
#define VSYNC_GPIO_NUM 22
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21
#elif defined(CAMERA_MODEL_AI_THINKER)
#define PWDN_GPIO_NUM 32
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 0
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 21
#define Y4_GPIO_NUM 19
#define Y3_GPIO_NUM 18
#define Y2_GPIO_NUM 5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22
#else
#error "Camera model not selected"
#endif
static const char* _STREAM_CONTENT_TYPE = "multipart/x-mixed-replace;boundary=" PART_BOUNDARY;
static const char* _STREAM_BOUNDARY = "\r\n--" PART_BOUNDARY "\r\n";
static const char* _STREAM_PART = "Content-Type: image/jpeg\r\nContent-Length: %u\r\n\r\n";
httpd_handle_t stream_httpd = NULL;
static esp_err_t stream_handler(httpd_req_t *req){
camera_fb_t * fb = NULL;
esp_err_t res = ESP_OK;
size_t _jpg_buf_len = 0;
uint8_t * _jpg_buf = NULL;
char * part_buf[64];
res = httpd_resp_set_type(req, _STREAM_CONTENT_TYPE);
if(res != ESP_OK){
return res;
}
while(true){
fb = esp_camera_fb_get();
if (!fb) {
Serial.println("Camera capture failed");
res = ESP_FAIL;
} else {
if(fb->width > 400){
if(fb->format != PIXFORMAT_JPEG){
bool jpeg_converted = frame2jpg(fb, 80, &_jpg_buf, &_jpg_buf_len);
esp_camera_fb_return(fb);
fb = NULL;
if(!jpeg_converted){
Serial.println("JPEG compression failed");
res = ESP_FAIL;
}
} else {
_jpg_buf_len = fb->len;
_jpg_buf = fb->buf;
}
}
}
if(res == ESP_OK){
size_t hlen = snprintf((char *)part_buf, 64, _STREAM_PART, _jpg_buf_len);
res = httpd_resp_send_chunk(req, (const char *)part_buf, hlen);
}
if(res == ESP_OK){
res = httpd_resp_send_chunk(req, (const char *)_jpg_buf, _jpg_buf_len);
}
if(res == ESP_OK){
res = httpd_resp_send_chunk(req, _STREAM_BOUNDARY, strlen(_STREAM_BOUNDARY));
}
if(fb){
esp_camera_fb_return(fb);
fb = NULL;
_jpg_buf = NULL;
} else if(_jpg_buf){
free(_jpg_buf);
_jpg_buf = NULL;
}
if(res != ESP_OK){
break;
}
//Serial.printf("MJPG: %uB\n",(uint32_t)(_jpg_buf_len));
}
return res;
}
void startCameraServer(){
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
config.server_port = 80;
httpd_uri_t index_uri = {
.uri = "/",
.method = HTTP_GET,
.handler = stream_handler,
.user_ctx = NULL
};
//Serial.printf("Starting web server on port: '%d'\n", config.server_port);
if (httpd_start(&stream_httpd, &config) == ESP_OK) {
httpd_register_uri_handler(stream_httpd, &index_uri);
}
}
void setup() {
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); //disable brownout detector
Serial.begin(115200);
Serial.setDebugOutput(false);
camera_config_t config;
config.ledc_channel = LEDC_CHANNEL_0;
config.ledc_timer = LEDC_TIMER_0;
config.pin_d0 = Y2_GPIO_NUM;
config.pin_d1 = Y3_GPIO_NUM;
config.pin_d2 = Y4_GPIO_NUM;
config.pin_d3 = Y5_GPIO_NUM;
config.pin_d4 = Y6_GPIO_NUM;
config.pin_d5 = Y7_GPIO_NUM;
config.pin_d6 = Y8_GPIO_NUM;
config.pin_d7 = Y9_GPIO_NUM;
config.pin_xclk = XCLK_GPIO_NUM;
config.pin_pclk = PCLK_GPIO_NUM;
config.pin_vsync = VSYNC_GPIO_NUM;
config.pin_href = HREF_GPIO_NUM;
config.pin_sccb_sda = SIOD_GPIO_NUM;
config.pin_sccb_scl = SIOC_GPIO_NUM;
config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM;
config.xclk_freq_hz = 20000000;
config.pixel_format = PIXFORMAT_JPEG;
if(psramFound()){
config.frame_size = FRAMESIZE_UXGA;
config.jpeg_quality = 10;
config.fb_count = 2;
} else {
config.frame_size = FRAMESIZE_SVGA;
config.jpeg_quality = 12;
config.fb_count = 1;
}
// Camera init
esp_err_t err = esp_camera_init(&config);
if (err != ESP_OK) {
Serial.printf("Camera init failed with error 0x%x", err);
return;
}
// Wi-Fi connection
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.print("Camera Stream Ready! Go to: http://");
Serial.print(WiFi.localIP());
// Start streaming web server
startCameraServer();
}
void loop() {
delay(1);
}
Before uploading the code, you need to insert your network credentials in the following variables:
const char* ssid = "REPLACE_WITH_YOUR_SSID";
const char* password = "REPLACE_WITH_YOUR_PASSWORD";
Then, make sure you select the right camera module. In this case, we’re using the AI-THINKER Model.
If you’re using the same camera module, you don’t need to change anything on the code.
#define CAMERA_MODEL_AI_THINKER
Now, you can upload the code to your ESP32-CAM board.
3. Uploading the Code
Connect the ESP32-CAM board to your computer using an FTDI programmer. Follow the next schematic diagram:
Many FTDI programmers have a jumper that allows you to select 3.3V or 5V. Make sure the jumper is in the right place to select 5V.
Important: GPIO 0 needs to be connected to GND so that you’re able to upload code.
ESP32-CAM | FTDI Programmer |
GND | GND |
5V | VCC (5V) |
U0R | TX |
U0T | RX |
GPIO 0 | GND |
To upload the code, follow the next steps:
1) Go to Tools > Board and select AI-Thinker ESP32-CAM.
2) Go to Tools > Port and select the COM port the ESP32 is connected to.
3) Then, click the upload button to upload the code.
4) When you start to see these dots on the debugging window as shown below, press the ESP32-CAM on-board RST button.
After a few seconds, the code should be successfully uploaded to your board.
Getting the IP address
After uploading the code, disconnect GPIO 0 from GND. Open the Serial Monitor at a baud rate of 115200. Press the ESP32-CAM on-board Reset button.
The ESP32 IP address should be printed in the Serial Monitor.
Accessing the Video Streaming Server
Now, you can access your camera streaming server on your local network. Open a browser and type the ESP32-CAM IP address. A page with the current video streaming should load.
Home Assistant Integration
Having just the ESP32-CAM working via IP might be useful for most people, but you can integrate this project with Home Assistant (or with other home automation platforms). Continue reading to learn how to integrate with Home Assistant.
Prerequisites
- You should be familiar with the Raspberry Pi – read Getting Started with Raspberry Pi.
- Getting Started with Home Assistant on Raspberry Pi
Adding ESP32-CAM to Home Assistant
Open your Home Assistant dashboard and go to the more Settings menu.
Open Configure UI:
Add a new card to your Dashboard:
Pick a card of the type Picture.
In the Image URL field, enter your ESP32-CAM IP address. Then, click the “SAVE” button and return to the main dashboard.
If you’re using the configuration file, this is what you need to add.
After that, Home Assistant can display the ESP32-CAM video streaming.
Taking It Further
To take this project further, you can use one fake dummy camera and place the ESP32-CAM inside.
The ESP32-CAM board fits perfectly into the dummy camera enclosure.
You can power it using a 5V power adapter through the ESP32-CAM GND and 5V pins.
Place the surveillance camera in a suitable place.
After that, go to the camera IP address or to your Home Assistant dashboard and see in real time what’s happening. The following image shows us testing the video streaming camera. Sara is taking a screenshot while I’m filming the camera.
It’s impressive what this little $9 ESP32 camera module can do and it’s been working reliably. Now, we can use the surveillance camera to see in real time what’s happening in my front entrance.
Tip: Node-RED Integration
The video streaming web server also integrates with Node-RED and Node-RED Dashboard. You just need to create a Template node and add the following:
<div style="margin-bottom: 10px;">
<img src="https://YOUR-ESP32-CAM-IP-ADDRESS" width="650px">
</div>
In the src attribute, you need to type your ESP32-CAM IP address:
<div style="margin-bottom: 10px;">
<img src="https://192.168.1.91" width="650px">
</div>
Troubleshooting
If you’re getting any of the following errors, read our ESP32-CAM Troubleshooting Guide: Most Common Problems Fixed
- Failed to connect to ESP32: Timed out waiting for packet header
- Camera init failed with error 0x20001 or similar
- Brownout detector or Guru meditation error
- Sketch too big error – Wrong partition scheme selected
- Board at COMX is not available – COM Port Not Selected
- Psram error: GPIO isr service is not installed
- Weak Wi-Fi Signal
- No IP Address in Arduino IDE Serial Monitor
- Can’t open web server
- The image lags/shows lots of latency
Wrapping Up
In this tutorial, we’ve shown you how to build a simple video streaming web server with the ESP32-CAM board to build an IP camera. The web server we’ve built can be easily integrated with your home automation platform like Node-RED or Home Assistant.
We hope you’ve find this tutorial useful. If you don’t have an ESP32-CAM yet, you can grab it here.
If you like this project, you may also like other projects with the ESP32-CAM:
- ESP32-CAM Video Streaming and Face Recognition with Arduino IDE
- ESP32-CAM Take Photo and Save to MicroSD Card
- ESP32-CAM PIR Motion Detector with Photo Capture (saves to microSD card)
- ESP32-CAM Take Photo and Display in Web Server
- Build ESP32-CAM Projects (eBook)
- Read all our ESP32-CAM Projects, Tutorials and Guides
Thanks for reading!
Are you going to do follow-up for integrating this into Node-RED?
Please…
Yes. We intend to integrate this with Node-RED too.
The face recognition and triggering events might be a bit more difficult. We’ll see…
Regards,
Sara
my camera is very weak wifi signal, any ideas?
Hi.
Try powering the camera with 5V.
Some readers reported improvements in wifi signal after powering with 5V.
Regards,
Sara
THX 🙂
Hi Sara,
I have three ESP 32 cams that I am having trouble with. When I reset them they will work for 8 to 10 hours. After that they will be still online (ping OK) but their web servers stop responding. The message is:
This site can’t be reached
192.168.1.196 took too long to respond.
Try:
Checking the connection
Checking the proxy and the firewall
Running Windows Network Diagnostics
ERR_CONNECTION_TIMED_OUT
The only way to get them working again is to reset them or cycle the power. It will then work for 1 to 3 days and hang up again.
I tried one of your sketches at first, then switched to the sketch in the Arduino examples (the one with all the camera controls). No improvement.
I have three of these cams and sometimes they all stop working together, or sometimes one at a time.
I tried inserting code in the LOOP() to reconnect to WiFi and then to start the web server every 10 seconds (10 second delay already in there) but this made it worse.
Do you have any idea how I can troubleshoot this? Maybe put in code to make them reboot once a day or something like that? Maybe there is a memory leak somewhere? My “ESP8266 with BME 280” (which also has a web server) is much more reliable.
I would appreciate your thoughts on this.
Thank you
Mike.
……….
Check the jumper 0K resistor by the antenna connector is in the proper position for the antenna desired. There are 3 little white squares laid out like a “<" with the middle position being common. With board turned so the the pcb antenna up, to use the pcb antenna, the resistor must be on the top position, like this: /
For the antenna connector, the resistor must be on the bottom position, like this: \
I had this problem with 0Ohm resistor directed to the external antenna …
Hi Carlos,
I have three ESP32-CAM boards and I have a problem occasionally where I cannot get a still or stream. The response is:
This page isn’t working
192.168.1.196 didn’t send any data.
ERR_EMPTY_RESPONSE
If I PING the board’s IP address, I almost always get a normal ping response, but still cannot see the camera. I have to reset or cycle power to restore operation.
The other day, all three became unavailable together.
I tried your sketch, then another sketch with all the camera controls. Same problem.
I put in some code to reconnect to WiFi in case it disconnects, but that did not help.
I also have an ESP8266 Weather station with BME280 and that always works (maybe I had to reset it once in the past six months).
What do you think I can do to fix this problem?
Hello Mrs Data
Iam build Esp32 to windows 7
Then iam trying and follow the instruction.
When iam compile the code
Serial Port COM3
Connecting……_____…….______
A fatal error occured: Failed to connect to Esp32: time out waiting for packer header
Can you help me ?
Hi.
Take a look at our troubleshooting guide: https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/
Regards,
Sara
Sara do you now if I have to reset camera every time I unplug it ?
Try switching the rx and tx connections around
I meant completely integrating it in Node-RED – available on the dashboard as a viewable feed, face recognition triggering events, etc.
can you change the port ?
What do you mean?
I’d like to create a battery powered version that uses the ESP32’s deep sleep mode (with motion detection to wake it up) and low battery notifications.
That’s probably going to be one of my next projects! Thanks for the suggestion
I am looking forward to the motion detection function. Now I am connect to motioneye by your code, but I can’t open my flashlight on esp32-cam. I have two choice, one is open it by motion detector on board. The other one is open it by HA. Unfortunately, I think HA can’t contorl esp32 IO out of esphome. Could you give me some suggestion?
The built in LED is meant for a flash, it will get very hot if used continuously. If you can find the pinout, then you just control the LED like you would any other.
Dear Sir,
That’s a lovely project.
However, I’m not getting the some of the header files used in the arduino sketch. They are esp_camera.h, “esp_http_server.h”,
esp_timer.h,img_converters.h
Can you please be kind enough to help me getting these header files?
Thanks in advance..
Rgds.
S. Bera
Hi.
Do you have the ESP32 add-on installed?https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/
Fantastic! Any suggestions on how to use it to capture video? IE: if it could detect motion with a passive IR added in addition to the ESP32 camera…and that motion could trigger the local PC to record for X minutes, that would be FANTASTIC.
Hi Ben.
That’s a great idea.
We intend to do a similar project in the future.
The example code provided in the arduino IDE, also takes photos. The one we use here: https://randomnerdtutorials.com/esp32-cam-video-streaming-face-recognition-arduino-ide/
But it will take some time to figure out the parts of code that do that and the best way to do it.
As for saving footage, we still need to figure it out.
Regards,
Sara
Hi Sara,
Most excellent! I look forward to it. Got several of the boards on the way. I’m thinking that instead of putting the board into a security camera housing, I’m going to mount it to the inside of a window facing to the outside. Should work well and not require any environmental sealing. 🙂
Thanks much,
ben
Hi, I wanted to know if it was possible to reduce the latency of the image, and if it were possible to use an ESP8266. Thank you.
I don’t think so, you need a more powerful board to run the CAM reliably (like the ESP32).
Rui,
My daughter is into Legos and wants me to help her to develop a Lego Sorter.
How difficult would it be to adapt the face recognition SW to learn to recognize objects?
Thanks to you and Sara for all the information and work you do to educate people.
Regards,
Lloyd
Hi Lloyd.
At the moment, I don’t think it is easy to do that with the ESP32-CAM and arduino IDE. It’s a quite new topic and there aren’t many libraries available to do that.
There are much more support for object recognition using raspberry pi and its camera at the moment.
Regards,
Sara
HI, I’m using this esp32 camera from M5Stack-Camera-Antenna-Arduino-Raspberry
When the code executes this line:
fb = esp_camera_fb_get();
it never returns. I’ve place a Serial.println() before and after the line, and the line after never prints out.
The only camera model setting that passes the camera init and probe is this: CAMERA_MODEL_M5STACK_PSRAM.
Here are the things that I’ve tried:
— created OV2640 config : fails camera init and probe
— changed jpeg_quality making from a Min of 1 to a max of 12
— Changed fb_count numbers 1-3
What would you suggest?
Thanks in advance,
Hi Robert.
I have no idea what can be wrong. We haven’t tested this with the M5Stack camera.
Have you tested this example? Did it work? https://randomnerdtutorials.com/esp32-cam-video-streaming-face-recognition-arduino-ide/
We’ve already ordered a M5Stack camera to test our scripts with that camera.
Regards,
Sara
Hi Sara,
This project is awesome. I would like to know if you can access the ESP32Cam from another device (cellphone etc) that is connected to another WiFi server.
Hi Magdalena.
What do you mean by “it is connected to another WiFi server”?. I’m not sure if I understood your question.
In this particular example, to access the video streaming you need to be connected to the same network that the ESP32-CAM is connected to.
Regards,
Sara
Yes, that would be possible in a number of ways. You could use a VPN to connect your phone to the network, you could stream from the ESP32-CAM to a proxy server in the cloud, or you could set up port forwarding on your firewall. These, however, are general networking questions.
I’ve used the free version of Netcam Studio X for a long time with this project and six ESP32 cams. Two cameras are in the clear on the free version. You can still have as many as you like, but the others have a watermark across their images. I can view them all on the local network or from anywhere in the world using the Studio X app on my phone
Hi.
thanks for sharing that.
I didn’t know about that software.
Regards,
Sara
Hi Sara
Quite a lot of features and simple to set up. Works reliably, and doesn’t gobble a lot of local resources. I went through trying a lot of camera remote viewing / streaming apps with very limited and variable results before finding this one. The local server can run as a background service, so will auto-start with the computer. As well as having the app to view the cameras from anywhere on your phone, there is also a local ‘client’ app that allows you to view all the cameras on the host computer
Thank you so much for this great project. Is there a way to reduce the video latency?
Hello.
When I try to upload the sketch to the ESP32 CAM an error mesagge shows “Failed to connect to ESP32: Timed out waiting for packet header”.
I’ve checked the connections, pressed Reset before and during the upload attempt, connected to 3.3v and 5v, used //#define CAMERA_MODEL_WROVER_KIT and #define CAMERA_MODEL_AI_THINKER.
Please, I’ll be glad to know if you have any suggestions of something else to try.
Best wishes.
Hi Marcelo.
I’m sorry you’re having trouble with your board.
Please verify that you have the ESP32 GPIO0 connected to GND during the uploading.
Also, make sure that in the arduino ide settings, you select Tools > Partition Scheme, select “Huge APP (3MB No OTA)“.
It this doesn’t work, it is very difficult for me to understand what might be wrong.
Regards,
Sara
Wow, what a brilliant, inspiring idea !!!
Just last week I received some of these camera’s. I ordered them from China some time ago, but it took some time before they were shipped.
(I guess they are very popular)
Yesterday I assembled and programmed the ESP-CAM and found out that it works well when you use a powerbank, you can just walk around with it !
(also found out that you can program the board with a USB-to-TTL module model CP2102 and that the CH340 model does NOT work)
Then I searched the whole house for my old dummy camera’s..
and found them today, haha. They are not as easy to use as yours,
but some are ‘workable’.
Surprisingly enough, I managed to build my first dummy-ESP-CAM today !
I use it to watch my front door, it’s battery operated (3xAA-rechargable-2000mAh) and it works very well !
They is some (a few seconds) time-lag (latency ?) between what happens and it showing up on screen, but other than that the camera works fine and I love that I can see who’s at my front door before I open it !
Now we will have to learn by experience how long these batteries will last…
Your explanation was very easy to follow and my ESP-CAM was up and running before I knew it…. getting it into my old dummy-cam was (a lot) more work…
Thank you again, for another inspiration ! I had a great day building it !
Hi Gerrit.
Thank you so much for your nice words.
I’m really happy when I see that our readers can actually make our projects and put them working in a real world scenario.
Then, let me know how long your batteries last.
Thank you for your interest and enthusiasm in our projects.
Regards,
Sara
Hi Gerrit,
I was quite interesting what you have done. Can I know how you regulated the input voltage from 3AA batteries? I assume they were either 3.6 (1.2v3) or 4.5 (1.5v3). Did you supply current directly to 3v3 pin or some regulated manner? Thanks in advance!
P.S.
Thank you RNT for the amazing article.
Cheers
I ordered the components from Maker Advisor but received an unknown model of the ESP32CAM, with which none of the three camera settings work. Since the serial monitor reports: “[D][esp32-hal-psram.c:47] psramInit(): PSRAM enabled”
I guessed this must be the M5STACK_PSRAM model, but booting with this setting sends the error message “Camera init failed with error 0x20001”.
The WROVER_KIT setting als returns these errors: “SCCB_Write [ff]=01 failed; SCCB_Write [12]=80 failed; Camera init failed with error 0x20001”
And the AI_THINKER setting complains about an illegal instruction, reboots and then gives no more information after the “PSRAM enabled” message.
Any ideas?
Pierre
I ordered the components from Maker Advisor but received an unknown model of the ESP32CAM, with which none of the three camera settings work. Since the serial monitor reports: “[D][esp32-hal-psram.c:47] psramInit(): PSRAM enabled”
I guessed this must be the M5STACK_PSRAM model, but booting with this setting sends the error message “Camera init failed with error 0x20001”.
The WROVER_KIT setting als returns these errors: “SCCB_Write [ff]=01 failed; SCCB_Write [12]=80 failed; Camera init failed with error 0x20001”
And the AI_THINKER setting complains about an illegal instruction, reboots and then gives no more information after the “PSRAM enabled” message.
Any ideas?
Pierre
(my earlier message about being unable to flash are obsolete now, they were due to a faulty FT232)
Hi Pierre.
I’m sorry you’re having trouble with your camera.
Have you selected “Huge App Huge APP (3MB No OTA)”?
Can you try this example and see if it works: https://randomnerdtutorials.com/esp32-cam-video-streaming-face-recognition-arduino-ide/
Regards,
Sara
Rui,
I purchased three ESP32-CAM modules from Banggood with camera.
I have tried everything I could find on internet to program anything on them. I keep getting “Timed out waiting for packet header” error. Nothing ever get programmed? Even used an external power supply and nothing works.
These modules do not say “AI-THINKER” on them. Might be a different module but cannot prove it this way.
Any more ideas:
Thanks, Joe L.
Hi Joseph.
That error means that your ESP is not in flashing mode.
Please check that you’ve wire the RX and TX pins properly to the FTDI programmer, and that the ESP32 GPIO0 is connected to GND.
Regards,
Sara
Sara,
I have TX going to RX etc. and GPI0 going to gnd. I press boot buton before programming and serial says “waiting for download”. How can I know if ESP32 in flashing mode?
Tried every mode possible and same result.
The programmer works ok on other standard ESP32 modules.
Thanks Joe L.
Hi Rui,
I purchased two ESP32-CAM modules from Banggood with camera; they are exactly same than yours.
I tried everything I found on your kind blog to program on them.
I keep getting ever “Timed out waiting for packet header” error as follows:
esptool.py v2.6-beta1
Serial port COM8
Connecting…….._____….._____….._____….._____….._____….._____….._____
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
I have TX going to RX etc. and GPI0 going to gnd.
I pressed boot button before programming.
Tried every mode possible and same result.
The programmer works fine on other standard ESP32 modules.
Any idea Sara/Rui?
I purchased my esp32-cam from banggood they do not say Ai-Thinker on them.
Ihave yet to get it to work but was able to get the program loaded.I was getting the same error as you.In the if you are using Windows in the Control Panel check to make sure you have a good Driver for the COM port you are using try updating the driver.
try the chip id example sketch to make sure you are connected right
Hi, I purchased one of these little guys about six months ago, I was playing with it, and suddenly, it stopped working. I have tried to reprogram it, but to no avail, so due to the relativly low price and my love for everything esp related, I ordered another from Banggoods, where I got my first. The second one programs like a dream and works fine, even recognizes me now, so I figured I had the problem licked, I dug out my old one and still no luck. I am guessing some of my playing around probably nuked the board on the first one. It will go in my parts drawer I think for future fun and games as I progress with my knowledge of these little guys, or perhaps till the ESP64 comes out.
showing
leaving the hardware resetting
via rts pin what should id o
Hi.
That means the code was successfully uploaded.
Disconnect GPIO 0 from GND, open the Serial Monitor and press the ESP32-CAM on-board RESET button to get its IP address.
Then, you just need to open a browser and type the ESP32-CAM IP address.
Regards,
Sara
I had exactly the same problem. Used another type of FT232 board (bought on Amazon) and the communication problems were solved. But my ESP32 cam boards from Banggood are also of an unknown type that does not work with the software provided in this article…
I had this problem and it was not enough power through USB source I fed +5 to Vcc pin and that fixed it. It was brown out in my case.
Hi Domenico.
That error means that the ESP32 is not in flashing mode.
You have to follow the exact same instructions we have in our tutorial.
By what you’re describing, it seems that you’re doing everything right. If you’re doing as we describe in our tutorial and it doesn’t work, I don’t know what can be the problem.
Also, as Richard said “If you are using Windows in the Control Panel check to make sure you have a good Driver for the COM port you are using try updating the driver.”
I’m sorry that I can’t help much. Meanwhile, if you find out the problem let us know. We’re planning to write a troubleshooting guide for the ESP32-CAM.
Regards,
Sara
Ho guy..finally i fixed It. Wrong rx tx connection! 🙁
Great!
I’m glad you’ve fixed it 🙂
But I have not solved because i got an cam init error 20001 unfortunalely! Any idea?
Hi Sara, the flashing is now Okay; but I got this error ; could be it due to cam related. Right?
PS: I purchased my esp32-cam from banggood they do not say Ai-Thinker on them, but they are exactly same than yours. Any idea to solve in case not exactly the AI-Thinker camera?
=========================================
18:46:14.539 -> configsip: 0, SPIWP:0xee
18:46:14.539 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
18:46:14.539 -> mode:DIO, clock div:1
18:46:14.539 -> load:0x3fff0018,len:4
18:46:14.539 -> load:0x3fff001c,len:1100
18:46:14.539 -> load:0x40078000,len:10088
18:46:14.539 -> load:0x40080400,len:6380
18:46:14.539 -> entry 0x400806a4
18:46:16.939 -> Guru Meditation Error: Core 0 panic’ed (LoadProhibited). Exception was unhandled.
18:46:17.059 -> Core 0 register dump:
18:46:17.059 -> PC : 0x4014284b PS : 0x00060830 A0 : 0x80140b67 A1 : 0x3ffd3150
18:46:17.059 -> A2 : 0x3ffc8c08 A3 : 0x401417d8 A4 : 0x00000002 A5 : 0x00000005
18:46:17.059 -> A6 : 0x0000000b A7 : 0x00000003 A8 : 0x80142845 A9 : 0x3ffd3130
18:46:17.059 -> A10 : 0x4000446c A11 : 0x400041fc A12 : 0x3ffc8c50 A13 : 0x00000007
18:46:17.059 -> A14 : 0x3ffae0c0 A15 : 0x00000008 SAR : 0x0000001c EXCCAUSE: 0x0000001c
18:46:17.059 -> EXCVADDR: 0x00000002 LBEG : 0x4008d664 LEND : 0x4008d67c LCOUNT : 0x00000000
18:46:17.059 ->
18:46:17.059 -> Backtrace: 0x4014284b:0x3ffd3150 0x40140b64:0x3ffd3180 0x4014105c:0x3ffd31a0 0x400dd8a6:0x3ffd3260 0x400ddb56:0x3ffd3290 0x40115439:0x3ffd32c0 0x4011553c:0x3ffd32f0 0x4011583e:0x3ffd3320 0x401159b3:0x3ffd3350 0x4008b5c8:0x3ffd3370 0x40091b11:0x3ffd33b0
18:46:17.059 ->
18:46:17.059 -> Rebooting…
18:46:17.059 -> ets Jun 8 2016 00:22:57
18:46:17.059 ->
18:46:17.059 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
18:46:17.059 -> configsip: 0, SPIWP:0xee
18:46:17.059 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
18:46:17.059 -> mode:DIO, clock div:1
18:46:17.059 -> load:0x3fff0018,len:4
18:46:17.059 -> load:0x3fff001c,len:1100
18:46:17.059 -> load:0x40078000,len:10088
18:46:17.059 -> load:0x40080400,len:6380
18:46:17.059 -> entry 0x400806a4
18:46:18.739 -> SCCB_Write [ff]=01 failed
18:46:18.739 -> SCCB_Write [12]=80 failed
18:46:18.859 -> Camera init failed with error 0x20001
===============================================
After flashing, you need to remove the connection between GND and IO0. If you see the error (below) – that indicates the ESP-32 is in boot mode, try adding a 10K resistor between IO0 and 3.3V to make sure the state of this pin/input isn’t floating. Once I added the resistor, everything worked for me!
I have the same problem as ‘Domenico’ – I ordered 2 ESP32-CAM modules from Banggood and they also do not recognise the camera…they are also not marked AI Thinker…
I had the same issue Chris Parsons. I bought 2 ESP32-CAM modules from Amazon. I paid a premium to get them quickly. They are from DIYMORE. They do not work with the examples here. I replaced them with 2 from Banggood that are labelled AI Thinker and they work just fine
I actually bought my modules from Banggood – the advert shows ‘AI Thinker’ but they sent what I suspect is an ‘equivalent’ that doesn’t work – so now I will have to convince them to refund me and send the correct ones – and wait another 2 weeks 🙁
Guess you must have been lucky?
Me too same story. Rui any your suggestions?
Hi rui sara can you make an update on the code?
I have tried convincing Banggood to refund in another issue that seemed crystal clear (ordered a shutter up/down switch and received a light dimmer 🙂 and got only a fraction of my money back. Trying to get this module to work will probably be easier than claiming a refund
I am trying to edit the code of the esp32 on access point mode. But it work. The wifi is up and running. But the website is not loading. Is this code compatible with accesspoint wifi?
Hi.
I don’t see why it wouldn’t be compatible, but I haven’t tried it.
Please note that you can only access the video streaming at one place at a time. Make sure you don’t have the web server opened in another tab.
Regards,
Sara
Hi Rui..Sara can you make an update on the code to fix the Camera init failed with error 0x20001 ERROR CODE ? Thanks a lot lot lot. 🙂
Hello
It works, but …
when I run the ip I have a picture every 30 seconds or so.
Is it possible to block the IP fixed?
Yes, you can set a fixed IP address by following this guide: ESP32 Static/Fixed IP Address: https://randomnerdtutorials.com/esp32-static-fixed-ip-address-arduino-ide/
I too received boards with a different chip from Bang Good, however mine work fine with the AI Thinker selection. I did have issues in the beginning when setting them up and finally figured out they are really picky about their power. They need a lot and are extremely intolerant of noise or low voltage. Try using the 5V pin and the ground next to it rather than the 3.3V. They seem to be happier when using their own onboard voltage converter.
I too received a unmarked unit from banggood (also 1 from AliExpress) and had the same error, Camera init failed with error 0x20001. But as an earlier poster said, I too switch the jumpier from 3.3v to 5v and that solved the problem.
NOTE: both my units, were unmarked (images on websites showed AI-Thinker) but required 5 volts. So that was the problem not anything in the code.
Ivory
Thanks for letting me know Ivory, I’m currently working on a dedicated ESP32-CAM troubleshooting guide with all the tips.
Unfortunately, this solution doesn’t work for me. After flashing, I switched to 5V, the reset LED now keeps burning faintly and after reset, the serial monitor does not show anything, not even an error message. Scanning the ports on my local network also does not show a new server added…
Dear Rui, thanks for the tutorial.
I would like to be able to turn on a light from my cell phone, a light attached to a relay controlled by the ESP32.
How would do that?
Thanks
Paulo
Yes, you can definitely do that, please try this tutorial: https://randomnerdtutorials.com/esp32-web-server-arduino-ide/
But you need to replace the LED for a Relay
Dear Rui, sorry for not been clear on my question.
I was referring to the this tutorial with the ESP-32 CAM.
I mean, I would like to be able to switch on a lamp while watching the streaming video from the camera.
Thanks
Paulo
Hi Chris, the problem we were facing in the past weeks has been related to the power supply not most probably enough to run the esp32-cam devices. Now it seems to run like a charm !
HI RUi, excellent, now works fine! It was a power issue, you have to connect to 5VDC not 3.3V !
Is this when you are programming it? I have a different FTDI programmer with a 3.3v or 5v switch?
I did wonder if the ESP32 would get enough power via the FTDI programmer which is connected to a USB port on my PC?
Chris
Hi Rui, a quick question not fully understood; can I check the cam (accessing the video streaming server) from outside the house, not using the same IP address????
Hi Domenico.
The web server in this project is only accessible in your local network.
Regards,
sara
Hi rui…I tried an answer by myself and found the OpenVPN could be a way to reach from outside of the home to inside it the web cam video streaming. Am I wrong?
Yes. Using a setup like that should definitely make your ESP32-CAM web server available from anywhere.
Hi,
Referring to the this tutorial with the ESP-32 CAM.
I would like to be able to switch on a lamp while watching the streaming video from the camera.
How can it be done?
Thanks
Paulo
bonjour,
merci pour les infos j’ai bloqué l’IP et l’image est plus fluide avec une bonne antenne.
Mon souhait serait de pouvoir capturer une image et l’envoyer par mail .
Une idée ?
Merci
My Board (Banggood with no logo) works fine using 5v. Doesnt work with 3.3v
Gave up on using the non ‘AI Thinker’ boards and bought another one that was marked AI Thinker…uploaded the code, and finally got the message showing the IP address in the monitor, but no web server on the same LAN!
Tried a reboot and even reloading the code but get garbage in the monitor and sometimes a message about ‘Camera init failed with error 0x20002’
I have tried disconnecting the power to the board and connecting 5v and GND instead but get the same results, reflashing the firmware (with 3.3v connected) but nothing…did you ever produce the help guide?
Hey, try reflashing with 5V (connect to the 5V pin of course). Programming with 3.3V here has also resulted in tons of error messages. With 5V flashing&running, everything is find.
choosing 3.3V results in tons of problems. Switch to 5V both for programming and running as well.
I just got one and followed the instructions and had problems programming.
I connected to the 5v line and it programed ok.
I since realised that my FTDI programer outputs 5 volts ONLY on the VCC line. It can switch between 3.3v and 5v only on the DATA lines.
I was therefore pumping 5v directly to the 3.3v line, so was lucky not to damage the EPS32 or camera.
Actually, I may have as there are lots of moving horizontal lines on the image and both camer and EPS32 get very hot.
Many people suggest bumping up the power to help remove many of the lines, but I wonder how many tried to program with 5v onto the 3.3v line at the begining!
Hi and thanks for the tutorial. Really needed it!
Took a while to get everything working.
My main problems were power issues as well.
I found I could flash the code via USB at 3.3 and 5, but then trying to run the code would constantly crash in different ways.
So I powered the device with an external 5v power supply, disconnected the USB power (but not the ground). With that, everything worked great.
Don’t give up on this device … it’s really impressive once you get it going!
Thanks again for your article!
I’ve bought also from aliexpress 3 ESP32-cam non-AI-thinker boards.
I’ve found out that the boards come with pre-installed fw.
if you look with phone or PC for WiFi networks, you’ll find an “ESP32_CAM” ssid, which belong to it. just click on connect, no-pwd and go to :
http://192.168.4.1/jpg_stream
that’s all. i’m figuring out how to connect to the board and flash another fw.
I’ll keep you update.
I found the problem. I had upgraded the boards to Version 1.0.2 and no ESP32 code would compile.
Thanks to a post by stankusaudrius on the ESP32 Github, I looked in
C:\Users\steve\AppData\Local\Arduino15\packages\esp32\hardware\esp32
and found a folder for the older version (1.0.1). Deleting the folder for 1.0.1 fixed the problem.
Your stuff is great as usual!
Worked first try… Unfortunately I bought mine off Alliexpress and of course the quality of the image is poor. But – it did work first try and still fun to play with.
Thanks for your great work.
This was really helpful. Very clear and accurate. Thanks
Thank you, I’m glad it worked!
Hi, Once again another fantastic tutorial which help me enormously. I got it working after changing to the 5v connections and was a little disappointed with the picture lag. I managed to overcome this by changing the: ‘config.frame_size = FRAMESIZE_UXGA;’ to: VGA (config.frame_size = FRAMESIZE_VGA;). The picture quality is not as sharp but it is much more responsive. Also, this camera works with the motion eye os setup. A much cheaper alternative to the pi-zero option with camera. Thanks.
Hi guy, the cam works perfect at 5 voltages; also, I tried successfully to streaming out using ngrok.com service. On my application the port 80 is fine. Thanks rui and Sara.
Hi Sara and Rui
I too got an unmarked ESP32 cam board from China and set it up as an AI Thinker following your excellent tutorial. I was originally running it on 3.3 volts via the USB adaptor board and although it flashed and worked just fine, it was a bit iffy at connecting to the wifi network and there was a lot of latency and coloured lines across the picture. I have now changed to a stand alone 5 volt supply and it is much much better, so it would seem that these unbranded Chinese boards want to run at 5 volts. On a slightly different note, I would really like one of my external camera viewer apps to be able to ‘see’ this camera. I should be able to integrate it manually from the network IP address, port numbers involved and if I know the format of the video stream. Do you happen to know what it is and what port I would need to be looking for / forwarding ?
Hi Geoff.
You can use port 80 and the format is MJPEG:
Regards,
Sara
Thanks Sara. I’m going away for a few days so won’t get an opportunity to try anything for a while. Is it possible to have more than one of these camera modules loaded with the tutorial software, running at once ? The router would presumably issue a different IP address to each module but would it just produce a conflict on port 80 ? Sorry if these are dumb questions, but I’m very new to all this. I have several remote viewer apps that I have tried to use with this module but I have been unable so far to get any of them to ‘see’ the module. The apps all seem to have settings for ‘generic’ IP cameras, but there are a lot of them. Is there anything else about the format of the data other than “MJPEG” that’s known that would help me find a setting that allowed the camera to be recognised ? Aircam is the app I would like to use as this works fine with my existing USB cameras and is able to operate with IP cameras as well if you can get them recognised. Thanks again for the excellent tutorials and taking the time to help old dinosaurs like me ! 🙂
Hi, I’ve just got my esp32-cam and managed to make it work in no time, thanks to your explantion – thanks!
Just wondering about the camera – the picture quality is pretty low – it needs lots of light and I have blue and yellow horizontal lines, flickering all over the image. Is it just my camera, or is it a known problem?
Hi Danny.
The quality of the picture is low, but I didn’t get horizontal lines.
Some readers reported that powering the ESP32 with 5V through the 5V pin can help solve that issue.
Regards,
Sara
What do I wrong?
Wn10 environment
RPI 3B
No pblm with the installation of the ESP. It works and gives me the IP address.
But impossible to install Home assistant.
I’ve loaded the file “hassos_rpi2-2.12.img.gz”. Extracted it gives me he file “hassos_rpi2-2.12.img”.
I load this file with Etcher on a (new) 64GB SD card.
Etcher comes back with “all fine” after a few minutes.
But the SD card is empty and asks to be formatted…
Nothing has been copied on the SD card…
I’ve also used “Win32DiskImager” with same results.
Tested several times.
Any idea?
Unlike most of your projects, this one was a disaster…I have bought three ESP32-CAM boards and none of them have yet to produce an image. I have tried running them off both 3.3v and 5v and can get a wireless connection but no image is displayed. I have also tried the ESP32 WebCameraServer example and this didn’t work either (‘camera not supported’ message)
Bit disappointed I have wasted my money but I guess perhaps the boards and cameras vary although they all advertised as the same!
I did manage to get one board where the chip was marked ‘AI Thinker’ but this didn’t work either 🙁
Chris.
The camera not supported message could be an indication that the camera ribbon cable is not connected correctly. On the ribbon cable should be a line, when connected if you can see that line, the cable is not pushed in far enough.
I had the same problem, and fixed it with reconnecting the ribbon cable correctly.
Please try reconnecting again and see if this fixes the problem.
Hope this helps.
I had similar problems initially using just a cheap Chinese version from an eBay seller. I have found that it definitely needs to be be powered from 5v not 3.3v and you need to have a good wifi connection. If necessary, configure the antenna link and use an external antenna – dirt cheap from eBay sellers. The camera connects every time now for me with no “camera not supported” error messages and stays reliably connected. I have to say that the picture quality is very good – easily as good as other cameras that I have that were much more expensive. The second issue that I had was with the browser that I tried to use to look at the camera output. Under Windows 10, my preferred IE v10 will have none of it. Although it connects and all looks to be well, the picture window is just blank. However, both Chrome under W10 and Safari under IOS on my iPhone produce an excellent picture as soon as “Start Stream” is clicked
Hi Rui and Sara,
I like your website a lot. I love your Raspberry Pi 20 Easy Projects book, very useful and easy to follow!
I wanted to try this project with the ESP32 and the camera, but I need some help. I am having issues uploading the programm using the Arduino IDE. I get this error:
Arduino: 1.8.9 (Windows 7), Board: “ESP32 Wrover Module, Huge APP (3MB No OTA), QIO, 80MHz, 921600, None”
Sketch uses 774606 bytes (24%) of program storage space. Maximum is 3145728 bytes.
Global variables use 47912 bytes (14%) of dynamic memory, leaving 279768 bytes for local variables. Maximum is 327680 bytes.
esptool.py v2.6
Serial port COM6
Connecting…….._____….._____….._____….._____….._____….._____….._____
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
Hi again,
It is working! I just forgot to set the jumper from the FTDI programmer to 3V3 (it was on 5V). Thanks for this tutorial! 🙂
I’m glad you’ve found out the problem.
Thank you for following our work, specially our Raspberry Pi book.
Regards,
Sara
Hi,
I have been able to install everything. Not as easy as described…
Now I’ve a pblm to retrieve the images taken with the OV2640 and put them in HomeAssistant.
You write simply to add the url (http://192.168.1.91/ in your ex.) but this is no working in my case.
If I want to get an image in HA, I’ve to use the complete url like found in the image source file of OV2640 application.
This is what I’ve to use: “http://192.168.0.162/capture?_cb=1559298840529”
BUT this is not working automatically. I’ve to update the address manually.
Not the best solution.
Do you have a idea how to improve?
Thanks in advance for any help
Hi Jean.
I’m sorry for the delay in our response.
We receive lots of comments, questions and emails every day. It is very difficult to keep track of everything. I hope you understand.
Regarding your question.
We’ve got everything working fine by just copying the URL. So, I don’t know what can be the issue in your case.
If you go to the IP address, outside Home Assistant, can you see the video streaming properly?
Regards,
Sara
Most Home Assistant users are not using the Lovelace UI, so I don’t know if the yaml code is any different. This works in my cameras.yaml file:
# ESP32-CAMERA
– platform: mjpeg
mjpeg_url: http://192.168.1.54
name: ESP32-CAM
Of all my WiFi cameras, this one interfaces with my Home Assistant easier than all others.
Hi Stephen.
Thank you for sharing.
That might solve the problem of some of our readers.
Regards,
Sara
Hi Sara,
Thanks!
We all have the same prblm… time.
Let me a few time to test it again, I’m in an other (of your) project actually.
Ok. Thank you for understanding.
Keep us updated.
Regards,
Sara
Jean-Luc
Not sure it is relevant anymore, but I had the same problem. I fixed it by typing “http://:81/stream”. Maybe this can help someone else with the same problem
Thanks for sharing 😀
Hi Carl,
Of course it’s relevant and I thank you very much.
As soon as I’ve the time, I’ll check it to see if it’s the solution.
Thanks again.
Jean-Luc
I can vouch that it worked for me 😉
BIG thanks for this solution Carl !
PL
I got this working on a chinese no-brand ESP-CAM – works well, though lots of latency and the occasional vertical line – but running at 5v has helped somewhat.
I think the latency is due to the sheer size of the image – 1600×1200. Is there any way to get a reduced image size from the CCD – or maybe force a slower refresh rate of 1 frame per second.
Thanks!
Solved:
config.frame_size = FRAMESIZE_SVGA;
This makes it 800×600. A bit better, but still a bit wobbly. I suspect there isn’t enough CPU there to handle lots of movement.
Hi Aris.
Thanks for sharing that information.
Yes, the ESP32 may not have enough CPU to process movement.
Regards,
Sara
Hi Sara,
I have two questions. When I install the program and run it, everything works fine. However, if I detach it from the programmer and power it with the 5V powersupply, I cannot seem to connect to it anymore. Do you have any suggestions? Another questions is regarding Octoprint. It has a feature to use a camera stream to monitor 3D prints. I was wondering if you could use this setup as a stream in Octoprint in stead of the fixed Raspberry Pi camera?
Cheers,
Peter
Hi Peter.
What external power supply are you using? I’ve experimented with a phone portable charger and it worked fine.
You can have just one client at a time, so if you have a previous tab open, when you try to connect again, it won’t show anything in the new tab. You need to close the previous tab.
Also, make sure that when you are powering it with the external power supply, the ESP32 is within the wi-fi range of your router.
If the octoprint software provides the option to add an ip cam, it would probably be compatible. You just need to pass the streaming URL.
Regards,
Sara
You can monitor it via FTDI while being powered by external cable.
Just do not connect power line from ftdi to camera, leave it unconnected.
Then connect external power supply to either 5V or 3V depending on your external power supply voltage (probably 5). And then make a common ground. Just connect gnd from ftdi to one of the ground pins, while also connecting ground from your external supply to some other gnd pins. And voila, the ftdii is able to monitor it and display the output in terminal. You can then check, what is happenning.
Thank you for this tutorial! I recently purchased two of these boards with cameras and am anxious to get them up and running. I believe I’ve installed everything correctly for the IDE but when I go to compile the sample code I get this error message:
Board esp32doit-devkit-v1 (platform esp32, package esp32) is unknown
Error compiling for board DOIT ESP32 DEVKIT V1.
Thank you for any help and guidance…
Hi Mike.
I’ve never faced that error. But I think it means you don’t have the ESP32 boards properly installed in the ARduino IDE.
You can follow our tutorial to install the ESP32 in Arduino IDE https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/
Regards,
Sara
Hi Sara
My ESP camera worked a treat whilst I was away and provided a good security picture of my house. Couple of questions that I hope you might be able to answer. First, where is the user interface located ? Is it a piece of software built into the camera that the Arduino sketch interacts with, or is it part of one of the Arduino libraries that is used in the sketch ? Can the “Start Stream” button effectively be ‘pressed’ in software i.e. without having to click on the button so that the camera is streaming immediately from when it connects ? Also, where is the post number that it is outputting on defined ? Can it be changed from 80 so that more than one ESP 32 cam module can be active on different IP addresses. I’m sure others must want to do this as more than one camera would be really useful. These are probably dumb questions but I’m pretty new to all this and am just pleased that I have gotten as far as I have already with your tutorial and help 🙂
Great tutorial – I was able to upload the code just fine to my AI-Thinker esp32, however when I disconnect the GPIO0 connected to GND and reset, if I watch it in Serial Monitor it never connects to the WiFi.
I’ve tried three different WiFi’s that I have here, all different SSIDs, but none of them ever connect.
This is what I get, looks like it’s just fine, but that last row of ……. dots just go on forever!
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1100
load:0x40078000,len:9232
load:0x40080400,len:6400
entry 0x400806a8
………………………………………….
Any ideas?
Hi Don.
Some of our readers reported that if your network credentials have more than 11 characters, it will not work.
Also, I’ve recently discovered through one of our readers, that some ESP32-CAM boards come connected to the external antenna instead of the internal antenna. Here’s what he said that might be useful:
“Check the jumper 0K resistor by the antenna connector is in the proper position for the antenna desired. There are 3 little white squares laid out like a “<" with the middle position being common. With board turned so the the pcb antenna up, to use the pcb antenna, the resistor must be on the top position, like this: / For the antenna connector, the resistor must be on the bottom position, like this: \ " The board provides a connector for an external antenna and has an onboard antenna as well. If your ESP32 comes with the external connector enabled, you can try adding an external antenna. Or solder/unsolder to use the internal antenna. I hope this helps. Regards, Sara
Hey. Hope this might help someone. The ESP32 cam units cannot connect to a WiFi hotspot where the SSID has more than 11 characters in the name. Mine had 12 and I was tearing my hair out trying to work out what was wrong, as everything else seemed perfect. Found this snippet on another forum, I hope it aids someone.
Thank you so much for sharing.
I’ve never thought that could be an issue.
Regards,
Sara
Hi Sara,
If this the case, do you have a suggestion?
I’m not able to change the SSID.
And even if I could do it I should have to change all the systems connected…
Hi Berrier.
Some of our readers have done that, but I don’t know how to do that. Maybe a google search can help with that.
Some routers also provide the option to create guest networks. That can be a better alternative because you won’t have to change the systems that are already connected (if your router allows that).
Bur before trying it, take a look at our troubleshooting guide to ensure that you’ve done all the steps to make it work: https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/
Regards,
Sara
Hi Sara,
I’ve exploited your guide already (excellent!). but w/o help.
I’ll try Google and keep you informed.
BR, jean-Luc
My board looks just like the AI Thinker, but it is an HW-297 which I got from Amazon for $12.99. I followed the instructions and got the code loaded OK but it wouldn’t work. Just gave lots of errors. When I powered it with 5V (on the 5V pin) instead of 3.3V (on the 3.3V pin), it began to work. Amazing little thing!
Hi Doug.
Yes, it seems that some boards need 5V power supply to work properly.
Regards,
Sara
For anyone having “Camera init failed with error 0x20004” try for flash and power up the board using 5v pin instead 3v, its worked for me.
HI,
Mine has 12 too..
And it’s not working.
I’ll try it asap.
Thanks anyway.
jean-Luc
Excellent tutorial!! I really want to thank you for posting this. As always, you do an excellent job of explaining all the steps. Thank you so much for your hard work and for sharing your knowledge with the community.
Hi John.
Thank you for such nice words.
Regards,
Sara 😀
can we configure it with blynk app ?
thank in advance
regards
muflih
Has anybody succeeded in getting this cam to work in Domoticz? See my post on the Domoticz forum: https://www.domoticz.com/forum/viewtopic.php?f=35&t=28458
I got it working already under Domoticz. If you have ESP tools installed in the Arduino IDE, there will be a CameraWebServer sketch that has more options under File > Examples > ESP32 > Camera. Edit this just like the sketch mentioned in this post and flash it. Setup a new camera in Domoticz Settings > More Options > Cameras, give it a name, enter the IP address of the ESP32CAM, leave the Port number blank and enter ‘capture’ as the imageURL.
Hi Pierre. Thanks for your instructions on getting the cameras to view in Domoticz. I now have this running on a Widows 10 PC and it’s the first application that I have been able to get to see multiple instances of the ESP 32 cam board each on a different local address.
Can I now set this up on my iPhone so that I can view the cameras remotely from anywhere in the world ? Please bear with me. I’m very new to all this !
You can remotely view the cams directly by setting up port forwarding on your router, however since they have no security at all, anyone can access them, so I wouldn’t do that.
In stead, I suggest you install Domoticz on a Raspberry Pi that will act as a server and can stay on permanently. This way, the camera’s are only connected to your local network, but you can access them from outside through the Domoticz server, which is protected.
Hi Pierre. Thanks for your input. I have a Pi that I may well set up as you say. At the moment, the W10 machine whose network they are connected to, runs continuously and already has the router set up for forwarding. I now have two ESP32 cam boards set up and visible in a copy of Domoticz running on that Win10 machine. I have a copy of Domoticz now installed on my iPhone, and would like to be able to view the cameras on that phone, either via a 4G connection or any other wifi network that I might be connected to with the phone, for instance when I am away. However, I don’t know what I have to do to set up that remote viewing for the cameras – or any other device – on the iPhone copy. I just have a page with “HTTPS” and a port number on it, an empty field called “Directory”, “username” and “password” and a couple of other bits. Do I need to fill some parameters in here or go straight to “next”. As I said, I’m very new to all this, although very experienced in electronic service work. Thanks for your time and feel free to contact me direct if you would rather
You can Just open a browser window on your phone and from there, see Domoticz and the camera’s. I do that on my Android phone since the Domoticz app (which is also available for iPhone) for some unknown reason doesn’t show the camera streams at all.
OK. Pity that the app doesn’t work in that respect. I was rather hoping that it would. So what URL do I use in the browser to get to my data through Domoticz ? I’m starting to get a bit confused now …
Add a port forwarding rule in your browser in which your public ip address with a port of your choice will be forwarded to the local address of your Domoticz server. There are numerous guides about port forwarding available on the internet.
Hi, I loaded the script in my newly arrived ESP32-CAM but the video fps seems to be very low.
I started ping -t 192.168.99.100 (ip acquired by my ESP32-CAM) and the response time rums at 1000ms, 1300ms, some times 18ms, etc
Can I make the size of the picture on screen half its current size?
If I want to have a button to activate an external light how could I put this button at the same screen as the image?
Thanks a lot
Paulo
Thanks
Paulo
Hi Rui and Sara,
I’am having problems with my camera to expose it’s ip-address.
This is what I get from the serial monitor:
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1100
load:0x40078000,len:9232
load:0x40080400,len:6400
entry 0x400806a8
Camera init failed with error 0x20004
Hi Maarten.
That error usually means that the ESP32 is not able to initialize the camera.
Please read our troubleshooting guide, bulllet 2 and see if it helps: https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/
Regards,
Sara
Thank you for your response.
I did not know that I have to put the camera in the esp32 before it was able to connect to the internet.
After I connect the camera it worked.
Thanks
Great 😀
I could not program mine yet I have exactly the same FTDI as you link to.
I looked at your trouble shooting section and one was to use 5v, so I connected the FTDI direct to the 5v line and worked fine.
In hindsight, the FTDI supply output IS 5v not 3.3v, only the data lines (RX/TX) are switchable between 3.3v and 5v, but the supply is always 5v volts.
This means I put 5v directly onto the ESP32 bypassing the onboard regulator which could have damaged the ESP32.
May I suggest that you re-draw you diagram to show a connection to 5v as currently using that FTDI you are connecting 5v to a 3.3v input even though you have labeled the supply on the diagram as 3.3v, it is actually 5v.
Hope I have saved someone from destruction.
Great article.
Thanks
Hi Martin.
Thank you for following our work.
My FTDI programmer outputs around 3.4V on the VCC pin when it is switched to 3.3V with the jumper cap. So, I didn’t have any problem powering the ESP32-CAM through the 3.3V pin using the VCC output of the FTDI programmer (outputs 3.4V). Maybe yours isn’t exactly like ours…
Regards,
Sara
Great article.
I see various people have trouble with the “Banggood model”
Obviously I am not sure which model they got, but I presume it is the dirt cheap Geekcreit model (6 euro’s or something).
I got one and didnt really have much trouble with it. It has an AI-Thinker chip on it, and that setting seems to work for me.
If you freshly get that model, you may be in luck that it already has a working camera program in it, which is a good way to check if your model is actually working.
What you need to do is to go to your WiFi AP list and select the camera AP (I forgot the exact name, but you will recognize it) connect to that. Subsequently go to 192.168.4.1/jpg_stream and or /jpg to get either streaming or stills.
That way you know your camera works fine or not.
I reflashed mine, simply because I found the built in program a bit limited, mainly because it was on its own network.
For the reflashing many good tips are given already:
connect GPIO0 to ground and then reset.
Use 5 Volt Vcc (but 3V3 FTDI module).
Make sure you operate it with a decent PSU, decent in terms of current it can supply and cleanliness of the powerlines
Hi Ed.
Thanks for sharing that tip. It is a great way to check if the camera is operating properly. However, we don’t know if all cameras come with a program in it.
We have some ESP32-CAM boards from Banggood and they all work well.
Regards,
Sara
That is totally correct. I checked again and the AP to show up (if a program is provided with it is ESP32_CAM
And the webpages to go for are indeed 192.168.4.1/jpg_stream, for streaming video and 192.168.4.1/jpg for stills.
Do not expect a WiFimanager on 192.168.4.1 (too bad)
Thanks for all yr excellent articles, going to get some more ESP32-cams
Thank you for following our work.
Have fun with the ESP32-CAM boards.
Regards,
Sara
The one I got was this one: banggood.com/Geekcreit-ESP32-CAM-WiFi-bluetooth-Camera-Module-Development-Board-ESP32-With-Camera-Module-OV2640-p-1394679.html
but I see it is no longer on sale for 6 Euro, but now costs a bit over 11 euro.
Ofcourse I cannot garantee that on delivery it will be exactly the same model I got
Correction, the above model still available for 6 Euro’s till end juli……if you select CN rather than UK as the sender
I found that increasing the size of part_buf to 256 bytes greatly improved the speed of JPEG streaming. Just two lines to change:
char * part_buf[64]
if(res == ESP_OK){
size_t hlen = snprintf((char *)part_buf, 256, _STREAM_PART, _jpg_buf_len);
res = httpd_resp_send_chunk(req, (const char *)part_buf, hlen);
Doh!! 🙁
char * part_buf[256]
Thanks for sharing that 😀
I’ve finally found an easy to use free app that connects to multiple instances of the ESP32 cam board without issue, and allows remote viewing over the internet on a smartphone. It has all sorts of useful features like zoned motion detection that I haven’t had time to investigate yet.
netcamstudio.com/ to download the desktop part of the app.
Add cameras using the “Custom URL” tab in the “Add Source” window. Format is
“http://192.168.xx.xx:80/capture”
where the address is whatever your router has assigned to each ESP32 cam board.
Hope that’s useful to others
Hi Geoff.
Thank you for sharing. This is definitely something that our readers are looking for and are interested in.
Regards,
Sara
As always, great work! I have a comment and a question. There is an option under the board manager for AI Thinker ESP 32 Cam. When I used that instead of the ESP32 Wrover Module my camera worked. Before that I was getting an error message. The question I have is that I can view the camera from Home Assistant only when I am connected in my network at home. If I am away, I can’t see the camera. Any ideas? Thanks again for all that you do. Great work!
Hi John.
You can only access the web server on your local network.
I think home assistant has some options to access the dashboard from anywhere in the world.
However, at the moment I don’t have any tutorial about that subject.
Thank you for following our work
Regards,
Sara
I really appreciate all the effort you invest into these tutorials and videos. I tried this and I followed all your instructions and it worked after I selected the AI Thinker ESP 32 Cam option under the board manager. With this option you can only view the camera within your network and only one viewer at a time. Since this was not a solution what I wanted to implement, I look further into this and I found that you can easily integrate the same camera into Home Assistant using the Esp32 Cam node in EspHome. It’s much easier and now I can view my camera from anywhere and several people can access it at the same time. Thanks again for all your work.
Can you please teach us more in details your excellent solution using home assistance? Thanks a lot.
Edit: I just outcommented the dl_lib.h and the Webserver with Accesspoint is working fine.
Kind regards and greetings from Switzerland 🙂
delf
I decided to buy one of this modules after reading the email from 13 June, but only today got a change to try it.
I’ve bought my board on Ebay and it is not labeled as an “AI-Thinker” module.
I’m working under Linux, just because Arduino IDE compile’s “years light” faster then under Windows.
As usual there was a some troubles:
1) The example did not compile, because “esp_camera.h” was missing. Solution: update the “esp32 by Espressif Systems version” (under Tools, Board, Boards Manager…) from version 1.0.0 to 1.0.2.
2) When trying to upload there was an error message saying: “a fatal error occurred: Timed out waiting for packet content”. That one was hard to solve! I just solved it changing the “Upload Speed” (under Tools menu) from 921600 to 115200 (later I tried upper speeds and could got it at 460800); the one to blame it’s, maybe, my ftdi…?
Finally it all worked as expected!
Two final notes:
1) Upload problems can be solved changing the “Upload Speed”.
2) As John wrote on July 12, changing the Board to “AI Thinker ESP32-CAM” works very well and it removes the “Upload Speed” option from the Tools menu.
Thanks for the tutorial, very useful, got it working after fiddling around a bit with the FTDI and things.
About the code, I would like to set a lower resolution, say VGA because the default 1600×1200 is too much for the camera, fps is very low and image lagging
How can I do that?
Regards
I figured it out, you have to change the FRAMESIZE_ parameter like this:
config.frame_size = FRAMESIZE_VGA;
Maybe it helps someone else
For some reason QVGA or HQVGA doesn’t work. I get the message
“Camera Stream Ready! Go to: http://192.168.1.59” in the console but browsing to that address gives a blank page.
Do you get the same issue?
I have non AIThinker cam module. There’s AP soft in it, under IP 192.168.4.1/jpg_stream video works, but i can’t upload other soft. Serial monitor says “rst… waiting for upload” and “Failed to connect to ESP32: Timed out waiting for packet header”. I use 3,3V, 5V, Arduino IDE, esp idf, FTDI, CH340, CP2102, Windows 7 x64, Linux mint, IO0+GND, breadboard, female conectors, RST button hold or press … nothing. Serial monitor works on settings: 115200, 40MHz, DIO.
I read that unplugging the camera or IO2+GND could help. Someone tried? I haven’t tested yet.
I ordered other two ESP32_CAMs. All works without problems in Windows and Linux. Upload sketch success.
Hi Sara
Thank you for your projects
Could you make a video tutorial for making a static IP address and post the video stream through it?
Cheers
Saman
Hi Saman.
For static IP address you can follow this tutorial:
https://randomnerdtutorials.com/esp32-static-fixed-ip-address-arduino-ide/
Regards,
Sara
Hi,
Wonderful tutorials here. I followed one to connect my ESP32 Cam with Home Assistant. Is it possible to keep camera in deep sleep mode with a switch (software) to turn it on manually on need basis within Home Assistant? Appreciate any help.
Hi.
I don’t think so.
At least, at the moment I have no idea how to do that with a software switch. Because it needs to be awake to receive something from Home Assistant (via MQTT for example).
Regards,
Sara
I have a different issue. I get the sketch to upload then it stops with an error message. Same in 3v or 5v
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: cc:50:e3:95:22:64
Uploading stub…
Running stub…
Stub running…
Changing baud rate to 921600
Changed.
Configuring flash size…
Warning: Could not auto-detect Flash size (FlashID=0x0, SizeID=0x0), defaulting to 4MB
Compressed 8192 bytes to 47…
Writing at 0x0000e000… (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 2048.0 kbit/s)…
A fatal error occurred: Timed out waiting for packet header
A fatal error occurred: Timed out waiting for packet header
Hi Kevin.
That means the EPS32 is not in flashing mode.
Take a look at our troubleshooting guide bullet 1: https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/
And see if you can solve your problem.
Regards,
Sara
Can’t solve this problem with the troubleshooting. Result:
esptool.py v2.6
Serial port COM3
Connecting…..
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: 00:aa:a0:a0:0a:a0
Uploading stub…
Running stub…
Stub running…
Changing baud rate to 460800
Changed.
Configuring flash size…
Warning: Could not auto-detect Flash size (FlashID=0x0, SizeID=0x0), defaulting to 4MB
Compressed 8192 bytes to 47…
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 4369.0 kbit/s)…
A fatal error occurred: Timed out waiting for packet header
A fatal error occurred: Timed out waiting for packet header
Hi.
That means the ESP32-CAM is not in flashing mode (see if GPIO 0 is connected to GND).
Or that is not able to communicate via serial (check the TX and RX connections).
Take a look at the troubleshooting guide bullet 1: https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/
Regards,
Sara
Hey Sara, thanks for the fast reply. Look, this is how my connections stand:
The FTDI: https://i.postimg.cc/x19B7vcF/Whats-App-Image-2020-11-18-at-5-16-12-PM.jpg
The ESP32-CAM (UnR, UOT, GPIO0 and GND): https://i.postimg.cc/BQTdMYQK/Whats-App-Image-2020-11-18-at-5-16-13-PM.jpg
Powering ESP32-CAM: https://i.postimg.cc/m2fv3fR4/Whats-App-Image-2020-11-18-at-5-16-13-PM-1.jpg
I tried a couple params in “Tools” on ArduinoIDE, like ESP32 Dev, ESP32 Wrover, DOIT ESP32 and AI-Thinker ESP32-CAM.
I always press the RST button before compile on ArduinoIDE. Dunno what is happening 😭
Hi.
From the images I can’t tell if the wiring is correct.
Please check that TX is connected to RX, and RX connected to TX.
You need to press the RST button when you start seeing a lot of dots in the debugging window.
Regards,
Sara
Hi Sara, it is possible my ESP32-CAM is not getting power enough and because of it, this error show up? When I connect the FTDI VCC on ESP32-CAM VCC, the flash lamp has a strong light, but don’t connect on ArduindoIDE (even if I press the RST button). When I connect the FTDI VCC on ESP32-CAM 5V, the flash lamp almost don’t has force and I get this erro above (Could not auto-detect Flash size blablabla).
Hi Anne.
That problem is not a power issue.
Regards,
Sara
Just for the record, my problem was on ESP32-CAM, I don’t know what exactly but I tried with another one and it worked 😵💫
Hello sir, were you able to solve this problem? What was the solution?
Hello,
How can I make this Random IP generated into a standard IP?
Like, I would like to have 192.168.0.25 always.
Thanks
Hi Marcos.
You can follow this tutorial to fix your IP address. https://randomnerdtutorials.com/esp32-static-fixed-ip-address-arduino-ide/
Regards,
Sara
Dear Sara and Rui,
please, do you know, why i cant connect to wifi ? I can see again just this in window. And again, again…
————-
Brownout detector was triggered
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1100
load:0x40078000,len:9232
load:0x40080400,len:6400
entry 0x400806a8
————–
Thanks so much
Jiri
Hi Jiri.
Take a look at our torubleshooting guide, bullet 3 and see if you can solve your problem: https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/
I also recommend taking a look at comments section of that article and see if something helps with your issue.
Regards,
Sara
Hi Sara,
thx for fast reply. Code from this page works with 5V. But code from https://randomnerdtutorials.com/esp32-cam-video-streaming-face-recognition-arduino-ide/ still doesnt work. Strange.
Hi
Great project. I had some problems with my ESP32-CAM using 3.3v. Switching to use 5v solved everything. 🙂
Thanks for the great tutorial, I am looking at using my current build of MotionEyeOS on Raspberry Pi, and a cluster of 4 of these ESP32-cam’s and an old wifi router, to create a low power and dirt cheap backyard wildlife monitor. I will use the ESP32-CAM (x4) simply as wifi/IP cameras, I will probably remove the IR filters, and use some PIR’s with some IR Floodlights to illuminate the area at night. All of the ESP32-cams will connect to the router and the router will feed from the raspberry pi near the back yard. The raspberry pi will also have a Wifi dongle and connect to my home router, for accessing the MotionEyeOS. Then MotionEyeOS on the Raspberry Pi will do the motion detection, image/video storage, and can even do notifications and code executions based on the motion detection algorithm configurations in the software, no PIR’s needed for image or video recording based on motion in the video stream, and it is all accessible in one location.
Hello,
Super tutorial.
I wish I could attach an infrared detector (IR) with a remote control, to be able to put the ESP32-CAM dormant and wake up when I want it remotely.
Do you think it’s possible?
I tried, but I can not
Thank you
Hello I may have been poorly expressed because I write from France with a machine translation …
Here, I would like to power my esp32-cam with 4 batteries of 1.2v and to save power, I would like to put the esp32-cam in sleep (deep sleep) with an infrared remote control, but I can not do the .ino program to achieve this, maybe this is not possible.
My wish :
Watch the streaming video, then put the esp32-cam on standby when I want, and later be able to put the streaming, all with a remote control and an infrared detector.
You can tell me if this is possible and also how to do it, please?
thank you in advance
Hello
May you have a sample using a esp32-cam to build a web server and take a photo in the microsd card without using the sample?
Thank You
Hi.
We have these tutorials that might help:
https://randomnerdtutorials.com/esp32-cam-take-photo-display-web-server/
https://randomnerdtutorials.com/esp32-cam-take-photo-save-microsd-card/
I hope this helps.
Regards,
Sara 😀
After a fresh Arduino install (1.8.10) and loading of https://dl.espressif.com/dl/package_esp32_index.json I got this:
error: dl_lib.h: No such file or directory
Upon searching I found someone saying that that library had been eliminated in an recent release, and the sketch would probably compile if the include was removed.
I commented out the include line and the sketch did compile and download and run properly, with camera streaming.
Thanks for this tutorial.
Hello,
I would like to have a fix IP address using my cellphone as personal hostpot. I’ve read the link you sent to me before “https://randomnerdtutorials.com/esp32-static-fixed-ip-address-arduino-ide/” but I’m still not able to make it work..
Do you have any hints? Its impossible to know my gateway, since its 4G internet
I am using ESP Eye v2.1 which is very similar to this camera module and flashed the camera_web_server app that came with the examples folder from esp-who repo. The camera streamed very well. However, one issue I noticed with this streaming is that if you open the URL from multiple clients (i.e. from your computer and from your smartphone) at the same time, it only streams to one client and the other client do not display anything. When I close one client, then the other one picks up the stream. Seems like the streaming server can’t handle multiple client at once. Can you test from your end if this happens to you also. If so, is there any workaround for that?
Hi.
Yes. That also happens to us.
It can only handle one client at a time.
Regards,
Sara
Hi!
I’ve tried the tutorial and is ok, but when i try to do the step in home assistant (Picture card), doesnt show any picture. If i acces with the ip with my browser the picture is ok.
What could be do?
Thanks a lot!
Hi Again!
I know what was happening. It was that it had open in the browser and it seems that it only serves a client as you have commented previously. Can it be done to make it visible to several clients?
Hi Carlos.
Yes, it only serves a client at a time.
I don’t know if it is possible to make it visible to several clients.
Streaming video is a very “heavy” task, so I’m not sure if the ESP32 is able to talk with several clients. We need to search a bit more about this.
Regards,
Sara
I just recently ran into an esp32-cam server that supports up to 10 clients. It uses a trick to point the multiple clients to a single buffer in the spram.
hackster.io/anatoli-arkhipenko/multi-client-mjpeg-streaming-from-esp32-47768f
i just recived a replacemet for the faulty esp32cam i tried this sketch on a few months ago. but i get same error
13:43:22.503 -> Camera init failed with error 0x20004
i have tried uncommenting each model and re-uploading but i get the same error.
this is the module i ordered
ebay.com/itm/ESP32-ESP32-CAM-WiFi-Bluetooth-Module-Camera-Module-Development-Board-OV2640-NU/233172198639?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649
Is it possible to use solar panels for the ESP32 cam powered by batteries?
Is it possible that the live local streaming only starts when triggered by motion?
Hi Malcom.
Yes, that should be possible, but we don’t have any tutorial about those subjects.
Maybe you can have the ESP32-CAM in deep sleep with external wake-up – it is awakened when there’s motion: https://randomnerdtutorials.com/esp32-external-wake-up-deep-sleep/
When it wakes up, it streams video for a determined number of seconds (use timers to defined the number of seconds) and then, goes back to sleep again. That’s just a suggestion.
Regards,
Sara
Hello, Everything works fine, however is it possible to zoom in on the streaming? thank you in advance
Hello,
Well, I used Rui’s codes about a year ago, and they worked correctly (both web server and face recognition)
The web server is currently working and streaming, right now.
I’m trying to upload again, without success.
I’ve checked everything:
Code is clean, settings as described
#define CAMERA_MODEL_AI_THINKER,
Wifi credentials are ok
On Arduino IDE:
– Board Manager: esp32 version 1.4 installed (also tried 1.2)
– Board set to “AI-Thinker ESP-CAM”
– Port set to the FTDI pgmr
– FTDI set to 5V
Wiring:
– FTDI 5V -> ESP-cam “5V”
– FTDI GND -> ESP-cam “GND”
– FTDI TXD -> ESP-cam “UnR”
– FTDI RXD -> ESP-cam “U0T” (also tried swapping them)
– On ESP-cam, “IO0” and “GND” connected
– Pressed the ESP “RST” button (also tried without)
Upload sketch from IDE gives: (hidden the mac address below)
– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
ketch uses 770530 bytes (24%) of program storage space. Maximum is 3145728 bytes.
Global variables use 48704 bytes (14%) of dynamic memory, leaving 278976 bytes for local variables. Maximum is 327680 bytes.
esptool.py v2.6
Serial port /dev/cu.usbserial-A9I7XDCI
Connecting…….
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: (((the_mac_address_of_my_ESP_board)))
Uploading stub…
Running stub…
Stub running…
Changing baud rate to 460800
Changed.
Configuring flash size…
A fatal error occurred: Timed out waiting for packet header
A fatal error occurred: Timed out waiting for packet header
– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
No matter what I tried (reboot the computer, relaunch arduino IDE, changed to another USB port…), I always get the same result.
Any Clue / hint / suggestion?
thx in advance
Ok never mind, I just found a workaround:
Board: “ESP Wrover module”
Partition scheme: “Huge APP (3MB, No OTA/1MB SPIFSS)
=> magic trick: I changed Upload Speed to “115200”
*ANY* other value (incl. the default setting) gives the error
Maybe that can help others with the same problem…
that is right
Dear Sara!
I worry that esp32 cam has a compatibility issue with severa web browsers: My goal is not record the video, just broadcasting live picture – occassionally.
I’ve tried to watch live stream with several browser while many couldn’t display. Hereby i enlisting:
Google Chrome 80.0 . : Error message: Header fields are too long for server to interpret
Microsoft Edge 20.1 .: start to download the stream to file, but not showing…
Internet explorer 11.0 : start to download the stream to a file, but not showing…
Firefox 72.2 : works perfectly, but i don’t dare to update, as i worry that will cause malfunctionality on show the camera stream.
So, i think the camera HTTP header does not contain proper informations about the streaming to the webclients…
What do you think? what browsers could you offer for live stream watch, and/or is there any bugfix available for the camera program?
(I ve tried both of your projects, another one is directly start to streaming, and doesn’t have setting page, both are doing the same)
Thanks for your response in advance!
Hi.
I’ve tested the project again, and it works well for me. I’m using Google Chrome.
I don’t know what may be causing the issue.
Please note that you can only have one tab opened with the video streaming at the time.
I’ve found this discussion that addresses that problem but I don’t know if you’ll find an answer: https://github.com/espressif/arduino-esp32/issues/2983
I hope you find it useful.
Regards,
Sara
Hi Rui and Sara,
when i used the code with the video stream i have an issue, the default code works great.
But if i add #include which i want to use as a second server with on a different port, just adding this statement make the compiler go crazy, just try it yourself and you will see.
Seem to be a compatibility issue between libraries.
What do you think ?
Kind regards
Otto
I means when i add #include “WebServer.h”
Hi,
I have successfully completed the project and it is running fine. What I noticed though is that the device can’t handle multiple instances, i.e. access camera from multiple sources. Can we overcome this. I’m running on 5V.
Rgds
Dick
Hi.
At the moment, we don’t have any solution for that. The ESP32-CAM can’t handle multiple clients at the same time.
Regards,
Sara
Hi Dick,
I was just about to ask the same qustion…
I am running Home Assistant on my Raspberry Pi and quite often have Home Assistant on my computer which means I can’t look at the Camera via my Mobile Phone or via HA on my phone or if I try looking at the IP address directly.
Have you found a work around yet?
(I have noticed the comment from Sara)
Regards Adrian
I enjoyed your articular on ESP32-CAM Video Streaming Web Server the problem I have is I am setting up 4 and the cameras have different orientations and I cannot find any way in the code to Vflip or Hmirror the video any suggestions would be appreciated
Thank You
Paul
Hi.
You can use this for vertical flip:
s->set_vflip(s, 0); // 0 = disable , 1 = enable
See this tutorial: https://randomnerdtutorials.com/esp32-cam-ov2640-camera-settings/
Regards,
Sara
Hi I have this problem with my esp32-cam and my web server can’t start 🙁
19:26:52.246 -> [E][sccb.c:154] SCCB_Write(): SCCB_Write Failed addr:0x30, reg:0x35, data:0xda, ret:263
19:26:52.280 -> [E][sccb.c:154] SCCB_Write(): SCCB_Write Failed addr:0x30, reg:0xff, data:0x00, ret:263
19:26:52.488 -> [E][sccb.c:154] SCCB_Write(): SCCB_Write Failed addr:0x30, reg:0x05, data:0x01, ret:-1
19:26:52.488 -> [E][camera.c:1215] camera_init(): Failed to set frame size
19:26:52.488 -> [E][camera.c:1270] esp_camera_init(): Camera init failed with error 0x20002
Hi.
Take a look at our troubleshooting guide and see if it helps: https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/
Regards,
Sara
HI~
How can I turn the internal-flashlight on and off? (ESP32-CAM Video Streaming Web Server)
homeassistant
Thank you.
Hi.
The flashlight is connected to GPIO 4.
So, you control it like any other GPIO.
Here’s an example:
// ledPin refers to ESP32-CAM GPIO 4 (flashlight)
const int ledPin = 4;
void setup() {
// initialize digital pin ledPin as an output.
pinMode(ledPin, OUTPUT);
}
void loop() {
digitalWrite(ledPin, HIGH);
delay(2000);
digitalWrite(ledPin, LOW);
delay(2000);
}
Regards,
Sara
Just a note to everyone using the node red example, in src use “http://” instead of “https://”, it doesnt work with the s version
Works great – thanks!
In case it helps anyone, with the KeeYees kits from amazon.de (amazon.de/gp/product/B07S83X9NM/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&language=en_GB&psc=1) the default settings in this tutorial/sketch worked for me:
Be careful as the connection diagram showing how to connect the ESP32 to the FTDI board (near the start of this tutorial) is a bit confusing: the connections shown on the FTDI board are reversed, so be careful and read the (tiny) text on the FTDI board before connecting the boards.
Thanks for sharing this tip.
Regards,
Sara
Hi
I have problm with my ESP32-CAM. Can someone help me understand what im doing wrong.
Sketch uses 724094 bytes (23%) of program storage space. Maximum is 3145728 bytes.
Global variables use 48640 bytes (14%) of dynamic memory, leaving 279040 bytes for local variables. Maximum is 327680 bytes.
esptool.py v2.6
Serial port COM4
Connecting……..__
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: 3c:71:bf:f1:ac:cc
Uploading stub…
Running stub…
Stub running…
Configuring flash size…
Auto-detected Flash size: 4MB
Compressed 8192 bytes to 47…
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 6553.6 kbit/s)…
Hash of data verified.
Compressed 17392 bytes to 11186…
Wrote 17392 bytes (11186 compressed) at 0x00001000 in 1.0 seconds (effective 139.8 kbit/s)…
Hash of data verified.
Compressed 724208 bytes to 430586…
Wrote 724208 bytes (430586 compressed) at 0x00010000 in 38.2 seconds (effective 151.7 kbit/s)…
Hash of data verified.
Compressed 3072 bytes to 119…
Wrote 3072 bytes (119 compressed) at 0x00008000 in 0.0 seconds (effective 1445.7 kbit/s)…
Hash of data verified.
Leaving…
Hard resetting via RTS pin…
…
Thank you
Ardi
Never maind. I foun solution. I define board type DOIT ESP32 dev kit v1
Thank you for some great tutorials, really enjoyed them and they have been very helpful. However I have a problem with this one. I have installed this on two different ESP32-cam cards but both suffer from the same issue. At the outset it works as expected, but after some hours (12-20 hours) the server seem to crash and become unresponsive. If I unplug power and reconnect it will work for hours again before the same happens. As mentioned behaviour is the same with two different cards. I have also tried several different power sources to rule out unstable power supply as the reason. So I am a little lost here. Any ideas?
As a work around I was contemplating implementing an hourly reboot, but not sure how to do so through software. Any pointers?
Hi Morten.
You can use ESP.restart(); to restart your board via software.
Regards,
Sara
Hey guys!
I’ve been trying to get this code running on my ESP32-CAM module for a few days and I just can’t get it to work.
My module is an AI-Thinker (the same you have on the photos). It works fine with an ESPHOME generated code or the basic webserver demo code.
After uploading the code provided on this page, it enters an endless reboot cycle and I can’t get anything on the serial monitor.
Since I know this is a power-hungry module, I’ve also tried powering it with my lab power supply. Same behavior of endless reboot cycles.
I noticed you mentioned selecting the Huge app partition profile in a previous post. On a fresh install of the Arduino IDE, these options aren’t available in the tools menu when selecting the AI Thinker board. They are when other ESP32 boards are selected.
Just in case, I also tried to compile using the ESP32dev and wrover boards profiles (which do have the partitioning options available). Obviously, these didn’t work either.
Just to be sure, I’ve also tried programming it with both 3v and 5v logic.
I’m running out of things to try to make this code work on my board. Any ideas of what else I could try?
Thanks!
Hi Richard.
You can select the EPS32 Wrover module and then select the partition scheme Huge APP, No OTA.
We’ve tried with those settings and everything worked fine.
You may also want to take a look at the troubleshooting guide: https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/
Regards,
Sara
Hello Sara!
I tried programming 2 ESP32-CAM boards with the ESP32 Wrover profile.
Both end up with the same endless reboot problem.
Hi Richard,
The endless reboot problem may be related to the Wifi portion of the project. I suggest building a sketch with the WiFi ONLY to test. See below. If you can get this working with no issues then move on to include the camera.
//Wireless for ESP 32
#include <WiFi.h>
char ssid[] = “yourSSID”; // your network SSID (name)
char pass[] = “yourpassword”; // your network password
void setup()
{
Serial.begin(115200);Serial.println(); Serial.println(“Power Up”);
Serial.print(“Connecting to “); Serial.println(ssid);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(“.”);
}
Serial.println(“”); Serial.println(“WiFi connected”);
Serial.println(“IP address: “);Serial.println(WiFi.localIP());
Serial.println(“End of Setup.”);
}
void loop() {
}
Hello again!
I finally got it to work. I ended up reinstalling Arduino and the required board definitions.
Thanks for taking the time to help me out with this troubleshooting.
😀
Richard, Thanks for sharing your solution.
For other users with similar issues, I suggest to re-install the “board definitions” before re-install Arduino. I experienced similar situations in the past. The “board definitions” were not “stable”. When I switched between ESP 32 and ESP 8266. In most cases, the “board definitions” need to be re-installed – very odd with Arduino 1.8.11!
Hi
These are great tutorials; thanks.
I’m guessing the web server can only serve 1 client at a time? I get the stream on my phone or PC but not both at the same time.
What I can’t do is get anything on my Home Assistant card when configured as you advise. This is having made sure no other clients were connected.
Hi.
Yes, it can only handle one client at a time.
That’s the most common issue – having more than one client opened.
Without further information, it is very difficult to find out what might be wrong.
Regards,
Sara
Hi all!
I’m trying to take this another step further. I’ve got it up and running fine. Now I’m trying to access it with other programs to add a little more functionality. The one connection at a time thing is killing me here. I just tried setting up an Apache server that has the IP address of the ESP32-Cam as a source. I had hoped that would allow the Apache server to be hit for multiple requests at the same time. Nope. If I have more than one window open, it only shows the cam footage on one, till I close the other.
I suppose I could save the stream to my hard drive, then play it back with a delay through the Apache server. Less than ideal, but that would probably work.
Ideally, I would like to have a webserver set up to show all my cameras throughout the house on one page, with options to minimize all but one to focus in on it, plus, be recording all streams to my hard drive. My other cameras seem to be okay with this, but the ESP32-cam doesn’t like the multiple connection idea.
Thoughts?
Hi and thanks for the guide!
Is there any way to add a password login page?
Thanks!
xtensa-esp32-elf-g++: error: unrecognized command line option ‘-mfix-esp32-psram-cache-issue’
exit status 1
when it comes to this question,what should I do?
HOLA no hay forma de hacer funcionar esp32 cam siempre mismo error y comprobado de varias formas
el modelo es DM ESP32-S
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6388
entry 0x400806b4
Camera init failed with error 0x20004ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun 8 2016 00:22:57
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6388
entry 0x400806b4
Camera init failed with error 0x20004
Hi.
Try to follow our troubleshooting guide: https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/
Regards,
Sara
Boa noite Sara Santos, tenho 45 anos e sou novo nestas andanças de Arduino, comprei vario material para começar mas ainda nao chegou tudo,entre os quais uma ESP-32+wifi+BT , 5 Arduinos Nano e 1 Uno, bem montes de coisas…
A minha ideia era fazer uma camera para transmitir por wifi com ip fixo e receber no telemovel ou atraves de um ecran touch ligado a um arduino nano ou uno tendo a possiblidade de no touch selecionar gravar quando necessario. Será possivel?
Olá.
Sim, é possível fazer video streaming com a ESP32-CAM e fazer display num ecra. No entanto, não temos nenhum tutorial sobre isso.
Para ter todas essas possibilidades de gravar, o melhor seria usar Raspberry Pi com MotionEyeOS:
https://randomnerdtutorials.com/cctv-raspberry-pi-based-system-storage-motioneyeos/
https://randomnerdtutorials.com/install-motioneyeos-on-raspberry-pi-surveillance-camera-system/
Cumprimentos,
Sara
If someone wants to use the sketch with TTGO Camera Plus:
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 4
#define SIOD_GPIO_NUM 18
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 36
#define Y8_GPIO_NUM 37
#define Y7_GPIO_NUM 38
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 35
#define Y4_GPIO_NUM 26
#define Y3_GPIO_NUM 13
#define Y2_GPIO_NUM 34
#define VSYNC_GPIO_NUM 5
#define HREF_GPIO_NUM 27
#define PCLK_GPIO_NUM 25
Sorry, I inserted a message in the wrong topic …
Hello everyone who reads and knows!)) I got stuck with this module ((((I don’t want to show the video for the life of me, I tried everything I could … I see the stream in the port monitor, even the data change is noticeable when I close the camera lens with my finger, the data goes There is no picture in the browsers. The current consumption also shows that the camera turns on, the current increases from 120mA to 200-220. The Start button in the browser does not turn on, I could turn it on only in the phone’s browser, but there is no video there either, a circle with a cross. Downloaded Tims_IP_Camera_Viewer , set the IP to the settings, the check status passes, but again there is no picture. I can’t imagine how else you can launch this miracle of narrow-eyed technology
Hi.
Does your ESP32-CAM have an external antenna?
It may be a problem with the Wi-Fi signal. Try getting the ESP32-CAM closer to your router to check if it is related to the signal.
Regards,
Sara
Hi Sarah! There is no external antenna, but the module is located 50 cm from the router and on the phone within the apartment I see the full WiFi scale. I could send you screenshots of the programs, but I don’t know where to do it
So, it doesn’t seem to be the Wi-Fi signal.
Which browser are you using?
Regards,
Sara
Internet Explorer 11 and Firefox. In both browsers, the result is the same, even in IE the situation is worse.
Best regards,
Sergei
Hi again.
I’ve seen your screenshots and I don’t know why it is not working as expected.
Have you tried using Google Chrome?
Regards,
Sara
I think you might be right Sara. I’ve done quite a bit with these ESP32 cameras, and the only browser I’ve found that correctly resolves a video stream by a direct IP address connection, is Chrome. Definitely not Internet Explorer
Hi Jeff, Hi Sara! I have not tried to output video through Chrome, today I will definitely try. Thanks for the tip !! I will definitely write about the results.
Best regards, Sergei
Hello again! Jeff, do you need to make any additional settings in Chrome? Installed, left all the settings by default, there is no image from the camera in it … The camera finds … in general, everything is the same as in other browsers
Hi.
Usually, there’s no need to change any settings.
It should work out of the box.
I have no idea why you can’t get it working.
Regards,
Sara
Agreed. I have six of these cameras. I don’t usually look at them directly in a browser. I normally use Netcam Studio X but I have just looked at two of them via Chrome with default settings, and by entering a direct IP address into Chrome. Both came up immediately showing the camera settings screen. As soon as I clicked “Start stream” I had a live picture. Not that it should matter at all, but I have the addresses that the router originally allocated when the cameras first logged onto my network, entered into my router’s fixed IP list so they can never change
How do i setup an esp32cam to use with netcam studio, cannot get the program to see the camera, tried all settings and cannot connect.
Thanks
Dave
In the Netcam Studio Client (Pink bird icon) running on the host computer, select the ‘Add Source’ tab. Then the ‘Custom URL’ tab from there. Ensure that ‘Stream Type’ is set to ‘JPEG’. Then enter the camera address allocated by your router in the form
http://192.168.x.x:80/capture
Add a Source name in the window below if you like. I leave ‘Orientation Adjustment’ as “Default” and ‘Output Resolution’ as “Native”
Save with the ‘tick’ at the bottom, and the camera should appear in the Client Home page that you first came from. You can then set up Netcam Studio on your phone to view cameras both locally via wifi or via your external IP address from anywhere in the world. The server software (ble bird icon) on the host machine can be set to be an automatic start up utility via Windows settings / services. Set to ‘start automatically after delay’
Hope that helps. There are tutorials online and Hendrick who wrote it is very helpful on the forum
Perhaps I came across a non-working camera
Ah, was missing the /capture bit. Will give it a try later. Many thanks
Yes. It caught me at the start. Apparently, it’s one of the default stream names …
Good luck
Hey! After installing Chrome in the security settings, the camera and microphone are blocked. The button is in the shadow and does not toggle. I can still reset the screen. But what’s the point, I’ve already researched everything there))))
I’m having some interesting problems when I wire my ESP32-CAM to a USB cable for power. I used an FTDI Programmer to connect the ESP32-CAM to my desktop computer and successfully programmed it. Then, I stripped an old mouse USB cable and connected dupont connectors to the red and black (tested 5V on my multimeter), I also have a flashing red LED connected to D12 and GND (via a 330ohm resistor) on the ESP32-CAM.
When connected the cable to 5V and GND on the ESP32-CAM and through a USB adaptor to power, the LED flashes as expected, but when I attempt to connect to the URL, I get an error indicating that the web server hasn’t started.
I’ve tried connecting directly to the desktop, via a powered USB hub and the 5V adaptor, all with the same result.
If I connect the ESP32-CAM to the 5V adaptor via the FTDI Programmer, it works … what would the FTDI Programmer be providing?
Hi.
It should work without an FTDI programmer as long as you are providing power properly.
Make sure you press the on-board RESET button after powering the board so that it starts running the code.
Regards,
Sara
Thanks Sara, with the ESP32-CAM inside a fake camera, pressing the reset button is … challenging :).
How were you able to manage this in your installation inside the fake security camera dome?
Kind Regards
Hi.
You have to press the button before closing the enclosure and make sure the program is running :’)
Regards,
Sara
Thanks Sara. Well, that’s an engineering challenge 🙂
great little project
Has anyone added a battery and a solar charging unit? I would like this to be completely outdoors independent
Im looking to have this camera just stream and share the link out.
We have a club where we can share the link so anyone can check the site.
Hi.
We have this tutorial about solar panels that you can adapt:
https://randomnerdtutorials.com/power-esp32-esp8266-solar-panels-battery-level-monitoring/
Regards,
Sara
How do I change the streaming resolution to CIF size. I am trying to add quite a few of these on the same network. Decreasing the streaming size could help me decrease the bandwidth used by each.
I changed,
config.frame_size = FRAMESIZE_UXGA;
config.jpeg_quality = 10;
config.fb_count = 2;
to
config.frame_size = FRAMESIZE_CIF;
config.jpeg_quality = 10;
config.fb_count = 2;
but the stream goes blank after that. What should I do?
Can you also suggest a way to password protect the stream?
I bought another module and tried different frame sizes, namely, VGA, QVGA, SVGA and they worked just fine. With size set to CIF it was still not working though. I settled for VGA in the end. The framerate is much better on lower resolution aswell. Maybe this info could help someone in the future. I still haven’t figured how I could password protect the stream though.
Hi Sarah! I still solved the issue with the not working ESP32 CAM. It turned out that the ESP board itself was not working. I bought a new one, there were no problems with it.
Hi, I am able to view the stream when my system/mobile is on the same router as the camera, however, I am unable to access the stream when my system/mobile is connected to a different router on the same network(both routers are connected via a switch). Can you help me out? I am not very good with networking.
Devarshi – What hat you are trying to do probably won’t work because the router the camera is attached to is blocking the inbound request to get to the ESP32. Routers generally block unsolicited inbound requests. The network has (likely) been divided up for security reasons. You will need to talk to whoever manages the network to find out.
If that is the case. In principle this can be fixed by opening a port in the router and pointing it to the ESP32, but whoever owns the network might be very reluctant to do that.
Hi David, thanks for the reply. I had my doubts that it had to do something with the router. I am setting up multiple such cameras throughout my home and shop over many different routers which are connected through a switch.
Let me explain what I am trying to do. I managed to reduce the resolution of the stream to VGA size so that the cameras don’t take too much bandwidth on the routers and don’t slow down the internet or NAS.I even got a case 3D printed for a prototype and and wrote basic Django server to serve each stream on a single page and save motion parts locally on the NAS. I plan to deploy this on a Raspberry Pi.
Sounds like I’ll have to rummage around TP-Link documentations for port forwording/opening. I might have to password protect the stream though – Do you know how that can be done?
My experience with ESP32 is strictly experimental! I run a network of cameras but they are a mix of old Wi-Fi ip cameras and Pi Zeros. From what work I have done with the ESP32 it seemed, to me, to be much harder to make work and less reliable than the Pi zeros. I use Motioneye as the hub on a Pi4b. So far I’ve failed to make and ESP32 connect to it reliably whereas my Pi Zeros do so immediately. However, all a matter of personal preference and available skills!
As far as the routers go……..
I only have the one between me and the internet so the situation is very different. All my cameras are on the same network. My arrangements for access from outside my networks are quite different.
But, by default all routers block unsolicited inbound traffic. If you have multiple cameras behind a router you either have to open one port per camera (because a port can only be routed to one IP address). So, you will have to do that for each router that has a camera or cameras behind it! You would open, say, ports 3380, 3381,3382 pointing each at port 80 on the IP address of each ESP32. Or, it might be port 81, because the ESP32 I have streams just the video on that port. You need to find out!
Can I ask why you have multiple routers if it is all one network?
Password protecting the stream would need to be done on the ESP32, in effect password protecting access to the web server that sends it. No idea how that is done! Another reason I used the Pi – the software I use comes with that feature built in.
Sorry for the late reply.
My house is big one router’s reach wasn’t enough. So I have multiple routers. I figured I might have to do some tweaks on the ESP32 for password protecting the stream. I wasn’t able to figure out the port forwarding thing. From what it appears, I will need to open ports at the router aswell as the switch. Will probably ask help from someone who is good with networking.
My main motivation for using ESP32 cam was it’s price. Since I am going to add 10 such cameras on the whole network. Otherwise I would probably have gone with RPi Zero W aswell. ESP32 cam is smaller aswell, so it will probaly be cheaper to 3D print a case for it.
I will use a RPI 4 a server for assimilating all streams on a page. All in all, it was a wholesome project overall.
I have found that not only will this not serve more than one stream, but the server will not respond to another simple http request such as something that gives a 404 result. It’s as if the whole http server is locked up serving the video. Does anyone have an idea on what is causing this and/or a way to fix it? I need to serve some simple pages while the video is streaming.
I understand this now and have fixed it. Any one server can only serve one http request at a time. Since the stream request never ends that server can’t process anything else. My solution was to simply create a new server. The stream is on port 8080 and the normal page server is on 80. If anyone wants to see the code let me know.
Hi Mark.
Thanks for that.
Can you share a link to your code? Don’t paste it here because the formatting will be messed up.
You can use a link to Github or pastebin for example.
Regards,
Sara
Did you ever get this? It’s happening to me too..
Hi,
First of all, thanks for this project and all the other projects on your site! Really awesome!
I just purchased a ESP32-CAM with integrated CH340 and mini-USB port from Aliexpress (advertised as HK-ESP32-CAM; mind the omission of the trailing ‘MB’). It makes this board look very much like a regular ESP32 DevKit; you can flash and power the board using the USB port. At first I couldn’t flash the software, though, but the comments here helped a lot! Hence me sharing my experiences; maybe it helps someone.
This board – it works fine if you use it as ‘AI-Thinker’ module in Arduino IDE – has two buttons next to the mini-USB port. On the left it says RST (Reset) and on the right it says ‘FLASH’.
Now, when you’re ready to upload the Sketch, you click the ‘Upload’ button in the IDE and then press AND hold the FLASH button (right button). Then, when the IDE shows the connection dots (‘….____….____ etc.) you press RST once while you keep holding the FLASH button until everything is uploaded. When the IDE says it’s done, release the FLASH button, press RST once again to make sure and check you code runs.
Hi sara,
How can I Stop Webserver by command ? for example by one switch
Thank you so much for this tutorial!
I have a hard time figuring out if the output is rtps enabled and what the resolution of the ESP32-CAM is by default. I need this info in order to use it with Frigate DVR.
Thank you for any advice you might have!
also esp32-cam can work as rtsp server https://github.com/rzeldent/esp32cam-rtsp
you know what is the config for frigate for this rtsp server?? i cannot make it work
Hi!
I love this project although I haven’t tried it yet…
So just a question on expanding this a bit further…
Is it possible to do the same Home Assistant compatible streaming server with an attached LCD to see what is streamed?
Meaning ESP32-CAM + some LCD module…
Is somewhere a whole project with steps and code available?
Thanks!
What the way to bring it over internet? I mean I have a Domain, Hosting and a Website but, I don’t know how to bring it over the internet so that I can control it remotely.
Hi,
Thanks for the information shared, I got my esp32-cam working fine. One question, is it possible to start up stream in uxga(1600×1200) at powerup. If I had an power failure and it’s restored I don’t want to worry about the camera’s to start up again.
Hi.
Follow this tutorial to learn how to set the camera settings like resolution: https://randomnerdtutorials.com/esp32-cam-ov2640-camera-settings/
Regards,
Sara
Hi, great article thanks!
I want to use a few of these to stream to both browser windows and also via NodeRed. Once deployed how do you locate the IP addresses – or should I be assigning a static IP address to each of them?
Thanks again
Tim
Hi,
I’m using this example in a project.
I would like to add some controls in the GUI.
I got the source files (html+css, etc), can modify them and write them back.
Is the GUI generated by some software? I wish to import the source files and modify them in some HTML editor, WYSIWYG if possible.
Hi.
This video will help you: youtu.be/bIJoVyjTf7g
Regards,
Sara
I had Problems with my ESP32 Cam and wanted to suggest a possible solution if the ESP Hangs:
Add a Hardware Watchdog Timer
#include <esp_task-wdt.h>
#define WDT_TIMEOUT 30
void setup()
….
esp_task_wdt_init(WDT_TIMEOUT, true);
esp_task_wdt_add(NULL);
void loop()
….
esp_task_wdt_reset();// at the start reset the watchdog and then later e.g. in if(!fb)
This restarts the ESP32 whenever it hangs automatically after 30 secs (WDT_TIMEOUT)
It helped me, hope it helps you.
Thanks for sharing this tip.
Regards,
Sara
Where did you get the header files? I’m trying to replicate this but each file adds additional includes. Do you need the includes mentioned in the esp_task_wdt.h?
Jan,
Where did you get the header files? I’m trying to replicate this but each file adds additional includes. Do you need the includes mentioned in the esp_task_wdt.h?
I realize it has been some time since your post but I never received an answer to the question so I thought I would ask again. I am a novice at programming and tend to ride on the shirttails of others so I am not too conversant on your solution. Thank you.
Hey Sara and Rui,
that’s a great tutorial – again! Thank you guys!
One – hopefully simple – question: How can I toggle the onboard-LED / flash (GPIO4) – or any other unused GPIO – online (e. g. with home assistant) while using the camera as IP camera according to this tutorial?
Thanks in advance and best regards
Stefan
Hi guys.
Another best tutorial.
I was wondering if is possible to have in a webserver the image of the cam and 2 momentary buttons , one for pedestrian gate and one for car gate .
Hi,
using Your guides I was able to connect my ESP32 camera to RPi3 and I can watch what is happening in my garden 😉 But I have a question, how to save this live video from the camera to disk (pendrive plugin to RPi3) in Home Assistant?
I needed to crop the image so I expanded the index_html.gz and modified it:
figure img {
display: block;
max-width: 100%;
max-height: calc(100vh - 40px);
/* width: auto;
height: auto */
/* Crop image code /
width: 300px;
height: 300px;
/ object-fit: contain */
object-fit: none
}
Thanks for your share. I success to display my esp32-cam in my ha client. But I can’t see it now, after I change my HA to https by duckdns. Is that effcet it? Could you give me some tips.
Hi Sara,
When using IE browser on my mobile , error code appears : ‘header fields too long for server to interpret”. I try to solve it by searching some information on internet, e.g. amending the following on sketch , but doesn’t work. Is it the problem on Browser type or ESP32CAM ?
(when using Chrome, no such a problem !) Does IE browser send a long header to ESP32CAM and ESP32CAM is unable to interpret it , so making such a response ?
#include “sdkconfig.h”
#include “esp_http_server.h”
#undef CONFIG_HTTPD_MAX_REQ_HDR_LEN
#define CONFIG_HTTPD_MAX_REQ_HDR_LEN 1024
#undef HTTPD_MAX_REQ_HDR_LEN
#define HTTPD_MAX_REQ_HDR_LEN 1024
Looking forward to your idea. Thanks
Gary
Hi,
the esp32 Cam can’t connect to WiFi and sends me back the following message on the serial port each time I try to connect:
“E (26144) wifi:AP has neither DSSS parameter nor HT Information, drop it” (the number in brackets changes with each connection attempt.) The network scan sketch works perfectly, but sends me back the error on one of the networks and recognizes all active networks.
What do you think is the best way to correct this?
Thanks in advance for your help.
Thanks for this – very useful project.
I’m having trouble getting up and running, however.
Quick details: using Arduino IDE on OS X, and an ESP32-CAM-MB board so that I can upload sketches via USB.
I’ve uploaded the sketch, with my wifi network details added, but I’m only seeing garbage on the serial monitor, eg:
……e⸮⸮5 2⸮⸮⸮Ғ&⸮SHBC!ͳi0 PPy]⸮Q⸮⸮_⸮Z⸮”b⸮⸮4’&B⸮e⸮⸮e1⸮P*⸮%=-⸮(⸮e⸮⸮V:⸮bL
22:16:57.904 -> ⸮⸮⸮P⸮⸮h⸮⸮⸮Eɖ⸮x
0X\Eɲi0⸮⸮0I}⸮⸮i00
,⸮!ɲi0⸮⸮,⸮E⸮Jٶ’⸮0,qE⸮⸮⸮Pj
1b⸮⸮⸮HB⸮+⸮J⸮⸮⸮⸮If⸮⸮L,⸮TYK,$SH⸮⸮W⸮,&⸮⸮⸮⸮U ⸮HB⸮]aixh022:16:57.904 -> A⸮]d&'T⸮,⸮,k":⸮2l+⸮⸮'⸮3⸮⸮i0
7⸮0,a9K⸮Q⸮&B
8!⸮]a⸮040
4⸮⸮K⸮V&⸮j
8`6C⸮22:16:57.904 -> A⸮K⸮.⸮⸮⸮0
⸮⸮……………..
Any pointers for what might be happening here?
(Note: I’m actually not sure what ESP32 I have, though it looks identical, to every detail I can see, to the board shown. And sketches compile and upload without errors when I select AI Thinker ESP32-CAM)
Clarification: my board appears identical to that shown in the pics except that the text etched on the metal cover/shield for the main processor does not include “AI Thinker” under “ESP32-S”, and there is a different circular logo in the same position as the AI logo on that cover.
Hi.
Make sure you select 115200 baud rate in the Serial Monitor window.
Regards,
Sara
Your baud rate is set incorrectly. Change it to 115200. I also have the same board but i have another issue. Instead of printing out the IP all I get is
“wifi:AP has neither DSSS parameter nor HT Information, drop it”
repeating endlessly.
I believe I followed the instructions as accurate as possible, but I get this error trying to compile. This IDE works fine for Arduino and Adafruit boards. Any suggestions as to what I got wrong?
Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: “AI Thinker ESP32-CAM, 240MHz (WiFi/BT), QIO, 80MHz”
app_httpd.cpp:22:24: fatal error: fd_forward.h: No such file or directory
compilation terminated.
Multiple libraries were found for “WiFi.h”
Used: C:\Users\closd\Documents\ArduinoData\packages\esp32\hardware\esp32\2.0.2\libraries\WiFi
Not used: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\libraries\WiFi
exit status 1
fd_forward.h: No such file or directory
This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.
Hi.
What is the version of the ESP32 boards you have installed in your Arduino IDE?
Regards,
Sara
Sorry forgot to add this 2.0.2.
Thanks
Hi Dave,
How can you fix error fd_forward
I started from the beginning again and now everything is working! I just had some configuration issues with the IDE on my new iMac!
Thank you for the excellent tutorials on the amazing little gadgets!
I filed a bug report against the main code as the camwebserver is one of the examples. I was told that face detection has been removed from the library. So is there a workaround? The esp32 board does work with other code such as WiFi antenna check and cpu I’d. Thanks.
HLO,
Recently I’m working on project of esp32 cam. I want to change a feature,what I want is that my esp32 cam should get ON only when I get client request.
can you pls help me toknow how can I do this??
thanks
Hello Sara,
Thanks a lot, this is an awesome article.
I followed the steps and managed to stream OK to my ip. However, I can’t capture the stream on OpenCV. This is my python code:
capture = cv2.VideoCapture(‘http://MY_IP’)
I get an error: OpenCV: Couldn’t read video stream from file “http://192.168.1.21”
I am really running out of ideas, some help would be much appreciated. I have tried the article about OpenCV and others but I can’t make this thing work
hello Sara,
I must be missing this file as I get compile error
pp_httpd.cpp:22:10: fatal error: fd_forward.h: No such file or directory
#include “fd_forward.h”
^~~~~~~~~~~~~~
compilation terminated.
Should it be part of a standard package for esp32? If not where should I find it?
I got the cam sketch by downloading and extracting the zip file.
I am using the esp32-cam board.
tks don
Hi.
There should be no need to install that.
Make sure you have the ESP32 boards installed in your Arduino IDE and that you have selected an ESP32 board in Tools > Board.
Regards,
Sara
Is it possible to make some user logon after typing IP address (example: 192.168.1.35) in browser?
Am I right that if I want another resolution I change line 231 (and 235)?
I want to mount a camera in the front of a modeltrain locomotive to be able to see what the driver of that loc would have seen.
I don’t want a very high resolution as I want a nice framerate.
Hello. I’m new using esp32 cam. Can I use esp32 cam as a webcam in pc. I mean I don’t want to use any IP address or wifi. I want to connect esp32 cam with my pc by usb cable it will work as my pc webcam. Is it even possibe?
Please help me.
Hi Sara,
I flashed your code to a ESP32-Cam module and it’s working fine. The only issue I have is that I can only access the webserver from one device at a time. If I connected with my mobile phone and try to connect from my computer it doesn’t work. What have I to change to get access from multiple devices?
I never found a solution to this, so eventually, I downloaded a free copy of Netcam Studio. You can connect as many ESP32 cameras as you like, but only two are un-watermarked n the free version. You can connect a phone and a PC at the same time to any camera on your local network, and you also have the ability to connect from anywhere in the world via your external IP address. There is an app to go on your phone to facilitate this. There is also a local client to run on your PC so you don’t have to go via a browser. The app also has sophisticated recording features with automatic archiving by date and time. I have no affilliation to the producers of this software. I hope you find this useful
Hi! Could you suggest some changes in Video Streaming Web Server Code so that I can get a 90 degree rotated video stream on the webpage.
Long Time ago I asked for the same problem. There was no solution.
so how do we rotate the image 90 or 180 degrees in year 2022 ? Any ideas?
can i know how to solve this error???
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
Failed uploading: uploading error: exit status 2
Hi.
Your board is not in flashing mode. Make sure you upload code to the board properly.
See section number 1) of this tutorial: https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/
Regards,
Sara
I get this error when I try to program:
A fatal error occurred: MD5 of file does not match data in flash!
Other sketches upload fine. Has anyone seen this error? Cure?
This code works great. I can access the stream via http://192.x.x.x/, but is there a way to capture jpgs via the web interface. Some cameras allow it via http://192.x.x.x/capture or similar.
Hi, thanks for the great project.
I have a question about the local-IP, like here it is: 192.168.1.91
my question is how does it come out? where it is configed?
Best
Adam
Hi, I love the simplicity of this bit of code, I wanted the simplest possible way to add a wireless camera to my ad-hoc group of IP cameras, and it works great with my Security-Eye setup. The only thing I wish it had was a time/date stamp overlay, or even a blinking dot overlay on the stream so I can know if the camera is still alive remotely. Is there any way to do that?
Hi Sara,
I was wondering if it is possible to use the ESPAsyncWebServer for the stream?
Then possibly running AsyncElegantOTA for OTA updates?
I want to stream videos using the example code “CameraWebServer” outside my local network. I’m able to set up port forwarding on my Netgear N600 router for accessing the ESP32-CAM web page from anywhere (Port 80). However, only the “Get Still” function works. The “Start Stream” button yields a broken image icon. I read somewhere that Port 81 is for streaming. But how do I set it up so that it works for displaying the web page (Port 80) as well as streaming (Port 81)?
Hi,
Thanks for this beatifull work but i have a question/challenge.
Is ir possible to include a DS18B20 sensor connected to ESP and showing information too in Home Assistant?
Hello,
I made the “ESP32-CAM Video Streaming Web Server” project and it happens to work on the Mac via Safari, where I see the camera image.
I don’t see anything instead on my iPhone 14 with IOS 16.2.
Where did I go wrong?
Hi.
The video streaming is only accessible in one browser at a time.
Make sure you close your computer browser before trying to access on your phone.
Regards,
Sara
Hi Sara,
What causes the limit on the number of connections?
David
howdy!
I have 2 of these ESP32-CAMs and oddly, 1 will works well only when connected to the computer’s USB. When I use external power, the refresh rate is super slow.
Strangely, the other unit works perfect on external power. I can’t figure out why that would be. I did turn off the debug flag, but no effect.
thanks for any info you might have.
regards, Noel
I did make some progress on this. Apparently a known phenom, that if you put your finger down on the board near the camera connector, the frame rate increases dramatically.
I tried a few other things, but it must be antenna related (since the board’s antenna is on the other side). First I thought it was clock noise, not sure about that yet.
regards, Noel
Hi.
See this article about the antenna that might help: https://randomnerdtutorials.com/esp32-cam-connect-external-antenna/
Regards,
Sara
Hi Sara,
Yes this is what I just did ! and it works perfectly now.
thank you!
Noel
Hi,
your code was the only way to bring my ESP32-Cam to live – thanks for that! The “original” Arduino-IDE-example didn`t work, I tried a lot of settings but no way. With your sketch one try: success!
What I’m missing: is there a possibility to set some sliders in a settings-menu to adapt “brightness”, “saturation”, etc.?
thanks again,
kind regards,
Christian
Hi.
If you don’t have that interface, it is easier to adjust the code.
See this example: https://randomnerdtutorials.com/esp32-cam-ov2640-camera-settings/
Regards,
Sara
Much angst would be avoided if the src line in the nodered integration Template was corrected.
It has https, not all of us use https on our local networks. Should be http if all you see on the dashboard is a tiny picture icon.
Hi,
This example works great for me. But… there is always some BUT.
Is it possible to add some text before or after the picture on the page?
Hi,
As always your tutorials are great and my issue is not with your tutorial but my own hardware.
The video and stills taken by my esp32-cam are out of focus, is there anything I can do on a software side to get them back in focus or do I just have a bad cam?
Thanks
Melcus
Hi.
Bad focus? I’m not sure… It’s probably a problem with the camera?
Did you remove the small plastic that protects the camera when you first get it?
Regards,
Sara
Sadly no I have already removed the plastic, I think I just have a bad camera 🙁
If you have a 3D printer you can search Thingiverse.com for “ESP32 Cam focus tool”, download and print one of these things. Then you can try to manually focus your cam.
Thanks I will check that out
I suggest this one: thingiverse.com/thing:5027224
as it prevent the camera from moving while focussing.
and of course this: thingiverse.com/thing:4084103
Hi,
Can you make a tutorial of how to send images using MQTT to a Home Assistant installation? My goal is to get one single image from a remote ESP32 camera by request (flipping a switch on HA).
The setup would be:
– a HA installation on site A
– an ESP32-cam on site B, connected to Mosquitto broker on HA via Internet
– HA would post a request on a dedicated topic and so the ESP32 will send back a base64 encoded image on some topic so HA would display it.
That would be the plan but it overwhelms me for the moment 😐
Thank you!
Hi,
After my issue with my last cam that was out of focus I got another cam, this time the picture is perfectly clear which is great, but this time the video streaming and photos are rotated 90 degrees. I see in another of your tutorials you explain how to rotate photos by 90 degrees but I am not seeing anything about rotating video stream, is there a simple solution or should I redesign the box I created to hold the cam?
Thanks
Melcus
I think you will find that it is a function of the actual mini camera, and not something that can be changed. I am sure that this has come up on here before. I have used a lot of these cameras, and I have had a couple where the image is rotated by 90 degress
just uploaded the code on my esp-32 cam. going to the ip address on safari just fails to load. serial monitor prints “Camera capture failed” over and over again without any other error message.
I have the same result.
Did you manage to solve this problem?
I tried with a different Board+Cam and it worked. I guess the OV2640 might be faulty
I tried with a different Board and Cam and it worked.
Then I swapped the working Cam with the one that gave the error, and I got the error again.
Therefore the problem is a faulty OV2640 Cam
Hi
I would like to be able to use this project to observe a location on demand but using battery power. Making the camera work on a lipo is not a problem but the current draw is! What is needed is a way to have the camera sleep (doesn’t have to be deep sleep, modem sleep or light sleep would work) and wake up when my browser sends a request, The go back to sleep when the browser closes the page. This would be an invaluable device which would allow you to monitor any location on your property when you want and where wifi could reach. Any chance this might be a future project ?? Thanks for all your good work!
I would like to use XIAO ESP32S3 with camera module for project like this. But I don not know how to rewrite your code. Any advices? Thank you.
Hello. I use a programmer from the Czech company “Laskakit.cz” to program ESP32CAM
LaskaKit CP2102 Programmer USB-C, microUSB, UART. It is an improvement of the programmers mentioned.
Hi, I have installed the standard example with ESP32CAM.
when I access it inside my local network, it works fine, I can start and stop the streaming, save pictures, even command the LED brightness etc.
Then I built a redirection to be able to reach it from outside.
I redirected to port 80.
When I call this address (http of course, not https) it shows the usual command screen but there is no image shown during the streaming, and moving the LED brightness slider does not make any difference.
I tried it from a computer, then from a mobile phone and both devices provide the same result.
Do I need to open another port?
Or is there something different to look at?
Thanks
I dont find any word about accessing the camera’s webserver with https.
Is this not possible?
http is just too easy to eavesdrop.
For local home coverage, the ESP-32 is tied to you local modem, so anybody with password access to your local network can access it.
There are a lot of deprecation warnings.
Would be awesome if someone could take care of it 🙂
Hi.
What warnings do you get?
Regards,
Sara
Hi Sara,
I tried your code with a AI Thinker ESP32-CAM and it works nicely. Is there a possibility to modify the camera settings after initializing the camera module from within the sketch? I would like to flip the screen vertically. I tried to do so by fumbling around with those parameters in sensor.h but wasn´t successful.
Keep up the good work!
Regards
Albert
Hello Sara,
I have to apologize for molesting you. I figured it out by myself how to flip the screen.
After initializing the camera I added:
sensor_t * s =esp_camera_sensor_get();
s->set_vflip(s, 1);
That was all. I assume it works for other camera parameters defined in sensor.h as well.
Keep up the good work!
Regards
Albert
Worked instantly, thanks.
I do have a small issue. I am using my laptop browser to view the stream. It works for maybe a minute or a little longer, then the browser window freezes. I can restart it just by clicking the restart (circular arrow icon). I suspect this is a wifi connection issue due to low power on the ESP32-cam unit, but have no way to verify. I do not have to restart the ESP32-cam unit. Any ideas how to keep this stream going?
How do you power the board?
5v (varies 80-200 ma). That seems to help a lot of things, not just keeping the screen alive. Frame rate goes up, and it may be my imagination, but image sharpness seems better, too.
Hello Sara,
I have two ESP32-CAM. One is Ai-thinker and I have it working now, quite difficult at beginning.
The second is a Wroom and it seems to work, but I get a big frame named “Toggle OV2640 sttings” which gives opportunity to adjust all parameters. It covers the complete screen and I can have the stream from the camera by clicking “Start Stream”, and that is really a very small picture and the table doesn’t disappear.
How can I remove this frame ? I can disable it by clicking just on the left corner, but it comes again each time I want to use the camera.
I have downloaded again the script, the same script and it works fine now. This unwanted frame is not there anymore.
I cannot understand where it came from, but it works anyway.
Hello,
I have loaded the ESP32CAM Webserver, and it works, but I have the configuration menu always active. I mean I have on top of the screen (on my android) a menu called “Toggle OV2640 sttings” and I really don’t need this menu.
Of course, I can hide the menu by clicking on it, but it appears each time I connect and I wish to have something working without any human act.
How van I remove this feature ? I guess it is somewhere in the PSRAM, but I cannot delete it and I am afraid to break the ESPCAM if deleting it without adding a link to my script.
Hello and sorry for the inconvenience.
I studied a bit the examples related to the ESP32CAM with the two libraries:
ESPAsyncWebServer and esp_http_server.h.
I would need to perform video streaming and manage a button capable of capturing the single image. Is it possible to have an example that replicates this function with the second library or alternatively to have some links about it?
I searched a lot but didn’t find anything easily applicable.
Thank you.
Hello,
is it OK to integrate this ESP32 CAM into Iphone APP such like nest?
Thanks.
Hi Sara,
Thanks for the tutorials. I am fan of RN!
I have a question. is there a way I can save the video and/or images on the PC that accesses the web server?
I run a free program called Netcam Studio, which allows two completely free cameras, and as many more as you like, but with a translucent banner across their pictures. You can remove this by purchasing a license for a very reasonable price. There is an app to run on your phone which allows you to connect to your cameras by wifi if you are on the same network, or from outside via the internet talking direct to your external IP address. Works very well. I have six ESP32 cameras connected