Ai-Thinker ESP32-CAM in the Arduino IDE


Setting up the ESP32-CAM with the Arduino IDE and Camera Web Server example.

The ESP32-CAM module features an ESP32-S chip, an OV2640 camera and a microSD card slot. There are other ESP32 based camera modules available that should work if the pins are set in the sketch.

Adding or Updating the ESP32 Range in the Arduino IDE

If you’ve never used an ESP32 board in the Arduino IDE you need to follow the first part of this tutorial: ESP32 Built-in OLED Heltec WiFi Kit 32
If you already have the ESP32 boards available in your IDE then you just need to update to the latest version of the board libraries. To do this, open the Arduino IDE and in the menu: Tools > Board:xxxxx > Boards Manager:

Boards Manager

Search for ESP32:

Boards Manager ESP32

Use the 1.0.4 or 1.0.5 versions. The face recognition code has been updated in the most recent versions (2.x.x) and no-longer works on ESP32 and ESP32-S2 based boards like this.


The ESP32-CAM doesn’t come with a USB connector so you need either a CP2102 or a FT232RL USB to TTL Serial Converter to connect it to your PC. When using WiFi the ESP32 can use more current than is supplied via USB through these devices resulting in the module crashing and rebooting. I found the top device worked fine but the FT232RL didn’t work for me. If you use a FT232 with 5v and 3.3v, set the voltage jumper to 3.3v. You might be able to use the 5V from the side of the board to power the 5v pin on the camera.

USB to ESP32-CAM Wiring Diagram

Wire the module according to the diagram above. The green connection should be connected when flashing the module and disconnected when running.

There are now also power boards like the one below that make the connection much easier for uploading and reading the serial output.

Usb Connector

Running the Camera Web Server Example

Plug in your module and change the board settings to these:

IDE Camera Settings

Open the Sketch by navigating  File > Examples > ESP32 > Camera > CameraWebServer:

Camera Web Server Sketch

Edit the Sketch defines to look like this (assuming you are using the Ai-Thinker module):

// Select camera model

Change the following two lines to match your WiFi connection details:

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

Click Upload to build and flash the Sketch to your device.

If you get an error that the device fails to connect. Check that the IO0 pin (green in the diagram) is connected to GND and press the reset button under the module and try again.

When the device has completed flashing, unplug IO0 from GND.

Open the serial monitor via Tools > Serial Monitor.

Press the reset button on the ESP32-CAM and watch the start up sequence in the serial monitor:

Camera Web Server Startup

Look for the IP address that the ESP32 has been given on your network.

Type that IP address into your browser. You should be able to see a GUI on the left where you can control elements of the camera, set face detection and face recognition. Click Get Still to take a photo. Click Start Stream to see a video stream from the camera.


On-Board vs IPEX Antenna

A few people have commented that they have received the board with the antenna jumper set for an external antenna rather than the on-board antenna. You can see the two different settings below:

Antenna Jumper Settings on the ESP32-CAM

If you have a low frame rate or poor reception this might well be the problem. You can either move the jumper with a bit of very careful soldering or buy an IPEX WiFi antenna which will improve the signal.

ESP32-CAM Video Playlist

IF you prefer your tutorials in video format you can visit the Robot Zero One YouTube channel and view the ESP32-CAM playlist here:


Here’s a list of resources that I used to get this working: – Arduino Camera Web Server example – Homepage for the face recognition library

190 Replies to “Ai-Thinker ESP32-CAM in the Arduino IDE”

  1. Chris Lidyard says:

    Thanks for the article. Sorted me out and have donated. Keep posting, I’m interested in your adventures with the MAIX board.

    1. WordBot says:

      That’s great thanks! The MAIX is very interesting but they have a way to go to get to where the Espressif boards are with libraries etc.

  2. who_took_my_nick says:

    Brownout detector was triggered

    ets Jun 8 2016 00:22:57

    rst:0xc (SW_CPU_RESET),boot:0x1b (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    mode:DIO, clock div:1
    entry 0x400806a4

    It is power issue, as i can see from the forums. I power it as you suggested. From the same TTL adapter i use 5V and GND and connect it to 5V and GND on the ESP32 cam board. ESP module is little bit hot. Not sure is it ok. Any idea?

    1. WordBot says:

      I found that with the FT232RL connected with a USB cable that when the wifi started up it would crash with the brown out error. The other connector I plugged straight into my PC (no cable) and this was fine. It could be your adaptor or the USB cable that can’t carry the current needed. You can connect your own supply of 5v to the board (without the 5v and ground of the connector being connected) to see if that works.

      1. Richard D Marbury says:

        i got this device to work by connecting a 1000 ufd capacitor across 5v and gnd pins to reduce brownout errors

  3. _rp_ says:

    Thanks for this…

    Any ideas on how to activate the flash light?


    1. WordBot says:

      Not yet. I’ll write a note if I find out.

      1. Piebe says:

        GPIO4 is the Flash

        1. _rp_ says:

          That thing is bright…

  4. victor says:

    Do you have an example of how to save a photo to the card?

    1. WordBot says:

      Here’s a start – but this is for the Espressif IDF. I’ve not tried it myself.

    2. WordBot says:

      This tutorial has a section for saving photos to the microSD card –

  5. Richard Luckman says:

    Just in case anyone has the same problem that I had whereby the module worked fine plugged directly into the PC but as soon as I moved it to photograph the bird table just outside the window I lost connection. On my module the jumper next to the IPEX connector was set to use the IPEX connector and not the circuit board antenna. Pictures I have seen on the web show it jumpered the other way. As it happened my eventual plan was to use it with an external antenna so it saved me having to alter the jumper

    1. Tony Yeung says:

      Can you provide details of how the jumper is supposed to be configured? I can’t find the information of how to set it to IPEX versus PCB antenna.

  6. Ian Muir says:

    After booting and watching the serial monitor mine just shows dots going across the screen and nothing else.
    I am running off a seperate 5v power supply.
    any Ideas?

    1. WordBot says:

      The dots are shown while it’s trying to connect to the your wifi network. Double check your wifi settings and maybe move closer to the router.

      Also – see this comment:

      1. Ian Muir says:

        It now connects and I can log on to it with a web browser.
        There is no camera picture, the controls show but the camera picture is just black.

        1. WordBot says:

          Press f12 in the browser to open the console. Go to the network tab and then click Get Still or Start Stream on the controls do you see an error in the network tab?

          1. Ian Muir says:

            No errors, it just records a black screen. Tried 2 units both with the same results.

            1. WordBot says:

              I have another tutorial to finish this week that uses the camera in a different way. We can see if it works with this.

        2. DDTech says:

          Ian, WordBot,
          I did have the same problem with one of my modules. The module seemed to work, but was showing just an empty black frame with the red cross in the upper right corner.
          After some investigation with a magnifier glass, I found that Pins GND, GPIO23 and GPIO22 of the WROOM module (the pins close to the antenna connector) did have no solder or better said, not enough solder to bridge a connection. After resoldering these three, the module worked.

          Hope this is of help to anyone.



  7. Leszek Niedziela says:

    Thank you for the detailed explanation! Have a coffee! 🙂

    1. WordBot says:

      Appreciated! Thanks.

  8. Clavier pierre says:

    Merci pour ce tuto il fonctionne parfaitement. J’ai passé des jours à fouiller internet sans jamais réussir à faire fonctionner esp32cam encore un grand merci. Serait-il possible de connecter le module directement sur un écran tft lcd?

    1. WordBot says:

      It’s going to be difficult to connect a screen to the Ai-thinker board because nearly all the pins are used by the camera or SD-card reader (scroll down).

    2. Clavier pierre says:

      Re bonjour je viens de trouver et tester ce projet intéressant :G6EJD :ESP32-and-how-to-use-ili9341-TFT-Display. (sur Github) quand pensez-vous ?peut-être que comme ça l’image de la caméra pourrais apparaître sur l’écran ?

  9. Mike says:

    Thank you very much for this, three ESP32-Cams are now working smooth within my HomeAssistant / MotionEye – wonderful 😉
    After each reconnect of the ESP32-Cam to power, i have to press this little reset button once, for connecting to the WLAN – is there a pin layout to solder a bigger button to the Cam?
    So again, thank you very much for this!!!

    1. WordBot says:

      I just tried with mine and reconnecting power (at least via USB) causes it to reconnect to the WiFi.

  10. day tripper says:

    Thanks very much for this publication, I received a pair of the esp32-cam modules yesterday and had them both running by this afternoon.

    The one question I have is if anyone has integrated control of the hella bright LED into this kit? It doesn’t appear to be “wired” into the code (though I did notice it tends to have a weak glow).

    fwiw, I strongly recommend fitting some kind of heat sink to the SOC shield (and hope there’s some thermal compound under it) as it runs pretty toasty while streaming.


  11. Michael Zwicky-Ross says:

    Great tutorial. Except… I have the same problem as Ian Muir in that the ESP never connects to WiFi. I’ve checked and double checked the credentials and I’ve also flashed another sketch that I know works because I have it running on a basic ESP32. And the router is only 6 feet away. Any other ideas very welcome! Thank you

    1. WordBot says:

      Can you see how the tiny connector next the aerial socket is soldered?

      1. joe mckee says:

        Most of them come IPEX enabled , i have 10 and they are all the same – small jumper needs to be removed and soldered to internal aerial or an IPEX 2.4ghz aerial fitted

  12. Faiz Alfaizin says:

    can you help me with the problem “A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header”

    1. WordBot says:

      Is IO0 connected to GND? Try pressing the reset button and uploading the Sketch again.

  13. Faiz Alfaizin says:

    Can you help me.
    I have successfully uploaded a sketch and can switch to the web server. but the video played has a delay. when I put IO4 in my hand, the flash light went on and the video went smoothly without delay, could it be possible that the cable I used was wrong or was there a way for the video to run optimally without touching IO4?
    thank you

    1. WordBot says:

      Do you mean the frame-rate of the video is low? It’s possible the LED is making the scene brighter so the camera quality is improved. Try using a bright light on your subject.

      1. Faiz Alfaizin says:

        in the serial monitor “MJPG: 5173B 76ms (13.2fps), AVG: 101ms (9.9fps), 0+0+0+0=0 0”

        if i touch the IO4 pin “5173B 76ms (13.2fps)” change to be faster and read serial monitor

        does the IO4 pin affect fps?

        1. WordBot says:

          I don’t see how it could affect the fps

        2. Jim says:

          I also found that the framerate improved from around 2fps to 13fps (!) when I put my hand near the board. I then realised that (as others have found) the onboard antenna was not connected. Jumpering the onboard antenna cured the problem, and I now get a consistent good framerate 🙂

          1. WordBot says:

            Ah! Thanks for the comment. I didn’t imagine that this could be the problem!

            I looked at the cameras I have and found one was jumpered for the IPEX connector so I’ve added a bit explaining this to the tutorial.

    2. Jan says:

      Hmmm… this sounds familiar. In my setup I have the IO0 signal connected through a few cm long wire to a button going to ground. Framerate is horrible, then I read this post, noticed that when I touched all the headers with my fingers, framerate increased. So I searched for what this could be and noticed that the IO0 line isn’t for the bootloader only. Adding some extra pullups to IOo didn’t help either. Pushing the button during streaming stops it all. So I figured that the quickest way to solve this was to remove the wire to my button. Then everything worked beautifully.
      So to make a long short short, don’t have anything connected to IO0 during runtime (of the example as shown here)! According to my multimeter which doesn’t measure 0 or 3.3V it measures something in between. I wouldn’t be surprised if this is a high frequency signal (clocksignal) of some kind, that may not be disturbed by adding any kind of load. A simple wire can add like a capacitance. The funny thing is, that I cannot find a decent schematic or some document explaining what IO0 is and does during runtime.

      1. WordBot says:

        Interesting. I’ll have to try with and without wire attached.

        Schematic here: I guess you saw the pins diagram:

        If only Ai-Thinker had added a few more pins, made it dual core and fixed the reset so it didn’t need the manual reset each time it would have been a great product.

  14. Minde says:

    Thanks a lot for a great tutorial, works like a charm. However I would like to change Camera Web Server ports (originally 80 and 81) and I am unable to find how to do it… Could You help?

    1. WordBot says:

      You can change the port number in the Arduino code in the function startCameraServer but you also have to change it in the HTML that the ESP32 is serving (here: j.src = `${c+’:81′}/stream`). This HTML is found in the camera_index.h file in the index_html_gz variable. This is the page source GZIP’d and converted to HEX. I have a tutorial in the works for this.

      UPDATE: Tutorial here:

      1. Andre says:

        Thank you for this thoughtful information.
        I managed to make the HTML GZIP transformation work but I can not get it working (here: j.src = `$ {c + ‘: 81’} / stream`), I have to put the code wrong .
        my new port is: 6060, the still image is playing correctly but not the video the result is still (my address; 6060; 70
        Thank you in advance for your reply.
        Automatic translation english french
        A G

        1. WordBot says:

          Hi, Did you change the line
          config.server_port += 1;

          in app_httpd.cpp to show the new port? Something like

          config.server_port 6060;

          You should then be able to see the video at http://your-ip-address:6060/stream. If that works then the j.src should work with the 81 replaced by your 6060

          1. andre says:

            Thank you for your quick reply
            I have
            config.server_port 6060;

            I get on the serial port
            WiFi connected
            Starting the web server on the port: ‘6060’
            Start the feed server on the port: ‘6061’
            Camera Prete! Address ‘http: //’ Log in
            by inspecting the image (tiny) I read
            http: // 6060 / http: / 6060: 81 / stream
            I have: 6060 but more: 81
            however, the still image is correct and has the correct address
            Again thank you for taking into account my request

            1. WordBot says:

              It’s this part you need to change:

              config.server_port += 1;
              config.ctrl_port += 1;
              Serial.printf(“Starting stream server on port: ‘%d’\n”, config.server_port);


              config.server_port = 6060;
              config.ctrl_port += 1;
              Serial.printf(“Starting stream server on port: ‘%d’\n”, config.server_port);

              Then test on

  15. Jacques says:

    Thanks for a great tutorial, but get the same problem as Ian Muir. There is no camera picture, just the close icon and the controls.
    Can anyone help?

    1. WordBot says:

      Do you see any errors in the serial monitor or in the browser console? I have three of these and one of them came with a broken camera where there also was no image.

      1. Jacques says:

        I am seeing a pending status on the stream and image capture commands when pressed. This is under the network tab.

        1. WordBot says:

          What can you see in the Serial Monitor (Tools > Serial Monitor). Any clues there?

        2. BAMS808 says:

          I also have the same issue, can capture image, and see it in the serial and browser console, however when trying to access stream nothing shows up. all other changes can be seen in the browser console , turning off and on face recognition. make me think something might be wrong in just the streaming part of code or hardware.

          1. WordBot says:

            Most likely the hardware. The first one I bought did the same.

  16. Faiz Alfaizin says:

    can you help me for esp32-cam web socket ?

  17. Faiz Alfaizin says:

    I mean, so that the esp32-cam ip can be accessed by the internet with a public network

    1. Jim says:

      You should first change the camera ports from 80 and 81 to something higher like eg 8802 8804 as explained in a previous comment above. Then you need to set a couple of port forward entries in your router. EG if your camera IP is then add a couple of forward entries – port 8802 > and port 8804 >

      Then from the internet you should be able to access your camera by going to
      Note that here is you external IP address and can be found by going to Note that this address may change each time your router is rebooted.

      1. Jim says:

        Oops!- part of my text went a bit strange. It should have said;

        Then from the internet you should be able to access your camera by going to
        http://'your public IP address’:8802
        Note that ‘your public IP address’ here is your external IP address and can be found by going to Note that this address may change each time your router is rebooted.

  18. Jan-Gerard says:

    _Trigger events (pin I/O) with face recognition without web-interface?_
    Great tutorial. It workded directly. Only I want to take it a step further.
    I am looking for examples or documentation of the face recognition API to trigger events (like switching I/O pins of the ESP32-CAM board). Especially without using the web-interface. I would like to only use the web interface to train the recognition, but then just power the ESP32, have it start face recognition automatically, and respond by switching a voltage on one of the IO pins.
    Is that possible? And where do I find which commands to use for that?

    1. WordBot says:

      I’ll try to work out something this week for setting a pin high when a face is detected.

      1. WordBot says:

        I’ve added a new tutorial that explains how to do this:

  19. Petrovjan says:

    Hi, I’d like to turn the web-server example into a standalone presence detector, that would send a message to IFTTT whenever it detect someone. So far I’ve managed to update the Arduino IDE example and add the IFTTT call, but I’m not able to make it run all the time, not just when someone is accessing the ESP-CAM’s website.
    Is there a simple way to change the code to make it run all the time? Thanks!

    1. WordBot says:

      I need to look at the example code and see if I can work out how to make the face detection work outside of the web-server example. Hopefully this week.

      1. WordBot says:

        I’ve worked it out and written another tutorial for face recognition. If you want face detection only it should be pretty simple to modify.

  20. O-Zone says:

    Thanks a lot for your post! However, on compiling i got an error because the sketch use 106% of available space. Any hint how to fix?

    1. WordBot says:

      Do you have the partition scheme set to ‘Huge APP’ in the tools menu?

  21. Henk says:

    Arduino say the sketch is to big for the ESP32 CAM module. 172%. What to do now?

    In Dutch:
    De schets gebruikt 2257451 bytes (172%) programma-opslagruimte. Maximum is 1310720 bytes.
    Globale variabelen gebruiken 51488 bytes (15%) van het dynamisch geheugen. Resteren 276192 bytes voor lokale variabelen. Maximum is 327680 bytes.

    1. WordBot says:

      You should change the partition scheme to like this:

  22. Francis says:

    Hey! Thanks for this tutorial.

    From my understanding the HTML GetStill button tells the camera to push a jpeg to the server.

    How can I do this directly from my loop on the Esp32 ? (Eg. Just call GetStill(); in code instead of clicking the button on the webapp.

    1. WordBot says:

      Hi, Did you want to take a picture at a certain interval or as a result of some other input? It’s probably better to rewrite the code so your interval or input testing is in the loop and this then calls a function that grabs an image from the camera. You could also modify the HTML side of things to call GetStill and then do something with the resulting jpg.

      1. Francis says:

        Thanks for your reply.

        I am quite familiar with C/C++ – Not so much with html / http requests. I will be able to handle the interval at which the code is executed etc.

        Currently when the GetStill button is clicked, the image in the webapp changes to the latest screen capture. This functionality suits me and I would like to be able to do that without clicking but rather from the ESP32’s void loop. Some sensor will eventually trigger this functionality rather than a button press.

        1. WordBot says:

          I’m working on a tutorial for this.. It should be published today.

          1. Francis says:

            Awesome! Will be buying you a few more coffee’s for that! Thank you for your time.

            1. WordBot says:

              It’s taking a bit longer than I thought. It’s nearly done except

              esp_http_client_handle_t client = esp_http_client_init(&config);

              from here:

              Crashes in the Arduino. I’ll look for another method to POST images.

              1. Francis says:

                No problem! Thank you so much, helping my little brother out with his arduino project. I am a C++ programmer by trade though, so maybe I can help find the source of the crash on my side; I’ll give that example code a try!

                I’m just suprised this isn’t just a series of already available functions we need to combine as the functionality seems to be there by default. In any case thanks again, more well deserved coffees for you!

                1. WordBot says:

                  If you want to look I set up a simple example – crashes at esp_http_client_init
                  Guru Meditation Error: Core 1 panic’ed (LoadProhibited). Exception was unhandled.

                  1. WordBot says:

                    Finally I have POST working in this example – They’ll be a version later where the image capture is triggered rather than timed.

  23. Kingtech says:

    Hi, I read all post but nobody seems to have a camera error. Maybe my camera is defective.
    Someone solved this kind of issues?

    1. WordBot says:

      IF you see a camera error in the serial monitor it could be defective. Have you tried removing it and replacing it? It could also be a power issue. What error message do you see?

      1. Kingtech says:

        Yes i try to removing and replacing it.
        Here the error message:
        12:49:38.464 -> ets Jun 8 2016 00:22:57
        12:49:38.464 ->
        12:49:38.464 -> rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
        12:49:38.464 -> configsip: 0, SPIWP:0xee
        12:49:38.464 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
        12:49:38.464 -> mode:DIO, clock div:1
        12:49:38.464 -> load:0x3fff0018,len:4
        12:49:38.464 -> load:0x3fff001c,len:1100
        12:49:38.464 -> load:0x40078000,len:10088
        12:49:38.464 -> load:0x40080400,len:6380
        12:49:38.464 -> entry 0x400806a4
        12:49:40.467 ->
        12:49:40.670 -> [E][camera.c:1085] esp_camera_init(): Camera probe failed with error 0x20001
        12:49:40.670 -> Camera init failed with error 0x20001

        I do somes research it seem that others than me have this kind of issue

  24. FotoAmg says:

    I am keep on finding the same basic example for this esp/cam combo, and did not find other kind of examples.
    Do you have them or can you give me suggestions how to achieve?
    I plan to use 2 modules as want to create Stereo 3D (left-right camera side by side) pictures.
    For this I need the 2 unit’s still capture to be synchronized.

    Easy option would be to make a separate outer frame html and with some trick trigger both from UI side but not sure how good shouzld it work as it would be cross domain due to different IP.

    I want to use my mobile phone as preview and control to start video capture. Can these modules be connected to an android mobile phone wifi without wifi network, and can 2 device connected at the same time?
    Many questions…
    or Other solution would be to connect the 2 modules as there are som free pins as I see and one module would be a slave checking the high/low state on an inut PIN to trigger photo capture…..

    It is ok for me it pictures are stored in a microSD as this module has microSD slot too.
    Did not find any examples to handle saving to microSD…

    Also other step would be to reach the recorded left and right pictures, for this I would need to host the microSD image older content of each module in the web server and can merge the image pairs side by side later, maybe by the webapp.

    Thanks for the advices!

    1. WordBot says:

      I’m pretty sure you can’t use the pins to trigger if you want to use the SD card as well. You can probably trigger on pins and POST the image (just got POSTing images working). Probably the best solution is use JavaScript to put two camera srcs on one page and grab images simultaneously when you press a button. How many pictures do you need to capture? This weekend I should have tutorials posted for writing to SD cards, POSTing images and triggering captures.

      You should be able to set up the phone as a hotspot and connect both devices. One will host the page with the two streams.

  25. Frank says:

    i’ve got a problem with bad MJPG quality.
    It produce random horizontal lines in different colors which are jumping around.
    Only Still-Pictures are free of this lines and looking good.
    I’ve tried to change the VCC down to 3.3V, add capacitor to the VCC, also tried to change the pixelclk, but nothing helps.

    btw. my board doesn’t work at 5V. Max is 4.7Volts. Anything above let it crash or it wont boot.

    thanks for help

    1. WordBot says:

      Hi. I’m not sure but I think it’s just poor build quality on some of the cameras. Maybe poor voltage regulation on the board itself.

  26. Evans says:

    my ESP32 cam has that resistor connected to a an external antenna, so i connected it to an external resistor, still no ip adress on my serial monitor, just endless dots, what could be the problem?

    1. WordBot says:

      Can you try one of the example Sketches that use WiFi and see if the problem persists?

  27. Rod says:

    Hello – I’m just trying to add this camera into MotionEye. Can you offer a brief explanation?

  28. Svein says:

    Help, I do not have File->Examples->ESP32->Camera ? I use Arduino v.1.8.9
    Did I need to change to v. 1.8.7 ????

    1. WordBot says:

      Can you see File>Examples>ESP32? Maybe you need to update the boards?

  29. Svein says:

    Yes I see:ESP32->AnalogOut, ChipID, DeepSleep,ESPNow
    But no Camera.

      1. Svein says:


        1. WordBot says:

          How strange! Not sure if it will appear in the menu but you can try copying the files from here into C:\Users\**yourusername**\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.2\libraries\ESP32\examples. If not you can just add the files into your Arduino folder as another sketch and use it like that.

        2. WordBot says:

          Looks like the face detection isn’t working on 1.0.2 at the moment.

  30. Steve says:

    Thanks for a great article.
    Just a comment on using FTDI board. You need to leave link for power in 3v3 position, ( to drive ESP32 safely) and the connect 5V as shown for power. You may damage driving Tx at 5v from other units, maybe put a couple hundred ohm resistor in series.
    I struggle in my workshop to get it working (modded aerial !! Thanks) as signal a bit weak from router. What needs changing to make it work as a wireless access point so can be used anywhere?

  31. WordBot says:

    Thanks for the comment. I’ve updated the article. I’ll try to make another tutorial for connecting in AP mode. It’s not difficult.

  32. Steve says:

    Thanks Wordbot,
    Actually FTDI is even easier. With USB to top, link from center pin to right for 3v3, and the left pin is 5v. The center pin goes to VCCIO ( the in/out voltage on chip) and to the bottom VCC pin, so that it will only drive a safe 3v3 to ESP 32.
    That would be really terrific if you could do access point. Im not interested in face recognition, but would really like to do some VERY siimple computer vision, by manipulating an array, and modifying pixels, say invering colour for example. Also like to be able to draw a cursor and get position from web app.Thinkthis is done with GFX functioon,
    Coffee on its way, enjoy while its hot!! Beer+ available with above tutorial!!

  33. Florian says:

    I’m having huge problems with heap errors when using face detection or recognition.

    like this one:
    MJPG: 7361B 246ms (4.1fps), AVG: 412ms (2.4fps), 133+93+0+0=227 0
    CORRUPT HEAP: Bad tail at 0x3ffdfbfc. Expected 0xbaad5678 got 0x00000000
    assertion “head != NULL” failed: file “/Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/heap/multi_heap_poisoning.c”, line 214, function: multi_heap_free
    abort() was called at PC 0x400dcb93 on core 1

    Backtrace: 0x40091b44:0x3ffdc760 0x40091d75:0x3ffdc780 0x400dcb93:0x3ffdc7a0 0x400917b9:0x3ffdc7d0 0x4008840a:0x3ffdc7f0 0x400899b5:0x3ffdc810 0x4000bec7:0x3ffdc830 0x400e424a:0x3ffdc850 0x400d2da7:0x3ffdc8d0 0x4012a995:0x3ffdca80 0x40129be9:0x3ffdcab0 0x40129cc5:0x3ffdcb40 0x4012a0d0:0x3ffdcb60 0x40129206:0x3ffdcb80 0x40129258:0x3ffdcbc0 0x4008dae1:0x3ffdcbe0

    any ideas?

    1. WordBot says:

      I was seeing this the other day but I don’t remember what I was doing when I saw the errors. What board version do you have?

    2. AnttiDuino says:

      I got this kind of a message when I simply ran out of memory.

  34. AnttiDuino says:

    Great article and great piece of software. But I have one problem: when I call cmd_handler using

    view.src = `${baseHost}/control?var=abc&val=2`

    the parameters are passed ok, but at the same time the video-stream is closed. Any ideas how to do call cmd_handler without closing the stream.

    Have a nice coffee!

    1. WordBot says:

      Thanks for the coffee! I guess the command you are sending (ie res = s->set_saturation(s, val);) is crashing the camera.


    Congratulations on the tutorial worked perfectly here, I would like to implement login and password on the web page that configures the camera, would you have any idea?

    1. WordBot says:

      It’s going to be a bit tricky but you could modify the static esp_err_t index_handler(httpd_req_t *req){ function which loads the main web page to look for a password in the request. The stream URL will still be available to anyone who knows it though.


        I was able to implement an efficient login and password in my main page of the camera following your html modification tutorial, thank you, if you wish I can share the solution here

        1. WordBot says:

          That would be great to share it! Maybe put it on Pastebin so the formatting is kept?

        2. Maurizio says:

          I need this feature, please write the solution.

  36. Pinou Gaston says:

    ça fonctionne .
    mon problème est que quand j ‘appelle l’adresse ip , j ‘ai l’image mais je n’ai pas la bande de setting sur le coté avec les réglages.
    Comment faut il faire ?

    1. WordBot says:

      Hi, That’s bit odd. If you go the IP address (something like you should only see the settings on the left and nothing else. You only see the image when you press one of the buttons.

  37. Wild_Cake says:

    I have a toruble:
    “rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    mode:DIO, clock div:1
    entry 0x400806a8

    [E][camera.c:1049] camera_probe(): Detected camera not supported.
    [E][camera.c:1249] esp_camera_init(): Camera probe failed with error 0x20004”

    I tried connect external power (5V, 2+A) – same errors…((

    1. WordBot says:

      This sounds like the wrong camera has been chosen. You sure you have this #define CAMERA_MODEL_AI_THINKER without the double forward slash commenting?

  38. John says:

    Thanks for the tutorial on the esp32-cam.
    I sent you a large cup of coffee. 🙂

    1. WordBot says:

      That’s great. Big coffee appreciated!

  39. Stuart Megson says:

    Hi. Can you please help. I have 2 x ESP32-cam. But face detection is not working on both.
    I have Resolution set to QVGA, Start Stream is on, Face Detection is on. But no box around any face for picture.
    I am able to Get Still picture.
    I an unable to find any solution to this problem.

    1. WordBot says:

      Hi, Are you using 1.0.1 of the boards library? 1.0.2 doesn’t work properly –

  40. Stuart Megson says:

    Hi. I have version 1.0.3-rc1 installed.
    Thanks for the reply.

    1. WordBot says:

      Pretty sure it’s broken in that version as well. Some of the other tutorials on the site only work with the latest version though.

  41. Stuart Megson says:

    O.K Thanks, will try it with the later version.
    Thanks for the info.

  42. Saepul Hidayatuloh says:

    this is mh probelm. I use esp32 cam. it shows in serial monitor :

    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    mode:DIO, clock div:1
    entry 0x400806a4

    SCCB_Write [ff]=01 failed
    SCCB_Write [12]=80 failed
    [E][camera.c:1085] esp_camera_init(): Camera probe failed with error 0x20001
    Camera init failed with error 0x20001

    any solutions?

    1. WordBot says:

      Sounds like either the wrong camera is selected or there’s a hardware problem with the camera.

  43. iSchonfeld says:

    I have the camera working when accessed locally with in my home network. But when trying to access it from “outside”, I can’t seem to get it to work completely. I have 2 ports set up for NAT, 3387 for the controlling page, and 3388 for the streaming. If I set up the following:

    Serial.printf(“Starting web server on port: ‘%d’\n”, config.server_port);
    if (httpd_start(&camera_httpd, &config) == ESP_OK) {
    httpd_register_uri_handler(camera_httpd, &index_uri);
    httpd_register_uri_handler(camera_httpd, &cmd_uri);
    httpd_register_uri_handler(camera_httpd, &status_uri);
    httpd_register_uri_handler(camera_httpd, &capture_uri);

    config.server_port = 3388; // 2019-07-20 was += 1;
    config.ctrl_port += 1;

    Serial.printf(“Starting stream server on port: ‘%d’\n”, config.server_port);
    if (httpd_start(&stream_httpd, &config) == ESP_OK) {
    httpd_register_uri_handler(stream_httpd, &stream_uri);

    I have port 80 forwarded to 3387, and port 3388 to port 3388 in my router. I’ve also changed the GZ/Hex code so that :80 is now :3388. And I’ve verified that worked. Then I can hit the camera from outside using [url]:80. The page comes up just fine. But when I try to start streaming, it won’t stream. However, I can stream by manually going to [url]:3388/stream. When I right’click on the area where the streaming video should show and inspect it, I see [url]:3387-3388/stream – which obviously won’t work – it should have [url]:3388/stream. Does anyone know what I need to do to get this working “externally”?

    1. WordBot says:

      Looks like there’s something wrong with the HTML side of things if the page source is showing the wrong URL.

      Do you have this line in the HTML? j.src = `${c+':81'}/stream`, f(k), m.innerHTML = 'Stop Stream'

      What happens when you inspect the code for the streaming area when you click the ‘Stream’ button?

  44. Abbas Kagdi says:

    Arduino: 1.8.5 (Windows 8.1), Board: “ESP32 Wrover Module, Huge APP (3MB No OTA), QIO, 40MHz, 115200, None”

    Sketch uses 2241942 bytes (71%) of program storage space. Maximum is 3145728 bytes.
    Global variables use 52704 bytes (16%) of dynamic memory, leaving 274976 bytes for local variables. Maximum is 327680 bytes. v2.6
    Serial port COM6

    A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
    A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

    so fed up of this recurring error. Please help

    1. WordBot says:

      It sounds like either the io0 pin isn’t connected to GND or the reset button hasn’t been pressed.

  45. SuperFluidVacuum says:

    If you are able to follow this tutorial but aren’t seeing any image or streaming video in the web browser, the problem is likely a damaged camera or you may want to try this:
    Remove the camera from socket by gently tipping up the black holding bar (from camera side). The camera connection strip should pull out without needing any force. Use an electrical contact cleaner on the strip and in the socket if possible. Reseat the camera and (at least for me) the still and streaming images worked like all the demo’s show.

  46. Testy says:

    is there someone who has for example the CameraWebServerExample enhanced to do also OTA Updates?
    I what to Update/Flash the ESP via http, like I do it for other esp32 boards.
    First I have tested to add functionality to the WebServerExample, but that wasn’t working, so I decided to first try a standalone example.

    I’am not so familiar with the partition stuff and so on, so maybe it is related to that?
    When using the CameraWebServer Example I used the “Huge APP (3MB No OTA)”.
    It was starting the Update, but at ~12% is said “Not enough space”…

    Does someone have an idea or sketch which is working with OTA/Http-Update for ESP32-Cam ? (#include )

    See code below:
    #include WiFi.h
    #include WiFiClient.h
    #include WebServer.h
    #include Update.h

    WebServer server(80);

    const char* ssid = “abc”;
    const char* password = “xyz”;

    const char* serverIndex = “”;

    void setup(void) {
    Serial.println(“Warte auf Verbindung”);
    WiFi.begin(ssid, password);

    while (WiFi.status() != WL_CONNECTED)
    Serial.print(“IP Addresse: “);

    server.on(“/”, HTTP_GET, []() {
    server.sendHeader(“Connection”, “close”);
    server.send(200, “text/html”, serverIndex);
    server.on(“/update”, HTTP_POST, []() {
    server.sendHeader(“Connection”, “close”);
    server.send(200, “text/plain”, (Update.hasError()) ? “NOK” : “OK”);
    }, []() {
    HTTPUpload& upload = server.upload();
    if (upload.status == UPLOAD_FILE_START) {
    Serial.printf(“Update: %s\n”, upload.filename.c_str());
    //uint32_t maxSketchSpace = (1048576 – 0x1000) & 0xFFFFF000;
    uint32_t maxSketchSpace = 0x140000;

    //Serial.printf(“ESP.getFreeSketchSpace: %i\n”, ESP.getFreeSketchSpace());
    //uint32_t maxSketchSpace = ESP.getFreeSketchSpace();
    if (!Update.begin(maxSketchSpace)) { //start with max available size
    } else if (upload.status == UPLOAD_FILE_WRITE) {
    if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) {
    } else if (upload.status == UPLOAD_FILE_END) {
    if (Update.end(true)) { //true to set the size to the current progress
    Serial.printf(“Update Success: %u\nRebooting…\n”, upload.totalSize);
    } else {
    Serial.println(“HTTP Server gestartet”);

    void loop(void)

  47. Rajesh Bhat says:

    esp 32 camera module uses hdf3m-811and raspberry camera module uses p5v04a. is that camera is same or different?

    1. WordBot says:


  48. saeed says:

    Why does it happen?

    1. WordBot says:

      Hi, Does it work at lower resolutions? If not, try gently removing the camera (you have to lift the connector (gently!)) and reconnect.

  49. paolo says:

    hi, how i can use it with esp32-cam module with ov7670

    1. WordBot says:

      Hi, I don’t think it’s possible.. I can’t remember why though. Might be the 7670 doesn’t have native JPG output? You can use ov3660 or ov2640

  50. saeed says:

    Thank you for the answer
    But after on error:
    WiFi connected
    Starting web server on port: ’80’
    Starting stream server on port: ’81’
    Camera Ready! Use ‘’ to connect

    No difference

    1. WordBot says:

      It most likely the camera is faulty. You can buy new ones here if you don’t want to replace the whole device.

  51. Helmut Haßfurther says:

    My device looks like that in your video
    using: #define CAMERA_MODEL_AI_THINKER
    sometimes I get a connection to the server, but both the picture shoot, and the streaming video gets errors:
    [E][camera.c:3004] …

    sometimes i get:
    [E][camera.c:1049] camera_probe(): Detected camera not supported.
    [E][camera.c:1249] esp_camera_init(): Camera probe failed with error 0x20004

    1. WordBot says:

      I’m not sure. Could be a power issue or the camera is dying. Can you connect the board directly to 5v with short dupont cables?

  52. Malcolm says:

    The live video streaming appears in the browser on my laptop but does not appear on my android phone. Only the controls appear, even when I click on the Start Button.

    1. WordBot says:

      Can you see the stream at http://your-ip-address:81/stream on your phone?

  53. tonny says:

    Hello my name is tonny and I live in the city of Santa Marta Colombia, I am working with this module (ESP32cam) for a project, but I have problems in the video, it only works for about 5 seconds and my image freezes, someone can freeze me Offer help please. thanks.

    1. WordBot says:

      It might be a problem with Wi-fi. If you compile with Core Debug Level “Verbose” do you see an error in the serial monitor?

  54. Malcolm says:

    Yes, Great. Thank you. However the buttons don’t show now.

  55. Malcolm says:

    P.S .. but the buttons and the image shows if I use :80. Thank you.

    1. WordBot says:

      Can you pinch to zoom out when you see the interface? You need to press the ‘start stream’ button

  56. Are Jayem says:

    I just bought you a coffee… As a rank noob with boards and IDEs and pinouts, I’ve been having more failures than successes. It gets disheartening. “Is my cheap imported board (or FTDI adapter) the cause?” It further puts a damper on things when one has to spend hour after hour researching whatever problem du jure comes up. But with this tutorial – though there were a few learning stumbles – when things worked and I was able to take still pics and see the streaming video…. I would have kissed my dog (if I had one). Much appreciated.

    1. WordBot says:

      LOL! Thanks! Being there and having done the hour after hour researching is part of the reason I started off doing the ESP32-CAM tutorials. The Ai-Thinker is hard to work with.. one of the ESP32 cameras with USB are much nicer.

  57. Gérard says:

    Hello, Thank you for your excellent tutorial. I’m looking everywhere for a way to create the possibility of zooming in on streaming, maybe by adding a button on the settings? I don’t know if this is possible, what do you think?

    1. WordBot says:

      Hi, One way would be to somehow restrict the window size that the stream appears in (maybe use overflow:hidden css) and change the resolution with the selector to give the impression of zooming in. Alternatively there must be JavaScript libraries that you could use similar to shopping sites when you mouse-over for a ‘zoomed in’ view.

  58. Gérard says:

    Hello Thank you for your opinions which seem to me to be a basis for interesting reflections. It’s up to me to see how to achieve this, not knowing much about it, I’m going to have a lot of work … I forgot to tell you that I communicate with the ESP32-CAM access point on a smartphone or tablet, is that going to be any different? In any case, I will try to understand what you are offering me, it will be difficult for me, but I will try to understand: “(maybe use an overflow: hidden css)” thank you all the same

    1. WordBot says:

      Hi, Yes, if you don’t know html or JavaScript it will be tricky. I remembered I’d seen a way of doing it on the camera itself. I don’t know if it’s possible in the Arduino version but in the IDF version it probably is –

  59. Gérard says:

    Hello ha yes, it may be possible with the proposed settings, I will watch this as soon as I can, I have to be away for a few days but when I return I will keep you posted. thank you very much for your responsiveness and your ideas.

  60. Gérard says:

    I could finally try to zoom in with the resolution parameters which are proposed in the menu.
    I forgot to tell you that I use the ESP32-CAM with my smartphone or tablet, as an access point, so we can enlarge the video image by touching the screen.
    I started with the UXGA resolution (1600 X 1200), and the enlargement of the video is good, but not so satisfactory.
    In your opinion, is it possible to set a resolution higher than the UXGA (1600 X 1200)?
    And if so, what can the OV2640 camera support as a maximum resolution?

  61. Frank Barella says:

    Hi, does anyone know if there is a way to see the video stream without a wifi router connection? To say…if you are outside the open land and so you can’t connect to any wifi. Thanks

    1. WordBot says:

      Hi, You can set the ESP32 up as an access point so you don’t need a router. Will that work?

  62. PiStacheyo says:

    My camera is connected to my wifi, and the serial port is showing that images are being captures. However, all I can see is a black screen when I “Start Stream”. I notice that the serial output in Arduino ends with 0+0+0+0=0. I wonder if this has anything to do with my issues.

    1. WordBot says:

      If you turn on face detection do you see the numbers change?

  63. Gary Benna says:

    Have you tried this with Blynk? Are there any GPIO pins open on the board I can use as an OUTOUT pin set to HIGH/LOW?

    1. WordBot says:

      Check out the other projects: There’s a Blynk one and one for triggering a relay.

  64. Prashant Vasala says:

    How can we save facial data in a database and send a mail to the user if an unregistered user is at the door?

    1. WordBot says:

      I don’t know a way of saving the facial data off the ESP32. If you are using another system for saving data and sending emails it’s probably easier to just use the ESP32-CAM has a network camera and do all the face recognition etc with the other system.

  65. imad uddin says:

    Sir if i power on the circuit they coneect to wifi but after a few seconds they disconnect

    1. WordBot says:

      Can you check the antenna you have on the board compared with the one in the tutorial above. Also try connecting to your phone to see if that works.

  66. imad uddin says:

    From computer port its not disconnect but from circut they does not work

    1. WordBot says:

      Probably not enough power in the circuit. Wi-Fi uses a lot of power so if your power source is weak or the cables are too thin the ESP32 will crash.

  67. imad uddin says:

    Iam using 12v power supply ……..

    1. WordBot says:

      Where are you connecting the 12v to? It’s supposed to be 5v for the ESP32

  68. imad uddin says:

    Thanks sir for ur reply ……

    Now its working………

  69. imad uddin says:

    Sir can i attach 3 out puts to it….

    And i need thesis for my project

  70. Larry says:

    Has anyone been able to turn on the pSRAM in the “AI Thinker” on Arduino IDE?

    I believe the Camera not supported is due to the wrong board selection, as the instructions say to select the Wrover Module and not the AI Thinker ESP32-cam module.
    Free DRAM: 251536, free pSRAM 0 of 0
    [E][camera.c:1049] camera_probe(): Detected camera not supported.
    [E][camera.c:1249] esp_camera_init(): Camera probe failed with error 0x20004

    1. WordBot says:

      In the tools menu there should be an option for the PSRAM when you are using the Wrover settings. I imagine the Ai Thinker board setting defaults it to being on.

  71. Nadir says:

    I used this tutorial,but No IP adress showing!please help me

    1. WordBot says:

      What do you see in the serial monitor? Try setting the Core Debug Level to ‘Verbose’ in the tools menu.

  72. Iris says:

    Video Streaming works fine for me, but Face Recognition and Detection don’t work.
    When I click the ‘Face Recognition’ or ‘Face Detection’ button, the video freezes. The ESP32 crashes and reboots, according to the serial monitor error message:

    No Match Found

    CORRUPT HEAP: Bad head at 0x3ffe29ec. Expected 0xabba1234 got 0x00000008

    abort() was called at PC 0x400889a1 on core 1

    ELF file SHA256: 0000000000000000

    Backtrace: 0x4008df7c:0x3ffe1bc0 0x4008e1f5:0x3ffe1be0 0x400889a1:0x3ffe1c00 0x40088acd:0x3ffe1c30 0x400d9eaf:0x3ffe1c50 0x400d6141:0x3ffe1f10 0x400d60d0:0x3ffe1f60 0x40093521:0x3ffe1f90 0x400890e2:0x3ffe1fb0 0x40088899:0x3ffe1fd0 0x4000bec7:0x3ffe1ff0 0x400d1df9:0x3ffe2010 0x40108619:0x3ffe21c0 0x40108d21:0x3ffe21f0 0x40108dd9:0x3ffe2280 0x401091ac:0x3ffe22a0 0x40107898:0x3ffe22c0 0x401078ef:0x3ffe2300 0x4008fe76:0x3ffe2320

    ets Jun 8 2016 00:22:57

    rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    mode:DIO, clock div:1
    ho 0 tail 12 room 4
    entry 0x400806b4

    WiFi connected
    Starting web server on port: ’80’
    Starting stream server on port: ’81’

    Do you have any suggestions to get it working? Thanks in advance!

    1. WordBot says:

      Hi, Which board do you have set in the IDE? Do you see an option for PSRAM ?

      1. Iris says:

        Using version 1.0.4 seems to work indeed!

        Thank you very much!

    2. Iris says:

      I have the ‘AI Thinker ESP32-CAM’ selected.
      I don’t see an option for PSRAM (only for CPU Frequency, Flash Frequency and Flash Mode)

      1. WordBot says:

        Do you know which version of the ESP32 Hardware library you have installed? Should be 1.0.4 or 1.0.5

      2. Iris says:

        I have version 1.0.5

        1. WordBot says:

          I just did a test with 1.0.5 and it looks like it’s doing the same thing. I can’t see any issues for this on Github. Try 1.0.4 ’til they fix it.

  73. Maram says:


    Thank you for the video.
    I’m just running into a bit of trouble. When I paste the IP address, nothing shows up and the stream page doesn’t start> Do you have any idea how to fix that?


    1. WordBot says:

      So the browser doesn’t connect to the IP address at all?

  74. Maram says:

    It doesn’t connect to the browser at all. It just keeps loading and then it stops.

    1. WordBot says:

      Can you try some of the other WiFi examples in the Arduino IDE for the ESP32 to see if they work?

  75. Maram says:

    Turns out I was using two different networks. I was using Wifi for my laptop. As for the esp32 camera I was using the mobile hotspot. After making both of them on the same network, the camera worked just fine.

    Thanks a lot for your help.

  76. Emerson Amaral says:

    Hi! Congrats for all your work here!
    I’m having an issue with the Camera Web Server after uploading the code. I’ve removed the jumper between GND and GPIO 0, entered the Serial Monitor and hit the reset button. The following error appears:
    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    mode:DIO, clock div:1
    entry 0x400805f8
    E (202) psram: PSRAM ID read error: 0xfffffv
    E (319) cam_hal: cam_dma_config(271): frame buffer malloc failed
    E (319) cam_hal: cam_config(355): cam_dma_config failed
    E (320) camera: Camera config failed with error 0xffffffff
    Camera init failed with error 0xffffffff

    Could this be a hardware issue?

    1. WordBot says:

      Sounds like hardware. Which version of the ESP32 hardware libraries are you using? They’ve been updating them a lot recently.

      1. Emerson Amaral says:

        Yes it is a hardware issue! Yesterday I went to an IoT shop and tested a new board, and the code worked instantly!

  77. Meagan says:

    Thank you!!! After for searching for days this is the only resource I could find to fix my issue. I had installed version 1.0.6 of the esp32 boards manager and upon reading your article I uninstalled it in favor of version 1.0.5. My server no longer crashes when I open it. You’re a lifesaver.

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