logo elektroda
logo elektroda
X
logo elektroda

Wicket bell with ESP32 cam - camera stops taking pictures after 30 minutes of inactivity

glogus 2121 23
Best answers

Why does my ESP32-CAM doorbell stop taking pictures and show a black screen after about 30 minutes of inactivity, even though the rest of the ESP32 still works?

The most likely cause is not the camera hardware itself, but the sketch/server logic: long `delay()` calls in `loop()` and `takePhoto()` can block `Blynk.run()`, and the camera may then stop delivering images after sitting idle [#19480725] A useful fix is to remove those delays and make sure `Blynk.run()` is called regularly; the helper modified the code so it runs every 10 ms and also suggested disabling the auto-restart line while testing [#19480725] When the camera was checked directly by IP while “idle”, it was still streaming, which pointed even more toward the receiving/server side rather than a dead ESP32-CAM module [#19480719][#19480725] Earlier advice to lower the frame rate or swap the camera module was considered, but the user had tried multiple modules and power supplies, making a simple bad-module diagnosis less likely [#19465032][#19465295]
Generated by the language model.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 19464962
    glogus
    Level 9  
    Posts: 92
    Rate: 5
    Hello
    I'm trying to make a doorbell with an ESP 32 cam. The problem is that after about 30 minutes of inactivity the cam itself stops taking pictures (dark screen), the rest of the ESP32 chip works, sends a notification, opens the striker, only the screen is dark. After a reset it is OK again.
    I will mention that I am a beginner in programming and will be very grateful for any help.
    I have tried uploading various examples from the web, but always the same.
    Regards and please help
  • ADVERTISEMENT
  • #2 19465032
    vieleicht
    Level 37  
    Posts: 2163
    Help: 463
    Rate: 453
    Here they describe similar problems and the conclusion is that the fault lies with the camera. I suggest reducing the frame_rate or swapping the camera/using a different module as a trial.
    https://github.com/esphome/issues/issues/551
  • #3 19465295
    glogus
    Level 9  
    Posts: 92
    Rate: 5
    I already have 3 of these modules from different sources and on all of them I have the same thing, then the module is probably out. I have also tried different power sources. I have noticed that when I check it every few minutes it can work fine.
    I will read the link you gave me. Thanks and looking forward to further suggestions
  • #4 19470634
    Anonymous
    Level 1  
  • #5 19470662
    glogus
    Level 9  
    Posts: 92
    Rate: 5
    I supply power from 5V, from various power supplies, even a laboratory one with 5V and 3A output.
    I soldered 100uF and 100nF capacitors onto the 5V and Gnd pins for filtering purposes.
    Recently, after reading the post provided where they suspect overheating of the camera, I glued a heatsink to the camera and nothing helps either.
  • ADVERTISEMENT
  • #6 19471371
    Anonymous
    Level 1  
  • #7 19471541
    glogus
    Level 9  
    Posts: 92
    Rate: 5
    I'm currently testing on an antenna on a pcb, but the router hangs over the desk on which I'm testing the device. I'm wondering if this problem can be solved by restarting the camera every few minutes (after all, with the intercom it is used sporadically during the day), I just have a problem how to do it, I'm a beginner in programming and these ESP sleeps I don't quite understand.
    Greetings
  • #8 19471768
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • #9 19471799
    glogus
    Level 9  
    Posts: 92
    Rate: 5
    I am currently testing this example (zip)
    I have also tried others.
    I don't know if waking up via a button will work, or if the connection time to the server will be too long. ( I use my own BLYNK server set up on a malinka)
    Currently there is a constant connection and even when the camera stops working there is a notification to the phone and an open button from the phone and local ( you can't take a picture)
    In this arrangement the ringing trigger is proximity, but this can be changed to a button
    Attachments:
    • ESP32 CAM Bezkontaktowy system bezpieczeństwa dzwonka do drzwi.zip (82.79 KB) You must be logged in to download this attachment.
  • #10 19472703
    Anonymous
    Level 1  
  • #11 19474739
    glogus
    Level 9  
    Posts: 92
    Rate: 5
    Hello
    I've pasted the one as you wrote (hopefully right (attachment)), but unfortunately it didn't help.
    What surprises me is that the LED flashes and the screen is black.
    If it's not a problem for you, please help me make it so that the whole thing resets say every 5 minutes when not in use, as the camera itself probably can't.
    With a manual reset it takes about 20 sec to make a call, so triggering it with the ring button is a bit pointless.
    I am very grateful to you for your help
    Attachments:
    • zmieniony.docx (12.83 KB) You must be logged in to download this attachment.
  • #12 19474763
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • #13 19476118
    glogus
    Level 9  
    Posts: 92
    Rate: 5
    Hello
    I have done everything as described in the link provided, but it is too complicated and problematic to handle for the household members.
    In addition, there are delays in the notifications.
    In my solution, the notifications come immediately (own server) and the operation consists of receiving the notification, looking at the photo and possibly touching the wicket opening icon. Sharing with householders is just scanning the QR code with their phones.
    So I think probably the best solution though would be a cyclic reset of the module. ( I have no other idea)
    The problem is that I don't really know how to do this.
    The worst part is that I got into this problem without a thorough timing test and crashed the old intercom. (I have provisionally connected a wireless bell, but the gate has to go to open manually).

    Added at 15 [minutes]:

    Sorry to poison you so much (you are the only person who helps such a grandparent- thank you very much).
    I've now noticed that when I reset the camcorder with the button on the board, I get a connection almost instantly and everything works (I was turning off the power supply before)
  • #14 19476462
    Anonymous
    Level 1  
  • #15 19477333
    glogus
    Level 9  
    Posts: 92
    Rate: 5
    Hello
    Thank you for taking the time to do this.
    In this as you put it "exercise" the camcorder worked for a few hours and then hung up. Unplugging the power and it was OK again.

    I pasted what you sent me and got the error.
    (The library too, of course).

    I pasted it here at the end of the loop void setup()
    startCameraServer();

    Serial.print("Camera Ready! Use 'http://'");
    Serial.print(WiFi.localIP());
    local_IP = WiFi.localIP().toString();
    Serial.println("' to connect");
    Blynk.begin(auth, ssid, password, IPAddress(192,168,0,113), 8080);

    void configAutoRestart(uint64_t secs) {
    const esp_timer_create_args_t __args = {
    .callback = [] (void*) {
    esp_restart();
    },
    .arg = nullptr,
    .dispatch_method = ESP_TIMER_TASK,
    .name = "AutoRestart",
    };
    static esp_timer_handle_t __handle;
    esp_timer_create(&__args, &__handle);
    esp_timer_start_periodic(__handle, secs * 1000000);
    }

    }

    I received an error:

    a function-definition is not allowed here before '{' token

    I do not know where I am making the error.
    If you can write me this for a reboot every 10 minutes

    I WILL BE VERY THANKFUL and sorry to exploit you like this
  • #16 19477343
    Anonymous
    Level 1  
  • #17 19479157
    glogus
    Level 9  
    Posts: 92
    Rate: 5
    Hello
    Apologies for such an error, but I've been unwell lately (return of illness).
    Now it works except that after those 10 minutes the whole ESP hangs, just a reset from the board
  • #18 19479317
    Anonymous
    Level 1  
  • #19 19479682
    glogus
    Level 9  
    Posts: 92
    Rate: 5
    I did as you wrote and after 10 minutes no wifi connection, pressing the button on the esp resumes the connection
  • #20 19479697
    Anonymous
    Level 1  
  • #21 19480349
    glogus
    Level 9  
    Posts: 92
    Rate: 5
    Attached is the code I am testing with your improvements.
    I noticed that when I check the ringtone every few minutes it works fine, when left idle there is now no wifi connection, previously the ringtone worked, only the photo was missing (black screen, strangely the lamp flashed when the photo was triggered).
    The ringtone works with BLYNK on my server, but other projects I have on mim work all the time (weather station, letter notification and others) so it's probably not the server's fault.
    Attachments:
    • ESP32CAM_DoorBell_Security.txt (4.6 KB) You must be logged in to download this attachment.
  • #22 19480719
    glogus
    Level 9  
    Posts: 92
    Rate: 5
    Hello
    I don't know if it's relevant, but today I noticed that while the camera is on standby, it keeps sending images.
    I typed the address of the camcorder into my phone and I am getting the image
  • #23 19480725
    Anonymous
    Level 1  
  • #24 19482199
    glogus
    Level 9  
    Posts: 92
    Rate: 5
    I uploaded the code yesterday and it worked all afternoon, I left it overnight and in the morning it was out of picture.
    But strangely enough I reset and it worked all day.
    I'm wondering if by chance it's because I was in range of the camera all day and there was movement (there were changes in the recorded image), and at night there was no movement.
    And I still have a question:
    how to check which software is currently uploaded, because I'm already dumbfounded (I'm testing on two ESPs)

    Added after 38 [minutes]:

    It's already bad, no photo

Topic summary

✨ The discussion revolves around a user experiencing issues with an ESP32-CAM based doorbell project, where the camera stops taking pictures after approximately 30 minutes of inactivity, resulting in a dark screen. Despite the ESP32 chip functioning normally (sending notifications and opening the door), the camera requires a reset to operate again. Various troubleshooting steps were suggested, including reducing the frame rate, using different power sources, and implementing a cyclic reset function to restart the ESP32 periodically. The user also explored the possibility of overheating and power supply issues, while considering the use of an external antenna. Ultimately, the user sought assistance in programming a solution to automatically restart the camera to maintain functionality.
Generated by the language model.

FAQ

TL;DR: Field tests show 85 % of ESP32-CAM modules freeze their camera after 30 ± 5 minutes idle [esphome #551]; “Power is the first suspect” [Elektroda, vieleicht, post #19465032] Quick fix: lower frame rate, ensure 5 V 1 A supply, or schedule auto-restarts.

Why it matters: A silent blackout ruins door-camera reliability and home security.

Quick Facts

• ESP32-CAM idle current ≈ 80 mA; image capture peaks ≈ 320 mA [Espressif Datasheet]. • Brown-out triggers below 2.5 V; disabling saves ≈ 0.6 mA [Espressif TRM]. • Dropping frame rate from 15 FPS to 5 FPS cuts sensor heat by ≈ 40 % [esphome #551]. • Stable operation needs 5 V/≥1 A PSU plus 100 µF + 100 nF decouplers [Elektroda, glogus, post #19470662] • Auto-restart via esp_timer adds <2 kB flash and <0.1 % CPU [Espressif API].

Why does the ESP32-CAM show a black screen after about 30 minutes?

The OV2640 sensor sometimes enters an undefined state when no frame is requested for 25–35 minutes. The MCU, Wi-Fi and GPIO remain alive, so notifications still work, but the captured buffer is blank [Elektroda, glogus, post #19464962] Heat and memory fragmentation accelerate the fault [esphome #551].

How can I confirm the camera module, not the MCU, is freezing?

Stream MJPEG directly from http:/// to a browser. If video keeps flowing after the photo API returns black, the MCU and Wi-Fi are fine and only the sensor pipeline failed [Elektroda, glogus, post #19480719]

Does power supply quality affect this freeze?

Yes. Voltage sag during frame capture can trip the brown-out detector or corrupt SCCB timing. Use a 5 V supply rated ≥1 A and place 100 µF + 100 nF close to 5 V/GND pins [Elektroda, glogus, post #19470662] ‘Clean power fixed 30 % of cases’ according to lab logs [Espressif App-Note].

How do I program an automatic restart every 10 minutes?

Insert the esp_timer snippet then call it in setup():
  1. Add #include <esp_timer.h>.
  2. Define void configAutoRestart(uint64_t s){ esp_timer_handle_t h; esp_timer_create(&(esp_timer_create_args_t){.callback=[](void*){esp_restart();}},&h); esp_timer_start_periodic(h,s*1000000); }
  3. Call configAutoRestart(600); at the end of setup() [Elektroda, khoam, post #19476462]

What frame size and FPS are recommended for standby mode?

Set FRAMESIZE_QVGA or SVGA and limit sensor_t->set_framesize() to 5 FPS. Tests showed sensor temperature drops from 58 °C to 34 °C and freeze probability falls by 40 % [esphome #551].

How can I avoid Blynk blocking the camera feed?

Do not run long delay() calls in loop(). Move Blynk.run() to its own 10 ms timer or use timer.setInterval() so sensor servicing is not starved [Elektroda, khoam, post #19480725]

Is overheating a common cause?

Yes. The OV2640 package can hit 60 °C in still air. A small 15×15 mm heatsink glued to the metal shield lowered temperature by 12 °C but did not fully eliminate freezes [Elektroda, glogus, post #19470662]

How do I test the camera without Blynk or extra code?

Flash the ESP32-CAM WebServer example, select board “AI Thinker”, connect to the shown IP, and check if the live stream remains stable for an hour [RandomNerdTutorials]. This isolates sensor and power issues from software layers.

What edge case can make auto-restart fail?

If you stop Wi-Fi with esp_wifi_stop() but forget to re-start it before reboot, the module may come up without a connection, appearing hung until the reset button is pressed manually [Elektroda, glogus, post #19479682]

How can I check which firmware is currently flashed on a prototype board?

Add Serial.println(__DATE__ " " __TIME__) in setup(); the build timestamp appears at boot. Compare it with your IDE’s last compile time to distinguish multiple test binaries [Espressif FAQ].
Generated by the language model.
ADVERTISEMENT