Access Control with Face Recognition

Door Control Face Recognition

Open a door when a face is recognised using the ESP32-CAM

This page contains code and other information for the the YouTube video found here: https://youtu.be/mu3-Sff0B9w

The code is a combination of the ESP32-CAM Face Recognition for Home Automation and ESP-WHO Face Recognition with WebSocket Communication tutorials.

As mentioned in the video, while this demonstration works well, the ESP32-CAM and associated IDF and Arduino libraries don’t match professional face based access control systems. It can be easily tricked and doesn’t check for ‘liveness’. It could be used as a secondary control system to open doors or activate systems for people that have already passed through another access control system.

If you want to see more like this then please say ‘thanks’ with a coffee below.

Download files from here: https://github.com/robotzero1/esp32cam-access-control


131 Replies to “Access Control with Face Recognition”

  1. Jasou says:

    Hi !
    Thankk you for the code , but i have a problem with esp32 cam when i enter access control it freezes then crashes and i have to restart it to work again , can it be a problem of overheating or something else ? any idea to fix this ?

    1. WordBot says:

      Hi, I was sometimes seeing this. I’m not sure if it’s a bug in the Espressif libraries (I think someone else has reported this) or the camera is just overheating. It seemed random to me.

  2. Noppanun says:

    Hi !
    I’m thai and love this project,so plz tell me how to detect intruder in code i’m beginner.

    1. WordBot says:

      Hi, I’m not sure what you mean but check out the other tutorials on the site and maybe there’s something to help.

  3. Dimitris says:

    First of all congrats for this great work!
    I’m facing an issue on this project…Everything was running perfect until the last couple of days i was no longer able to stream from the esp-32 cam, as a result it couldn’t detect or recognize faces anymore. I updated the boards and libraries, i even tried it from different computer and browser but still the same. I still can browse into the web UI but it won’t stream any image from the left window. I tested my esp32-cam board on other projects and it’s fully functional. So, any thoughts what’s causing this issue? Thanks!

    1. WordBot says:

      Does the camerawebserver example work for you? If you load that up can see the video at http://your-ip-address:81/stream ? Might be the camera.

  4. Keith Mack says:

    Success, installed 12/1/2019! Did the partition table changes and installed the code from the zip file. Worked great, no issues!
    Tried to strip down the code for OTA but couldn’t get that to work, only had about 10 minutes to work on the OTA, I’ll try again later.
    Thanks very much for posting this and the YouTube video!

    1. WordBot says:

      Great! It’s always nice to hear when people have a project working.

  5. Eva says:

    Thanks for sharing this. I implemented it and tried compiling the code; but got the following error message:
    ‘ Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it.
    Error compiling for board ESP32 Wrover Module. ”
    Please, what should I do to solve this? If I change partition scheme to ”Huge App (3MB No OTA…), it compiles.

    1. WordBot says:

      Did you create a new partition following this tutorial – https://robotzero.one/esp32-face-door-entry/ ? It’s a big application but also needs the partition for storing faces.

  6. Preman Jeyabalan says:

    Hi, I’ve followed what you’ve done but when I copy the code in I get the following error:

    ‘struct mtmn_config_t’ has no member named ‘type’

    Any solutions to this?

    1. WordBot says:

      Hi, Probably the wrong ESP32 Hardware library is installed. Which version are you using?

  7. Preman Jeyabalan says:

    Hi, sorted that out, yup I was using the wrong hardware. Sorry to ask a question a little unrelated here, but if say i wanted to store the enrolled faces on a google firebase database, which function do I call that contains the blob information?

    I’m quite new to this and I haven’t found any help online.

    1. WordBot says:

      I’m not sure how you would save the face information somewhere different from the flash memory. I don’t know how well the recognition would work if it was testing against face data that wasn’t stored locally… it might be too slow.

  8. cavim says:

    hey i want ask about something
    I have followed all the ways to be done but I found an error

    Camera Ready! Use’http://192.168.1.68′ to connect
    [D] [WiFiClient.cpp:509] connected(): Disconnected: RES: -1, ERR:104
    [E] [WiFiClient.cpp:392] write(): fail on fd 60, errno: 104, “Connection reset by peer”
    [E] [WiFiClient.cpp:392] write(): fail on fd 61, errno: 104, “Connection reset by peer”

    can you help me? why show this error

    1. WordBot says:

      Do you know which version of the ESP32 Hardware libraries you are using? Does it always happen?

  9. cavim says:

    Im using v1.0.4
    Yes it always happens, and until now it’s still like that

    1. WordBot says:

      Hmmm. I’m not sure. I thought it was a problem with a previous version of the Wi-Fi library. It works fine on my ESP-EYE so it should be OK on the Ai-Thinker.

      I noticed that when I close the browser I see that message which means it comes up when the connection to the browser is lost for whatever reason.

      Can you move closer to the router? Might be a power issue as well if the radio for the Wi-Fi doesn’t have enough juice.

  10. +krish sharan says:

    whenever i click the ip given in serial monitor it shows like
    WiFi connected
    httpd_start
    Camera Ready! Use ‘http://192.168.43.116’ to connect
    [E][WiFiClient.cpp:392] write(): fail on fd 60, errno: 104, “Connection reset by peer”

    IT shows an error.Please hep me out

    1. WordBot says:

      Does it work at all? I guess you are using the 1.0.4 of the ESP Hardware libraries? Can you try moving closer to your router?

  11. Vichu says:

    Hello, thanks for the great code snippet.
    I also faced the same issue, when I entered access control the camera freezes and the system reboots.
    I have made a small changes and the issue is resolved.
    Under the recognition branch statement above the line of code “if(f)” the piece of code
    “Serial.println(f->id_name);” is removed. Before validating the condition the name is printed in serial monitor causing load prohibited error and causing the system to reboot in my scenario.
    Thanks again..

    1. WordBot says:

      Ah.. thanks for pointing that out. I hadn’t noticed that line sitting there. I’ve removed it.

  12. ANIRBAN GHOSAL says:

    Please help..
    Showing error during compliling. It shows “camrea_index.h” no such file or director ”..

    “Multiple libraries were found ” for WiFi.h

    1. WordBot says:

      You need to read the tutorial entirely. You’ve not got all the files you need in the directory.

  13. wasantha says:

    Sir I am getting error on line 200 saying “static inline int do_enrollment(face_id_name_list *face_list, dl_matrix3d_t *new_id)”
    can you help me.
    hope to hear form you soon

    1. WordBot says:

      Hi. What error do you see?

  14. Andri says:

    Hello Master
    I have error
    [D][WiFiGeneric.cpp:337] _eventCallback(): Event: 0 – WIFI_READY
    [D][WiFiGeneric.cpp:337] _eventCallback(): Event: 2 – STA_START
    ..[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 5 – STA_DISCONNECTED
    [W][WiFiGeneric.cpp:353] _eventCallback(): Reason: 2 – AUTH_EXPIRE
    ..[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 4 – STA_CONNECTED
    [D][WiFiGeneric.cpp:337] _eventCallback(): Event: 7 – STA_GOT_IP
    [D][WiFiGeneric.cpp:381] _eventCallback(): STA IP: 192.168.43.148, MASK: 255.255.255.0, GW: 192.168.43.121
    .
    WiFi connected
    httpd_start
    Camera Ready! Use ‘http://192.168.43.148’ to connect
    [D][WiFiClient.cpp:509] connected(): Disconnected: RES: 0, ERR: 128

    Now. I use Board 1.0.4 and library manager arduinowebsockets ver. 0.4.10 for Arduino 1.8.12
    Before the upgrade went well. But now it can’t.
    Can You help me…

    1. WordBot says:

      Hi, I thought it wasn’t working before updating to 1.0.4? It might be a poor Wi-Fi connection. Does the CameraWebServer example work well for you?

  15. Andri says:

    When I try to use the example camera webserver works fine, sir.

  16. You are cool says:

    Hello, thanks for the great instructions…..

    One question can I directly access the camera stream?

    1. WordBot says:

      Hi. If you just want the stream the easiest way is to load up the CameraWebServer example and open http://ip.address.of.esp32:81/stream

  17. Temp says:

    Hello, is it possible to increase the frame size to svga???

    1. WordBot says:

      Hi, You can stream at SVGA but the face detection etc has to be run at a lower resolution.

  18. Temp says:

    Hello, why has the face recognition has to be run at a lower resolution??

    1. WordBot says:

      It’s a limit of the hardware but mostly face recognition doesn’t need high resolution images.

  19. temp says:

    How can I change the resolution during runtime? Can you show me this?

    1. WordBot says:

      You can change the resolution like this:
      sensor_t * s = esp_camera_sensor_get();
      s->set_framesize(s, FRAMESIZE_SVGA);
      delay(300);
      camera_fb_t * fb = esp_camera_fb_get();

      But not while grabbing frames. You would have to close the framebuffer with esp_camera_fb_return(fb); then change and restart.

  20. sneyl says:

    Sorry, but can you help me? What happens is that when editing the html file that comes inside the zip, it does not make the changes, for example it does not change the text to Spanish, but always remains in English
    Does anyone know why? or where it has to be modified?

    1. WordBot says:

      HTML file is just for reference. Check this tutorial for how to edit the HTML – https://robotzero.one/esp32-cam-custom-html/

  21. Amgad Steen says:

    This is a great work and it works for me fine. Thanks very much
    My question how to activate access control on start without clicking
    its button from web server ?

    1. WordBot says:

      This version you can disconnect and it still works – https://robotzero.one/wp-content/uploads/2020/03/FaceDoorEntryESP32CAMPremium.zip I’m working on a version that works connected or not.

      1. David Moreira says:

        This blog is really amazing. Congratulations!
        I applied the scketch https://robotzero.one/wp-content/uploads/2020/03/FaceDoorEntryESP32CAMPremium.zip.
        Everything works perfectly and reliably while I’m with the browser open. When I click on disconnect I get the following message in the serial:

        inactive selected
        Guru Meditation Error: Core 1 panic’ed (LoadProhibited). Exception was unhandled.
        Core 1 register dump:
        PC : 0x400d1e1f PS : 0x00060330 A0 : 0x800d1f38 A1 : 0x3ffb1ee0
        A2 : 0x00000000 A3 : 0x00000011 A4 : 0x3ffdec34 A5 : 0x3ffbdbcc
        A6 : 0x00000000 A7 : 0x3f8bb848 A8 : 0x800d1e13 A9 : 0x3ffb1eb0
        A10 : 0x3ffb9520 A11 : 0x00000000 A12 : 0x3ffdef00 A13 : 0x3f8f3c5c
        A14 : 0x00000001 A15 : 0x3ffb1e54 SAR : 0x0000001e EXCCAUSE: 0x0000001c
        EXCVADDR: 0x00000004 LBEG : 0x4008cfec LEND : 0x4008d008 LCOUNT : 0xffffffff

        ELF file SHA256: 0000000000000000

        Backtrace: 0x400d1e1f:0x3ffb1ee0 0x400d1f35:0x3ffb1f00 0x400d7d0d:0x3ffb1fb0 0x4009005e:0x3ffb1fd0

        Rebooting…

        Is this sketch works off line?

        1. WordBot says:

          It should continue to work. Could you see where the error occurs with this? https://github.com/me-no-dev/EspExceptionDecoder

  22. Amgad Steen says:

    Thanks for your replay
    But I do not want to connect to any external links as this is local home door.
    I just want to activate access control at startup
    I will wait for your new version.

    I have another issue that esp32-cam board gets heated fast and then freeze so I have to power
    off and on again every 15 minutes, Any one have this problem ??
    # The heat concentrated in WiFi metal shield.

  23. Amgad Steen says:

    This project is perfect but not practically as if you use it for example for your home you should be connected with web server for start face-recognition.
    This means if you out side and one of your family come home he can not come inside as the web server is not connected

  24. radek_marko says:

    Hi, I have the same issue as reported by Dimitris November 14, 2019 at 10:59 am. I’ve loaded the software and did work for a short period of time. I’ve loaded CameraWebServer example and the camera does work correctly. FaceDoorEntry is giving me the following screen:

    https://drive.google.com/file/d/1QcbvuWPS8L-V1lLD91SnGca_Ur1sLygZ/view?usp=sharing

    I’ve added an extra output in the code:
    void loop() {
    Serial.println(“Loop starts”);
    auto client = socket_server.accept();
    Serial.println(“Clinet created”);

    The output gives me “Loop starts”, but not “Clinet created”

    Any suggestions would be much appreciated.

    1. WordBot says:

      Hi, It seems like you don’t have a very good connection to the Wi-Fi and the websocket connection isn’t being made. Do you have the internal aerial connected: https://robotzero.one/wp-content/uploads/2019/01/esp32-cam-ipex-antenna-jumper.jpg

  25. Amgad Steen says:

    Is there is a way for face-recognition and open door without web connect ??

    1. WordBot says:

      You can use the first tutorial you tried. This works without the browser connection: https://robotzero.one/esp32-face-door-entry/ Otherwise wait a few weeks and I’ll have another tutorial like the one above that works with and without Wi-Fi

  26. Carlosmtzv says:

    I have the same problem as radek marko
    I used it for 2 weeks without any problem until yesterday, since I no longer let myself in to watch the transmission from the camera.
    I get this error:
    [D] [WiFiClient.cpp: 509] connected (): Disconnected: RES: 0, ERR: 128
    I don’t understand why it happened, it just stopped working.
    Has anyone solved this problem?

  27. Amgad Steen says:

    The first tutorial was working on my board good but now after I flash current tutorial and it works fine , then try to go back to first one but is not working.
    The first tutorial now is keep restating, and I notice that when I remove this line ” read_face_id_from_flash(&id_list);”
    it works, I think there is something with the partition it can not read from it.
    Is there is any way to delete every thing on board and return to factory settings ??

    1. WordBot says:

      I think you can do this by flashing another Sketch but choose the full partition to wipe the partitions and then go back to the first tutorial.

  28. qaiss says:

    hi, Stunning work, there is a small problem if I disconnect it from electricity need to re-insert (no image saves), how can I save the pictures to SD card ?? Thanks

    1. WordBot says:

      Hi, It doesn’t save images at the moment, it just saves a ‘map’ of the faces. These should be stored permanently. Did you set up the new partition?

  29. BehMadi says:

    Hi,
    Great project and works very nicely, Thank you.
    I am trying to access the gate and video from anywhere. any idea without having to use another computer. direct connection to the http site.
    I also noticed the camera freezes and have to restart ??

    1. WordBot says:

      Hi. You can probably run the ESP32 as an access point to access it directly or alternatively use port forwarding on your router so you can access the project from outside your house. I need to do some more on this project but don’t have much time at the moment.

  30. Emerson Soares says:

    Hi. I’m trying to do this project too, but after flash the Sketch, I will access the ESP32 IP in browser, the message below appears.
    The camerawebserver works perfectly.

    basic_string::_M_construct null not valid258EAFA5-E914-47DA-95CA-C5AB0DC85B110123456789abcdefABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/upgradeWebsocketconnectionSec-WebSocket-AcceptGET HTTP/1.1 Host: Sec-WebSocket-Key: UpgradeConnectionUpgrade: websocket Sec-WebSocket-VersionConnection: Upgrade User-AgentSec-WebSocket-Version: 13 OriginUser-Agent: TinyWebsockets Client Origin: https://github.com/gilmaimon/TinyWebsockets HTTP/1.1 101httpws://wswss://wsshttps://https8F @xF @H�@�; @�C @�; @P�@���������������U @V @websocket13Sec-WebSocket-KeyHTTP/1.1 101 Switching Protocols Sec-WebSocket-Accept: W @
    intr_handle)/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/task_wdt.cesp_intr_free(twdt_config->intr_handle)esp_register_freertos_idle_hook_for_cpu(idle_hook_cb, i)esp_task_wdt_addesp_task_wdt_initcal_versioncal_macphy_initE (%d) %s: %s: calibration data MAC check failed: expected %

    1. WordBot says:

      Hi, I have no idea! Something wrong with the websocket but I don’t know if it’s the library, the browser or something in the Wi-Fi connection.

  31. ichsan devandra says:

    Hi ! i tried the camerawebserver example and it works perfectly, but when i tried the door lock User Interface, particularly the STREAM CAMERA, it shows nothing, when i look up into the serial monitor, it says C⸮[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 0 – WIFI_READY, the ” ⸮ ” made me wondering about the websocket being not working, can you please give me some advice sir???

    1. WordBot says:

      Hi, The only thing I can suggest is putting in a load of Serial.println(“something here”) statements in to see how far the code gets. You can also try one in the loop to see if something is happening in the loop.

  32. uber says:

    I am getting a strange error while compiling. It says “In function ‘esp_err_t delete_all_faces(websockets::WebsocketsClient&)’:

    FaceDoorEntryESP32Cam:227: error: no return statement in function returning non-void [-Werror=return-type]

    I guess its expecting a return but im not sure what data type “esp_err_t ” is. using Arduinowebsocket s 0.4.18. How can I fix this?

    1. WordBot says:

      The function should look like this:
      static esp_err_t delete_all_faces(WebsocketsClient &client)
      {
      delete_face_all_in_flash_with_name(&st_face_list);
      client.send("delete_faces");
      }

      It looks different in the error message.

  33. Syed Aiman says:

    hai im like the project and i stuck on error compiling for board esp32 wrover module…can you help me

    1. WordBot says:

      What error message do you see?

  34. Syed Aiman says:

    ‘struct mtmn_congig_t’ has no member named ‘type’

    1. WordBot says:

      Do you know which version of the ESP32 Hardware Library you have installed?

  35. Nathan Nehemiah says:

    Arduino: 1.8.13 (Windows 10), Board: “ESP32 Wrover Module, Face Recognition (2621440 bytes), QIO, 80MHz, 921600, Verbose”

    C:\Users\natha\Documents\Arduino\esp32cam-access-control-master\FaceDoorEntryESP32Cam\FaceDoorEntryESP32Cam.ino: In function ‘mtmn_config_t app_mtmn_config()’:

    FaceDoorEntryESP32Cam:52:15: error: ‘struct mtmn_config_t’ has no member named ‘type’

    mtmn_config.type = FAST;

    ^

    FaceDoorEntryESP32Cam:52:22: error: ‘FAST’ was not declared in this scope

    mtmn_config.type = FAST;

    ^

    FaceDoorEntryESP32Cam:55:15: error: ‘struct mtmn_config_t’ has no member named ‘pyramid_times’

    mtmn_config.pyramid_times = 4;

    ^

    Multiple libraries were found for “WiFi.h”

    Used: C:\Users\natha\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2\libraries\WiFi

    Not used: e:\Program Files (x86)\Arduino\libraries\WiFi

    exit status 1

    ‘struct mtmn_config_t’ has no member named ‘type’

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

    can you help me sir

    1. WordBot says:

      You need to update the ESP32 Hardware library as seen here: https://robotzero.one/esp32-cam-arduino-ide/

  36. Elzershark says:

    Unfortunately, http://your-ip-address: 81/stream does not work. It is not integrated.
    Can you easily add that?

    1. WordBot says:

      your-ip-address is for the camerawebserver example it won’t work on this tutorial because it uses websockets.

  37. imad uddin says:

    Sir how can i delete the old code from esp 32

    1. WordBot says:

      You don’t need to delete old code normally. When you upload (flash) the device it writes over everything.

  38. Saharsh says:

    Good tutorial and great work!
    I’m facing an issue on this project…Everything was running perfect until the last couple of days i was no longer able to stream from the esp-32 cam, as a result it couldn’t detect or recognize faces anymore. I updated the boards and libraries, i even tried it from different computer and browser but still the same. I still can browse into the web UI but it won’t stream any image from the left window. I tested my esp32-cam board on other projects and it’s fully functional. So, any thoughts what’s causing this issue? Thanks!

    1. WordBot says:

      Somebody else mentioned this happening. Did you change anything or add new faces before it stopped working? Do you see anything in the serial monitor or the browser console (F12)?

  39. imad uddin says:

    Hello sir iam facing a problem camera init failed with eror 0x30 after uploading code ..
    This eror is givng at serial maniter

    1. WordBot says:

      Possibly the wrong camera has been set. Which tutorial are you following?

  40. imad uddin says:

    I got this eror on ist day but after that it was solved now again i got this eror but this time iam unable to gitrid of this
    Iam waiting for ur rply

    1. WordBot says:

      Maybe it’s broken. If you are new to this I would recommend starting with more basic tutorials and maybe use a different board. The ESP32-CAMs are tricky to work with.

  41. imad uddin says:

    Code is uploading but camera didnt give ip adress ….If this is broken ….Why code is uploading

    1. WordBot says:

      Maybe the camera itself is broken but the board is OK. The only thing you can do is keep testing things until you find the problem or buy another and see if that works.

  42. imad uddin says:

    Hello sir i have change the module ….Now code is uploading …Ip adress giving
    But when i connect the board in circut and give aupply …….They does not connect to wifi

    1. WordBot says:

      Hi, Are you connecting the relay or trying with just the board? Try Tools > Core Debug Mode > Verbose to possibly see more details in the serial monitor.

  43. imad uddin says:

    Iam trying with board …..In whih i have connect all the elements

  44. Fulvio says:

    Hi, wben the code runs, on serial monitor appair repetitive reset list. I use 1.0.4 esp32. What problem can it be? Thanks.

    1. WordBot says:

      Hi, Is the ESP32 continually reseting? Does the CameraWebServer example work for you?

  45. Fulvio says:

    Hi, thanks for your reply, yes, ESP32 continually reseting. The CameraWebServer example work for me and also ESP32-CAM Face Recognition for Home Automation. I I just changed the original pertition scheme substituting 0x290000 instead of 0x280000 because I received a compilation error “sketch too big.”.

    1. WordBot says:

      It’s probably crashing but the partitions aren’t correct. It should all work with the new partitions in the tutorial. Maybe it wasn’t selected when you flashed the device and then you saw the error.

      1. Fulvio says:

        Hi, after modifying the csv file, I have the following compilation error:
        “C:\\Personal\\programmi-vari\\arduino-1.8.9-Portatile\\arduino-1.8.9\\hardware\\espressif\\esp32/tools/gen_esp32part.exe” -q “C:\\DOCUME~1\\fulvio\\IMPOST~1\\Temp\\arduino_build_640125/partitions.csv” “C:\\DOCUME~1\\fulvio\\IMPOST~1\\Temp\\arduino_build_640125/sketch_face_vers_2.ino.partitions.bin”
        Error at line 2: CSV flag column contains unknown flag ‘;;;’ This is a strange error! in the csv file there are no “;” but only “,”.

        I suspect there is a compatibility problem of my XP OS with the modified csv file. Beacause in the tutorial “Create a partition” it is not explained how to create the csv file, but it is shown only in notepad++, can you send me an original csv file by changing app0 from 0x280000 to 0x290000 (or higher)? Thanks.

        1. WordBot says:

          You shouldn’t need to change the numbers. Here’s the csv file I used – https://robotzero.one/wp-content/uploads/2019/04/rzo_partitions.csv. There’s more info about this here – https://robotzero.one/arduino-ide-partitions/ But… take a look at this: https://github.com/francis94c/ESP32Partitions it might be easier for you.

          1. Fulvio says:

            Hi, so, the problem was when I saved the changes of the csv file, excell insert “;;;” at the end of each flags field. I solved this problem by editing this csv file with notepad ++:
            # Name, Type, SubType, Offset, Size, Flags,
            nvs, data, nvs, 0x9000, 0x5000,
            otadata, data, ota, 0xe000, 0x2000,
            app0, app, ota_0, 0x10000, 0x290000,
            fr, 32, 32, 0x300000, 0xEF000,
            eeprom, data, 0x99, 0x3ef000, 0x1000,
            spiffs, data, spiffs, 0x3f0000, 0x2F000,

            As you can see, I changed the size of app0 and consequently some offsets. Unfortunately, starting the code, from the serial montor I see that the reset occurs continuously, as it happened before. The compilation and upload were successful so I don’t know what else to do. Do you have any other suggestions before leaving this tutorial? I’ll still offer you a cup of coffee because I’m sure it’s a great program that cost you and still costs you a lot of effort. Thanks.

            1. WordBot says:

              Are you sure you need to change the sizes? Are you changing something from the tutorial?

  46. Fulvio says:

    It gave me compilation error for “sketch too big”, so I increased the size of app0 from 280000 to 290000 and fixed the offsets, in fact then it went well compiling and uploading. Unfortunately when I start the code the card resets continuously. I think there is a problem with the csv file, but I don’t know which one.

    1. WordBot says:

      I think you saw the too big error because you hadn’t selected the new partition or not set up the partition part correctly. The CSV partition sizes should work with the tutorial.

      1. Fulvio says:

        Hi, I ran the following steps from scratch: Camera Web Server example with Huge APP partition works fine;
        Camera Web Server Permanent with the new partition csv file does not work, it does continuous autoreset;
        Camera Web Server Permanent with the original csv file you sent me does not work, it does continuous autoreset.
        I think the flash memory is corrupt, is it possible to restore all original partitions? Thanks.

  47. sơn says:

    I use esp32 CAM but after completing the above steps and loading the code, it does not recognize the face, it just says: Get one frame in 0 ms.
    02: 44: 26.152 -> No Match Found
    02: 44: 26.152 -> Get one frame in 0 ms.
    02: 44: 26.396 -> dl_matrix3dqq_fc_with_bias, value> DL_QTP_MAX
    02: 44: 26.396 -> dl_matrix3dqq_fc_with_bias, value <DL_QTP_MIN
    . The worst thing is when declaring the pin connected to the relay pin, it cannot receive the signal from that pin. Can you give me advice. thank you

    1. WordBot says:

      I think it’s because it has trouble detecting your face. Try with more light or moving further from the camera. Does the CameraWebServer example work for you?

  48. Sơn says:

    dl_matrix3dqq_fc_with_bias, value> DL_QTP_MAX
    02: 44: 26.396 -> dl_matrix3dqq_fc_with_bias, value <DL_QTP_MIN
    Nó thông báo như thế này nghĩa là sao vậy.cảm ỏn

  49. Fulvio says:

    Hi, all the malfunctions were caused by the windows XP os. When I used Windows 7 it worked fine so I could verify that you did a great job !!! I’ll offer you a coffee. I take this opportunity to ask you, have you already made a tutorial on a video door phone?

    1. WordBot says:

      Hi, I don’t know why XP would affect it. Maybe the USB driver. I know how to make the video door phone but one or two other things to do first. Thanks for the coffee!

  50. Heng says:

    hi sir, thanks for this project because it really helps me a lot. After I read the comment in these blogs, there have two problems which I faced also with the other people. The first problem is when start to access the webpage, the camera is not streaming and second problem that I faced is the flash memory of your code is exceed the partition that you created. In the end I found the problem. For first problem, I suspect that the problem happened in the arduino websockets and the network connection because in first few times, it can be accessed but not after several times of uploading the codes to the board. So, my solution is to reset your network in your pc or laptop. The solution for second problem is do not update your esp 32 to the latest version (1.5) because I suspect that the latest version may adding some new feature which the memory is exceed your partitions. So, 1.4 is fine for me to function the code. Sorry for my broken english and thanks again for the program that you created.

    1. WordBot says:

      Hi, Thanks for letting me know the problems you encountered. The Websockets works really well but if the Wi-Fi isn’t perfect and the connection drops the Websocket closes and that’s it. I need to do something to handle this.

      For the partitions, I’m not sure why it doesn’t work the same way but now there is a much easier method where you just put the partitions.csv file in the same folder as the sketch. I’ve created a different partition file and tested it and it all seems OK. The tutorials have been updated and I’ve added the new partition.csv to Github.

      1. Heng says:

        Thank you so much for the replied , I will try your solution which is putting csv file together with the sketch later.

      2. Heng says:

        Sir, I encountered with the problem of camera is not streaming on the webpage again. May I know why this problem occurs sometimes but not in other times?? Is it because of the websocket ? Because I am pretty sure the cam work in webserver example and my wifi connection is stable,

  51. Heng says:

    Sir, may i know how to store face data and the name to database( google sheet or excel online) instead of storing it in the board? thank you!

  52. Heng says:

    Sir, i am using your new partition.csv to run the project, but i still facing the same problem again. At the first few times, the project can work well but after i try delete all photo memory in the browser there, the camera will not stream on the left side of the webpage when i reuploading and rerun the program again.

  53. Heng says:

    Hello sir, sorry for interrupting again. May I know how the enrolled face data and its face id name is sent from a master esp32 cam to another esp32 cam so that the second esp32 cam can receive the face data and the user is not required to enroll his face again but the camera is able to recognize the user face and his name? I am trying on ESP NOW however it is unable to send. Thank you.

    1. WordBot says:

      Hi, I don’t really know how to access the face id data to move it elsewhere. Subject for another tutorial at some point.

  54. Keith says:

    Hi two questions please
    I would like to change the UI and add bootstrap and other additional css libraries to the UI how would I do this.
    On your GitHub i can see both HTML_interface.html, camera_index.h. what file would I alter out of these two to do this as in the video you said the camera_index.h is what the UI is in but the HTML code is in the .HTML file.
    Second question what part of the javascript should i alter so that when the face ID is stored i can capture this face ID in plain text and push it to a database to store additional information about a user
    Thanks in advance

    1. WordBot says:

      Hi, this is going to be tricky but if you check this tutorial https://robotzero.one/esp32-cam-custom-html/ it shows how to create the camera_index.h file from HTML. The problem is bootstrap is a pretty big library so pasting that over the current CSS in the HTML is going to make a huge file. You might be able to paste the compressed CSS to make things more manageable or if you can just paste the parts you need. Alternatively look at this tutorial https://robotzero.one/esp32-mpu9250-three-js/ for a way to use Webpack or Parcel to create one file and load that. This uses a different webserver though.

      The face ID is stored on the ESP32. Only the name saved for the ID is transferred to the browser. If you want to save the name and add some other data it looks like you need to change the ws.onmessage method to look for the text that is sent from here
      char recognised_message[64];
      sprintf(recognised_message, "DOOR OPEN FOR %s", f->id_name);
      open_door(client);
      client.send(recognised_message);

      Maybe do substring or something on the ‘DOOR OPEN FOR ‘ text to get the name.
      I’m quite busy at the moment but hopefully this points you in the right direction.

  55. Favs says:

    Hello, thank you so much for this tutorial, my only issue is every face is being recognized

    1. WordBot says:

      Hi, Probably an old version of the ESP32 Hardware library. 1.0.4 should work.

  56. Efti says:

    Hi there having a problem in compiling .
    Showing error:
    Sketch too big; see https://support.arduino.cc/hc/en-us/articles/360013825179 for tips on reducing it.
    Error compiling for board ESP32 Wrover Module.
    How to solve it sir?

    1. WordBot says:

      Hi. You need to choose Huge App Partition Scheme – https://robotzero.one/arduino-ide-partitions/

      1. Efti says:

        So sir in Tools section i will select :
        Board: “ESP32 Wrover Module”
        Upload Speed: “921600”
        Flash Frequency: “80MHz”
        Partition Scheme “Huge APP (3MB No OTA/1MB SPIFFS)”
        Core Debug Level “Verbose”
        Is it all Ok sir?

        1. WordBot says:

          Looks good to me.

  57. Efti says:

    Hello Sir Esp32 is working i need a help my relay module is JOC-3FF-S-Z
    can you tell me which should i connect with solinoid lock and which i will to the battery

    1. WordBot says:

      Hi, Pins can seen in this tutorial – https://robotzero.one/esp32-face-door-entry/ but if you have a 5v relay I don’t think it will work. You could make a transistor switch to control the 5v pin connected to the relay. I don’t know how to do this but there must be loads of tutorials. Just be careful not destroy the ESP32! Here’s a great video about relays – https://www.youtube.com/watch?v=d9evR-K6FAY

      1. Efti says:

        Ok Sir
        And Sir if i connect with a 5v source with relay module and connect the GND and IO2 pin from esp32 will it work.
        like
        Esp32 Relay Module 5v
        5v 5v
        GND GND
        IO2 IN

        will it work?

        1. WordBot says:

          Can you measure the voltage on the io2 pin. I think it’s only 3.3v. Easiest solution is to buy one of these: https://es.aliexpress.com/item/32839197645.html You could also try this one: https://es.aliexpress.com/item/1005001567474787.html but the LEDS might take too much current and prevent the relay opening.

  58. Met Aloys says:

    Hello I’m getting this error when I browse this ip address http://172.20.10.3/

    258EAFA5-E914-47DA-95CA-C5AB0DC85B110123456789abcdefABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/upgradeWebsocketconnectionSec-WebSocket-AcceptGET HTTP/1.1 Host: Sec-WebSocket-Key: UpgradeConnectionUpgrade: websocket Sec-WebSocket-VersionConnection: Upgrade User-AgentSec-WebSocket-Version: 13 OriginUser-Agent: TinyWebsockets Client Origin: https://github.com/gilmaimon/TinyWebsockets HTTP/1.1 101httpws://wswss://wsshttps://https@; @�; @�D@�0 @�8 @�0 @�D@���������������J @�J @websocket13Sec-WebSocket-KeyHTTP/1.1 101 Switching Protocols Sec-WebSocket-Accept: �K @�K @$F@�K @,F@�K @

    How to solve this error

    1. WordBot says:

      Hi,

      Where are you seeing that error? Which browser do you use?

    2. Steve says:

      I’m getting the same issue, plus more.
      Noting there is no video stream, however it does seem like facial recognition works after a face is enrolled.

      After the closing tag the browser (Chrome Version 106.0.5249.119 (Official Build) (64-bit)) is receiving the following.
      Nice tutorial BTW

      258EAFA5-E914-47DA-95CA-C5AB0DC85B110123456789abcdefABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/upgradeWebsocketconnectionSec-WebSocket-AcceptGET HTTP/1.1
      Host: Sec-WebSocket-Key: UpgradeConnectionUpgrade: websocket
      Sec-WebSocket-VersionConnection: Upgrade
      User-AgentSec-WebSocket-Version: 13
      OriginUser-Agent: TinyWebsockets Client
      Origin: https://github.com/gilmaimon/TinyWebsockets
      HTTP/1.1 101httpws://wswss://wsshttps://httpsH>
      @�>
      @�Q@�3
      @�;
      @�3
      @�Q@���������������M
      @�M
      @websocket13Sec-WebSocket-KeyHTTP/1.1 101 Switching Protocols
      Sec-WebSocket-Accept: �N
      @�N
      @<S@�N
      @DS@�N
      @TS@C:\Users\dummy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.5\libraries\WiFi\src\WiFiClient.cpp[E][%s:%u] %s(): Not enough memory to allocate buffer
      [E][%s:%u] %s(): %X : %d
      [E][%s:%u] %s(): fail on fd %d, errno: %d, "%s"
      [D][%s:%u] %s(): Disconnected: RES: %d, ERR: %d
      [I][%s:%u] %s(): Unexpected: RES: %d, ERR: %d
      [E][%s:%u] %s(): socket: %d
      [E][%s:%u] %s(): select on fd %d, errno: %d, "%s"
      [I][%s:%u] %s(): select returned due to timeout %d ms for fd %d
      [E][%s:%u] %s(): getsockopt on fd %d, errno: %d, "%s"
      [E][%s:%u] %s(): socket error on fd %d, errno: %d, "%s"
      [E][%s:%u] %s(): connect on fd %d, errno: %d, "%s"
      connectedflushavailablepeekfillBufferreadwritesetOptionsetSocketOptionconnectc
      @8c
      @�S@�^
      @4Q@�_
      @�S@Xb
      @T`
      @��
      @<Q@؉
      @�[
      @�S@�a
      @�b
      @�`
      @xS@$d
      @�[
      @|^
      @�S@�[
      @8\
      @�[
      @T@�S@�[
      @\
      @�[
      @T@C:\Users\dummy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.5\libraries\WiFi\src\WiFiGeneric.cpp[W][%s:%u] %s(): Network Event Queue Send Failed!
      [E][%s:%u] %s(): Network Event Group Create Failed!
      [E][%s:%u] %s(): Network Event Queue Create Failed!
      network_event[E][%s:%u] %s(): Network Event Task Start Failed!
      [W][%s:%u] %s(): WiFi not started
      [W][%s:%u] %s(): STA has not been started
      [W][%s:%u] %s(): Neither AP or STA has been started
      [E][%s:%u] %s(): DNS Failed for %s
      [D][%s:%u] %s(): Event: %d – %s
      [W][%s:%u] %s(): Reason: %u – %s
      [D][%s:%u] %s(): STA IP: %u.%u.%u.%u, MASK: %u.%

      1. WordBot says:

        I can see this in the error message ‘WiFiClient.cpp[E][%s:%u] %s(): Not enough memory to allocate buffer’

        Does the CameraWebServer example work as in this tutorial? https://robotzero.one/esp32-cam-arduino-ide/

  59. Claudio Mendez says:

    Hello, thank you very much for the tutorial. It’s very clear.
    I have a problem. I can’t see the image and when entering the http: // myip: 81 / stream it doesn’t let me see the image either

    1. WordBot says:

      Do you see anything in the serial monitor?

      1. Claudio Mendez says:

        Sorry, this is

        ———————————————————————————————

        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
        E (97) psram: PSRAM ID read error: 0xffffffff

        …..
        WiFi connected
        httpd_start
        E (3063) fr_flash: No ID Infomation
        Camera Ready! Use ‘http://192.168.137.40’ to connect

        1. WordBot says:

          I’ve seen the PSRAM ID read error in other comments but I have no idea where it’s coming from. Maybe the IDE or the ESP32 hardware libraries are new? The fr_flash message can be ignored.

  60. Mikiyas Ayele says:

    Hello, Great post.
    How can I edit the code so that I can display a box around people’s faces when they are getting detected.
    Thanks in advance

    1. WordBot says:

      Hi. In this project https://github.com/robotzero1/face-follow-robot there are two versions, one with the boxes and one without. Maybe you can see how to add it to the face recognition project from this? Or reference the original CameraWebServer example. It will slow down the detection though.

  61. Souhail says:

    Hello I need to change locker white servo motor how can I do it

    1. WordBot says:

      Hi, Check this tutorial for servo motor control. You can probably combine the two: https://robotzero.one/pan-and-tilt-control-for-an-esp32-cam/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

scroll to top