Upload Code to ESP32-CAM AI-Thinker using ESP32-CAM-MB USB Programmer (easiest way)

Learn how to upload code to the ESP32-CAM AI-Thinker board using the ESP32-CAM-MB micro USB programmer. This is the easiest way to program your ESP32-CAM board.

This micro USB programmer works like a shield that you attach to the ESP32-CAM board. The programmer comes with a USB socket that you connect directly to your computer.

Upload Code to ESP32-CAM AI-Thinker using ESP32-CAM-MB USB Programmer easiest way

The ESP32-CAM AI-Thinker module is an ESP32 development board with an OV2640 camera, microSD card support, on-board flash lamp and several GPIOs to connect peripherals. And it costs just a few bucks.

However, one of the biggest hassles when working with the ESP32-CAM Ai-Thinker module is uploading code to the board. The AI-Thinker board doesn’t have a built-in USB programmer. In previous tutorials we recommended using an FTDI programmer to connect to the board through the serial pins.

Additionally, you also needed to follow another two or three steps until successfully uploading the code. But, now you can simply use the ESP32-CAM-MB USB programmer and click the Upload button to successfully program your board. It’s that simple.

Getting the ESP32-CAM-MB USB Programmer

You can open the next link to check the available stores to get the ESP32-CAM-MB USB Programmer. The package includes the ESP32-CAM-MB Programmer and it might also include the ESP32-CAM board itself.

ESP32-CAM-MB Micro USB Programmer CH340G Serial Chip for OV2640

ESP32-CAM AI-Thinker MB Programmer

The ESP32-CAM AI-Thinker MB programmer is a shield that you attach to your ESP32-CAM board GPIOs. The following image shows the programmer and the ESP32-CAM side by side.

ESP32-CAM-MB Micro USB Programmer CH340G Serial Chip for OV2640

The programmer comes with the CH340C USB to serial chip.

ESP32-CAM-MB CH340G Serial Chip USB Converter

This allows you to program the ESP32-CAM using the USB port on the shield.

ESP32-CAM-MB CH340G Serial Chip Micro USB Port Programmer

Additionally, the shield also comes with a RESET and a BOOT (IO0) buttons. This may be useful to easily reset the ESP32-CAM or put it into flashing mode.

Program ESP32-CAM using the MB Programmer (Arduino IDE)

To program the ESP32-CAM board with Arduino IDE, you need to have Arduino IDE installed as well as the ESP32 add-on. Follow the next tutorial to install the ESP32 add-on, if you haven’t already:

Then, simply connect the MB programmer to the ESP32-CAM as shown in the following image.

ESP32-CAM-MB Micro USB Programmer CH340G Serial Chip OV2640 Camera

Then, connect the board to your computer using a USB cable.

After that, in your Arduino-IDE, follow the next steps:

1) Go to Tools Board and select AI-Thinker ESP32-CAM. You must have the ESP32 add-on installed. Otherwise, this board won’t show up on the Boards menu.

Select the AI-Thinker ESP32-CAM in Arduino IDE Tools Menu

2) Go to Tools Port and select the COM port the ESP32-CAM is connected to.

Note: if the board doesn’t show up, it means that you probably don’t have the CH340C drivers installed on your computer. Go to Google and search “CH340C drivers” followed by your operating system and install the drivers.

3) For demonstration purposes, you can copy the following blink sketch:

/*********
  Rui Santos
  Complete instructions at https://RandomNerdTutorials.com/esp32-cam-projects-ebook/
  
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*********/

// ledPin refers to ESP32-CAM GPIO 4 (flashlight)
const int ledPin = 4;

void setup() {
  // initialize digital pin ledPin as an output
  pinMode(ledPin, OUTPUT);
}

void loop() {
  digitalWrite(ledPin, HIGH);
  delay(2000);
  digitalWrite(ledPin, LOW);
  delay(2000);
}

View raw code

This sketch, simply blinks the on-board flash LED.

4) Then, click the Upload button in your Arduino IDE.

Program ESP32-CAM with Arduino IDE

And that’s it!

You should get a message saying the code was successfully uploaded and your board should be blinking the LED flash.

ESP32-CAM-MB Micro USB Programmer CH340G Demonstration Testing

Wrapping Up

Using the ESP32-CAM AI-Thinker MB Programmer is the easiest way to program the ESP32-CAM board. You no longer have to use an FTDI programmer and experience timeout issues.

We hope you have found this article useful. You can try our projects with the ESP32-CAM:

Thanks for reading.



Learn how to build a home automation system and we’ll cover the following main subjects: Node-RED, Node-RED Dashboard, Raspberry Pi, ESP32, ESP8266, MQTT, and InfluxDB database DOWNLOAD »
Learn how to build a home automation system and we’ll cover the following main subjects: Node-RED, Node-RED Dashboard, Raspberry Pi, ESP32, ESP8266, MQTT, and InfluxDB database DOWNLOAD »

Enjoyed this project? Stay updated by subscribing our newsletter!

113 thoughts on “Upload Code to ESP32-CAM AI-Thinker using ESP32-CAM-MB USB Programmer (easiest way)”

  1. hola espero pueda ayudar yo uso el USB ESP32-CAM-MB + ESP 32CAM cargo el código de prueba que enciende el led de la cámara y todo ok
    pero si cargo este proyecto Transmisión de video ESP32-CAM y reconocimiento facial con Arduino IDE el código sube bien pero el resultado es este
    ya probé todo y no hay manera de que funcione lo que no tengo claro es que mi ESP32CAM el modelo no creo que sea al-thinker en placa de mi esp 32 cam hay lo siguiente DM ESP32-S algún consejo ya no se que mas probar gracias
    ets Jun 8 2016 00:22:57

    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff0018,len:4
    load:0x3fff001c,len:1216
    ho 0 tail 12 room 4
    load:0x40078000,len:9720
    ho 0 tail 12 room 4
    load:0x40080400,len:6352
    entry 0x400806b8

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

    Reply
    • tazma tengo el mismo problema, el codigo del LED me funciona, pero al ejecutar el del CameraWebServer me muestra el error:
      rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
      configsip: 0, SPIWP:0xee
      clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
      mode:DIO, clock div:1
      load:0x3fff0018,len:4
      load:0x3fff001c,len:1216
      ho 0 tail 12 room 4
      load:0x40078000,len:10944
      load:0x40080400,len:6388
      entry 0x400806b4
      E (79) psram: PSRAM ID read error: 0xffffffff

      [E][camera.c:1113] camera_probe(): Detected camera not supported.
      [E][camera.c:1379] esp_camera_init(): Camera probe failed with error 0x20004
      4

      Reply
    • To the truckload of whiners repeatedly complaining about errors initializing unsupported cameras… WHY YOU THINK THAT IS?

      ENGAGE BRAIN *
      Error is LITERALLY telling you the ESP32 software is incompatible with the camera hardware, so either change software or change hardware.
      DISENGAGE BRAIN *

      If you have a camera with exact pinout specified in your code plug it in, otherwise select the pinout of whatever camera you’re using. Duhhhh.

      EXAMPLE:
      in above tutorial the camera is the OV2640 so in Web Cam Server sketch example commenting out:

      #define CAMERA_MODEL_WROVER_KIT // Has PSRAM

      and uncommenting:

      #define CAMERA_MODEL_AI_THINKER // Has PSRAM

      would be the correct camera.

      Reply
      • This web site and forum is for beginners who want to learn, and not for the seasoned embedded programmers perhaps like you? Sara Santos is an amazing Instructor and she is very patient with those of us who have never experienced programming before. She is absolutely devoted to helping each and every one of us learn, and I admire her for that. If our questions drive you to insanity, then perhaps you could avoid this site, or even better, make positive contributions to helping us learn without name calling. Maybe you should also cut back on the caffeine before you post.

        Reply
    • En mi caso, se carga el código sin problemas, pero jamás entra ni siquiera al setup, lo sé porque al inicio del setup pongo eso: Serial.begin(115200);
      Serial.println(“PRUEBASSS”); y nunca imprime nada en el serial. ayuda porfavor

      Reply
  2. This looks like a cool thing to have. The ESP32 cam is really good, compared to all the others that cost more. Ordered one from the eBay link.

    Reply
      • Pues yo no soy capaz de cargar el código como verás más arriba el error
        E][camera.c:1049] camera_probe(): Detected camera not supported.
        [E][camera.c:1249] esp_camera_init(): Camera probe failed with error 0x20004

        Reply
  3. Digging a bit deeper in the maze of AliExpress, there also appears to be an ESP32 camera with integrated CH340 USB connection. If you need only 1 or 2 ESP32 cams that is certainly an attractive option

    Reply
  4. Good evening. So this project is precisely timed. At the beginning of January I ordered these boards, at the end of the month it came and it is waiting to be implemented. So thanks a lot. I’m just remodeling the measurement with ESP and BM680 powered by LiPo and recharged solar. But once the next project with RPi and ePaper is complete, it will be another “night service” right away. But right now, it’s just for sitting at home. The test was negative again, which I wish you both (it’s about Covid). Lots of health and good mood.

    Reply
  5. Hmmmm… I tested the board out today. The kit comes with an ESP32 camera board. I was able to upload a sketch to it using the MB board interface. Sketch worked as expected.

    I was NOT able to upload a sketch to a AI Thinker Cam board using this MB board. I was able to upload the sketch to this AI Thinker Cam board using the trusty FTDI board.

    I wonder if it’s possible that only THEIR included ESP32 cams work with this MB board. I’ve contacted the seller through eBay to get their guidance.

    Reply
    • Specifically, I received the failure to connect error message:
      Connecting ….. ….. …… …….
      A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
      when I attempt to upload using the MB board to another ESP32 cam board.

      Reply
          • Hi.
            Today I tried it with another ESP32-CAM board, and it didn’t upload on the first try.
            I found out that you need to hold the programmer IO0 button and then press the ESP32-CAM on-board RST button when you start seeing the dots on the debugging window.
            It worked for me.
            Can you try it?
            If it works for you too, I’ll add a troubleshooting section to this article.
            Regards,
            Sara

          • I had success uploading a cam sketch to one of my other ESP32 cams. However, I found that after the sketch loaded, it wouldn’t run while still connected to the installer board. I tested it successfully while attached to my computer via FTDI cable. Pressing/holding IO0 and then pressing RST on the cam board was the way to go.
            The board didn’t cost very much, and I got another ESP32 cam out of it. I don’t know if it will replace my FTDI process, though.
            Thank you
            Don

          • BLUF: I think this is a Hardware Flow Control issue / C430 USB driver issue.

            The issue I am seeing with the ESP32-CAM-MB is that for some reason the RST line is being asserted on the CH430 by some of the serial port programs. I have parital success with the Arduino IDE, and puTTY but no luck with0 PyMAKR (VS Code). I have also tried HyperTerm and some other ones.

            The Windows 10 driver is set to have Flow Control as ‘None’, and the software is also set this way.

            The CH430 driver that I am using is ‘2019’ (CH431), and at some point, I will try the 2014 version. I might also try a Mac or Raspberry PI.

            I tried another PC, but had an issue getting PyMAKR to install properly.

  6. Hi Sara,
    I tried out two boards I received today with the MB, but I’m not getting my two older Cam boards loades neither. The boards are a litte bit different on the side where the flash LED is locaded. It looks like that there are two more resistors installed and there is also a 3V3 print???
    I trieded that out with the IO0 button, no luck.
    Willem

    Reply
    • Hi Kurt.
      Try holding the IO0 button on the programmer when you start seeing the dots on the debugging window and then press and release the ESP32-CAM on-board RESET button (not the programmer RST button).
      This worked for me.
      Regards,
      Sara

      Reply
      • Hi,

        Yes this is the problem – there is a method when using the programmer.
        1.Click on Arduino IDE Upload button
        2. When the output in the IDE shows the connecting message

        esptool.py v3.0-dev
        Serial port COM35
        Connecting…….._____….._

        On the programmer module press and hold down the IO0 on the side of the module.
        While still holding down IO0, now press and let go of the RST button on teh ESP32 (not the programmer)
        Let go of the IO0 now (so you’re not pressing any buttons anymore)

        Program downloads, mine does get stuck with

        Writing at 0x0002c000… (100 %)
        Wrote 261792 bytes (122371 compressed) at 0x00010000 in 3.1 seconds (effective 681.5 kbit/s)…
        Hash of data verified.
        Compressed 3072 bytes to 119…
        Writing at 0x00008000… (100 %)
        Wrote 3072 bytes (119 compressed) at 0x00008000 in 0.0 seconds (effective 2457.6 kbit/s)…
        Hash of data verified.

        Leaving…
        Hard resetting via RTS pin…

        But, just press reset button on the ESP32 again, and the new firmware will start exewcuting.

        Reply
        • Thank you so much!
          This was the best explanation so far and made mine work.
          Was thinking about buying a new one since I thought mine was doomed.

          Reply
  7. Hello,
    Today I tried to upload the code to the board using the MB module but when I do I get “Connecting …..______……..” Is this normal? Also do I need a special micro usb cable for uploading code? Do I simply follow the steps from the other comments (boot button and once ….. appear the on board reset from the esp32? I also have a problem installing the CH340 drivers, they won’t install any idea how to fix that?
    Thanks in advance
    Greetings
    Alex

    Reply
    • Hi.
      But does the code upload? Or do you get an uploading error after the …..____…… ?
      If that’s the case you need to do as mentioned previously.
      “Try holding the IO0 button on the programmer when you start seeing the dots on the debugging window and then press and release the ESP32-CAM on-board RESET button (not the programmer RST button).”
      Regards,
      Sara

      Reply
      • Hi Sara, I tried holding the IO0 button and then the ESP32 CAM on-board reset but the results in the monitor window are unreadable:
        16:29:57.478 -> ……………………………………….e⸮.RչA ⸮±⸮0⸮⸮⸮5SH⸮⸮⸮⸮:⸮⸮ (u]E⸮⸮⸮R⸮U⸮I⸮o⸮’⸮͠I⸮W⸮⸮⸮B⸮⸮⸮⸮⸮R⸮z*⸮T⸮iE%⸮_⸮Q⸮%U=}V⸮J⸮ȷX⸮⸮⸮g⸮⸮K⸮⸮⸮⸮l+⸮
        ⸮⸮.⸮⸮%ď{

        Reply
      • Whatever I try it does not work. In the Serial monitor I constantly see:
        rst:0x10 (RTCWDT_RTC_RESET),boot:0x1b (SPI_FAST_FLASH_BOOT)
        flash read err, 1000
        ets_main.c 371
        ets Jun 8 2016 00:22:57

        If I upload a sketch I always get
        A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

        It’s a HK-ESP32-CAM-MB and the IO0 button on the programmer when you start seeing the dots on the debugging window and then press and release the ESP32-CAM on-board RESET button (not the programmer RST button) does not work either. Is my board just broken or is there another magic combination to make it work?

        Reply
        • Hi.
          I don’t know any other “magic” combination.
          But I can’t be sure that the board is the problem.
          Regards,
          Sara

          Reply
  8. The blinking code works well. But how to get the cameraWebServer example works? It upload fine but the serial monitor don’t give me any result.

    Reply
      • Tried to press the RST on board button (on ESP32-CAM board also on ESP32-CAM-MB), still nothing in the serial monitor.
        Should, i try to change the #define CAMERA_MODEL…. ?

        Reply
        • Hi.
          I don’t think it is related to that.
          It should be something about the serial communication.
          Check that you’re using the right baud rate and that you’re opening the Serial Monitor or the right port.
          Regards,
          Sara

          Reply
          • If the baud rate is not right, it usually show a scramble text, and also i already test to change the baud rate (the cameraWebServer example use 115200 baud rate), it is still not working (tried to press the rst button in each board everytime changing the baud rate). Also already double check the com port.

            But it solved by updating the arduino ide app to 1.8.13 . Thanks again.

  9. Hello.

    I recieved two ESP32-CAM boards and the two ESP32-CAM32-MB programers today. After choosing the AI Thinker ESP-cam board in the arduino IDE and selecting the active COM port I can’t upload the blink sketch..I get the same error as above : Failed to connect to ESP32: Timed out waiting for packet header.

    So I tried your suggestion:
    After seeing the dots in the arduino console I pressed the IO0 button (kept holding it down) and then pressed and released the reset button on the camera board (not on the programmer board) …but no luck.
    Also pressing IO2 button and releasing it and then pressing and releasing the camera-board RST button didn’t solve the problem. The behaviour is the same for the two boards.

    I tried different cables also. All cables work fine in uploading sketches on arduinos but I can’t upload the sketch on the ESP32-CAM.

    Reply
    • Hi.
      That’s weird. The programmer worked fine for me with the boards that came with it.
      For other boards, I needed to do that with the buttons. But I was always able to upload the code.
      Can you try selecting another board. You can try the ESP32 Wrover module.
      Regards,
      Sar

      Reply
      • Same here, reset via MB (regardless if pressing the button or sending RTS signal) works only with the ESP32 CAM module that arrived with the MB and not with the other modules. Flash button or DTR signal for activating the bootloader work well with all the boards.

        Reply
        • I’ve also tried this with some ESP32-CAM-MB boards, with the ESP32-CAM modules that came with the board and with some older ones I had before I got these.

          There seems to be a difference between the PCBs of the ESP32-CAM modules that come with the ESP32-CAM-MB boards and “other” ones. It looks like the pin closest to the “flash” LED is marked GND/R, where it is marked only GND on the older boards I have. That silkscreen GND/R marking can (just about) be seen in the third image in this post, as well as the one that has the “flash” LED on, further down. When mounted on the ESP32-CAM-MB board, that GND/R ESP32-CAM pin is connected to (one side of) the RST side-facing button on the ESP32-CAM-MB board.

          On the ESP32-CAM modules that came with the ESP32-CAM-MB boards, the GND/R pin seems to connect to other GND pins on the module via a 13.8K resistor, so it’s only weakly pulled to GND. The other two GND pins (on the ESP32-CAM module) are connected to each other.

          Conversely, On the older ESP32-CAM modules, all three GND pins are connected together (low resistance between all of them).

          That GND/R pin is also connected to the RST pin of the ESP32 module, itself, on the back of the ESP32-CAM module, as well as (unsurprisingly) to one side of the RST button on the back of the ESP32-CAM module (in that difficult-to-reach place!)

          So it seems that they have got around the issue, on “other” ESP32-CAM modules, of the RST pin on the ESP32 itself not being broken out any of the pins on the 0.1″ pin headers, but only to the hard-to-reach RST button under the board, by modifying the ESP32-CAM PCB layout.

          That lack-of-reset-pin issue was mentioned by bitluni, who made one of the first kinds of these programming boards (that I saw, anyway, last year), and that issue is mentioned in his description on the product page here: tindie.com/products/bitluni/cam-prog/. He got around the issue by cutting off power to the microcontroller instead of “toggling” the reset pin on the ESP32 (since that can’t be done, except for by hand, on those “other” ESP32-CAM modules).

          I tested his boards and they worked well for programming with the “normal”/”other” ESP32-CAM modules, and didn’t require any special parameters (like monitor_rts = 0 and monitor_dtr = 0 in the platformio.ini file).

          Sadly, it seems that by modifying the ESP32-CAM module, it has made the ESP32-CAM modules that come with the ESP32-CAM-MB boards incompatible for use with programming boards like bitluni’s (unless the GND/R pin is not connected to GND on bitluni’s programming board, as would be the case for the “normal”/”other” ESP32-CAM modules, as that would hold the modules with a GND/R pin in perpetual reset), and the ESP32-CAM-MB boards are not compatible with the “normal”/”other” ESP32-CAM modules, as they expect the “special” GND/R pin, in order to reset those ESP32-CAM modules.

          Reply
    • Hi Marco
      Sorry I am a bit late replying.
      I had a similar problem – there seems to be some incompatibility between the boards.
      I solved it with FTDI – see my post of May 21, 2021 at 3:32 pm

      I see you bought FTDI. Did that solve it for you?

      Reply
  10. At the moment I have just these boards but monday I will recieve a FTDI programmer so I will try with that one to figure out whats wrong.

    Reply
  11. I can upload the firmware using the MB without pressing IO0 (flash) or RST button with both PlatformIO and Arduino IDE but the microcontroller doesn’t work when PlatformIO serial monitor is opened. Seems as RST and IO0 are pulled LOW by RTS and/or DTR and PlatformIO serial monitor pulls RST LOW which Arduino serial monitor doesn’t.

    Reply
    • With PlatformIO these lines have to be added to platformio.ini:

      monitor_rts = 0
      monitor_dtr = 0

      However, reset via MB (regardless if pressing the button or sending RTS signal) works only with the ESP32 CAM module that arrived with the MB and not with the other modules. I am still trying to find out the reason why reset button (and RTS) doesn’t work with other boards.

      Reply
  12. Hello everybody,

    anyone has an idea on how to connect the esp32-cam to my router via ethernet?
    If you can’t connect any ethernet module to the board directly, maybe there is an way to send it to another board, that is connected via ethernet or something else?

    I searched the whole internet, but I couldn’t find anything so far…

    Reply
    • He Felix,

      i’ve used the esp32-cam-mb (the one with usb) and used the webcam setting from this site.
      (ESP32-CAM Video Streaming Web Server (works with Home Assistant) and it bounded with my wireless router. In the serial monitor you can red the ip address. Working nicely but don’t expect much from the camera although :=)

      Reply
    • You can connect ethernet directly using the RMII interface (to a PHY, such as LAN8720). However, the camera interface and RMII share some of the same pins by default. Normally, you might be able to use alternate camera pins, if they weren’t already hard-wired by the ESP32-CAM board. I don’t know if the conflicting RMII pins can be remapped to other GPIO.

      Look at “Ethernet Media Access Controller” in the ESP32 technical reference manual for implementation details/options.

      Reply
  13. I experienced similar issues and trued several of the suggestions – seemingly not working . But after all this, I just put a 4Gb micro SD card in the slot and wham!! – 25-35fps using the AI Thinker webserver example – no issues or noticeable time lag at the smaller screen sizes. Using Arduino IDE and just compiling and upload – no need to hold down the boot button. Very handy piece of kit for uploading but no GPIO pins exposed so you need to move it to a breadboard after uploading to try the projects out.

    Reply
  14. Hello everyone and without the intention of offending anyone, I have to say that the esp32 CAM is a crappy camera if or if it hangs every 2 x 3 it works when a fiasco feels like it

    Reply
    • Data transfer from the camera to the ESP32 is slow or even hangs when the voltage drops because of power supply which can’t supply enough current without dropping the voltage or if the camera overheats. With good power supply ESP32 CAM works very well.

      FTDI module can’t supply enough current via 3V3 pin, take 5V from the 5V/3.3V jumper pin and connect it to 5V input. Jumper still has to be in the 3V3 position and all other voltage levels must be 3.3 V.

      3.3 V output from breadboard voltage module is too weak as well, use 5 V. Most of laptop USB ports are also too weak but everything works well when using powered USB hub. USB cables must be good too, with some USB cables the ESP32 CAM will reset whenever starting wifi connection.

      Once there is enough power the ESP32 CAM modules work very reliable.

      Reply
  15. I bought esp32-cam and its programmer. But it is not a ai thinker. I get these errors after loading the program . I’ve tried a lot of different pin connections. Either does not recognize the camera or gives this error. What should i do to make it work.

    Error code:
    Camera Ready! Use ‘http://192.168.1.106’ to connect
    [E][camera.c:1483] esp_camera_fb_get(): Failed to get the frame on time!
    Camera capture failed

    Reply
    • Hi.

      Here’s what one of our readers suggested for that problem:

      I found out the solution for my case, I hope many others can read this message because I have seen many people frustrated on the Internet with the error ” esp_camera_fb_get(): Failed to get the frame on time!”.

      Everything was solved just changing some parameters:


      config.xclk_freq_hz = 5000000;

      config.frame_size = FRAMESIZE_SVGA;

      I hope this helps.
      Regards,
      Sara

      Reply
    • Hey.
      I had the same problem with one ESP32-Cam, just reseated the little ribbon cable and the camera started to work. Gived a try.

      Kurt

      Reply
  16. Hello Sara (et al)! I think I already found my answer by reading between the lines in a couple of comments. But my question is do you need to have the esp32 cam MB programmer module attached to the camera module during operation? Thank you

    Reply
  17. i bought 3 of these mb programmers with esp32-cams from aliexpress.2 of the cams kept giving me upload errors and i can’t get them to work with the programmers.
    one of the cameras programmed like a champ on all 3 programmer boards, didn’t have to press any buttons. I kind of remember having to add a capacitor when i get these type of errors on these cams .I am not saying the
    cameras are bad yet , they may need this added capacitor. Thanks for all the
    great info you have always provided.

    Reply
    • Hi Richard.
      I’m sorry for the issues.
      I didn’t have any troubles with the programmers I have.
      However, we needed to press some buttons to make them work with other cameras (the ones that didn’t come with the programmer).
      Regards,
      Sara

      Reply
  18. These models of ESP32-CAM-MB programmer connect RTS to EN and DTR to BOOT, but don’t include the transistor network required to not reset the board when both RTS and DTR are asserted at the same time (which most serial terminals do on connection, even when hardware flow control is disabled – this includes putty, pymakr and ampy). This causes it to go into an unusable reset state whenever you try to connect using these apps. Yat is able to connect properly and go into REPL, as it has manual control over RTS and DTR, but not being able to use ampy or pymakr to upload code makes it a lot harder to develop.

    I worked around this by removing the two SMD diodes connecting the RTS and DTR lines from the CH340 to the EN and BOOT buttons and pins (these are physically located between the MicroUSB port and the IC). With those lines disconnected you have to use the physical buttons to reboot go into the bootloader, but when using micropython that’s rarely needed anyway.

    Reply
  19. Simple question. Does anyone know where to find a schematic for the ESP32-CAMERA-MB programmer board? That would be useful.

    For the record, my variants work with Sara’s plan. ie when the compile/upload process gets to the “linking everything together” stage I press and hold the IO1 button on the programmer, then when the “…….______…….” arrive I also press the RST button on the camera board for a good two seconds. Then release both and the upload starts. Works every time so far.

    What I need to know now is how to connect an external 5V supply to the MB and also what the RST button on the MB does. Hence the request for a schematic.

    Reply
  20. Thank you RNT for all your tutorials, and Sara for all your solutions above, which I will try later, although I solved my problems with the clumsy FTDI method.

    I bought three ESP32-CAM-MB piggy back cards from a UK supplier and they worked a treat – no problem uploading and running complex WiFi hotspot camera programs.

    The problems began when I bought a single ESP32-CAM card from the same UK supplier and tried to upload using an ESP32-CAM-MB Micro USB Programmer card and it brought up the error shown at the bottom of this post.

    Another ESP32-CAM from China brought up the same error!

    After a lot of fiddling around I did it the old way with an FTDI and the programs uploaded and ran OK.

    I think there must be an incompatibility between some of the cards and the clue may be in the error message below.

    Googling: Chip is ESP32-D0WDQ6 (revision 1)
    shows other people have had similar problems

    The ERROR I got was :

    Connecting…….._____….._____….._
    Chip is ESP32-D0WDQ6 (revision 1)
    Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None

    A fatal error occurred: Timed out waiting for packet header
    A fatal error occurred: Timed out waiting for packet header

    Reply
  21. Hi..Sara
    I have the problem in my esp32 cam, after loading is rising : a fatal error occurred : MD5 of file does not match data in flash!
    what can I do.
    And my ESP 32 cam always on his LED.
    Thanks.
    Saut TL

    Reply
  22. There are at least two versions of esp32-cam, one has the pin physically closest to antenna plug connected to GND, the other version (for MB) has pin connected to RST. This causes those troubles above. Please make a new tutorial with new instructions. And debug the MB-board and publish the schematic. It is quite a mess.

    Reply
  23. I had the same problem as the other people where my Arduino Mega would program happily but my ESP32 CAM would not, even with the programmer board.

    My usb cable is 3 foot long and cannot be substituted if I want to reach the computer on the ground.

    So, I switched to my laptop which I could have right in front of me, plugged a 1 foot long usb data cable into the usb data port and it programmed up all the cam units well.

    I have 5 of these units from the same vendor and NONE of them require any reset or boot buttons to be pressed at any stage, the programmer board takes care of all that.

    Have 5 programmed up and running, spied on my wife and my cat. Both yelled at me:)

    Reply
  24. Have you tried the ESP32 Cam with the built in micro USB socket? That makes it similar to other microcontrollers with just a USB connection and all pins available for I/O.

    Also have you tried replacing the OV2640 cam with the much higher resolution OV5640 on the ESP32 Cam board? Higher quality would be a big improvement but I understand there are some issues.

    At 1:30 he shows replacing the OV2640.
    There is also an auto focus version that can be used like a microscope up close.
    The above with code and side by side images and video could be another of your ESP32 Cam articles.

    Reply
  25. I’m not sure if anyone has mentioned this yet but the ESP 32 CAM that comes with many of the original MB from China actually have a different pin out than other ESP 32 CAM boards. Especially different from the Ai Thinker version. That is why it doesn’t work when you try to use it with another board. Took forever to find out and had to re pin the library to get it to upload and work correctly. Don’t remember where I had seen that mentioned. I had gotten some of the first ones to come out. They look like cheap knockoffs but worked well once figured out. I’m glad to see they have started to mature a bit and I’m gonna look into the ESP 32 CAM boards with everything on one board.

    Great site and great info. Got this bookmarked on 4 different computers now.

    Reply
    • Hi James,
      I think I might be experiencing the same problem by purchasing a Chinese knock off thinking it was the AI Thinker. Would you mind explaining how to set the pins in the library to get your board to upload. Which file do you modify, and what pins are re-assigned.
      Any help would be greatly appreciated.

      Reply
  26. Can this be setup to work in the Visual Studio IDE?
    I’ve tried, but I must be missing something because when the ESP32-CAM board boots, I get the following printed on the serial terminal:

    — Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
    — More details at https://bit.ly/pio-monitor-filters
    — Miniterm on COM6 115200,8,N,1 —
    — Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H —

    Reply
  27. So I have used this tutorial off and on since it first came out with various cheap china knock off boards including some of the older ESP-32 CAM-MB boards and this has always worked for me. No other ‘tutorial’ I have found out there has worked this well across the different cheap boards and any issue I come across is easily fixed just by reading the comments first or using the troubleshooting guide you guys have. So I thank you for such a well done tutorial and a well done website overall. I keep coming back to this rabbit hole and this website is where I refresh my memory. Keep up the great work.

    So I just had issue I wanted to point out with no output to the serial monitor using Arduino IDE 2.0. I switched back to the IDE ver. 1.8.57.0 (Windows Store) and didn’t upload the sketch again, just opened the serial monitor on the correct port and hit RST on the esp board and it worked.

    I don’t know why there was an issue yet, but anyone else has issue just use the older, pre-Arduino IDE 2.0.

    Reply
  28. Hello everyone.
    I followed the instructions and it keeps giving me an error. The USB cable is new.

    I am using ESP32-CAM-MB programming

    Somebody could help me?

    Connecting…….._____….._____….._____….._____….._____….._____….._____

    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

    Reply
  29. I wanted to share what I’ve found while working with an ESP32-CAM with an ESP32-CAM-MB board.

    The TLDR version is that the ESP32-CAM-MB board uses DTR and RTS to reboot the ESP and control which mode it boots into. If DTR is on and RTS is toggled on then off, it boots into ‘code upload’ mode. If DTR is off and RTS is toggled on then off, the ESP boots into normal mode. If RTS is on, no output from the serial port is seen.

    You can see this by using GTKTerm on a Raspberry Pi – it allows direct control of DTR/RTS. I was also able to replicate these results by using a short Python program:

    #!/usr/bin/env python3
    import serial
    if name == ‘main‘:
    ser = serial.Serial(‘/dev/ttyUSB0’, 115200, timeout=1, rtscts=False)
    ser.reset_input_buffer()
    ser.setDTR(True)
    ser.setRTS(True)
    ser.setRTS(False)
    while True:
    if ser.in_waiting > 0:
    line = ser.readline().decode(‘utf-8’).rstrip()
    print(line)

    DTR = True – upload mode
    DTR = True – normal boot mode

    Putty on Windows doesn’t work, Termite and the Arduino console does.

    Reply
  30. Can you please help? When I try to run the webcamserver sketch I get the following error message:-

    ELF file SHA256: 965ebea65dd639f6

    E (534) esp_core_dump_flash: Core dump flash config is corrupted! CRC=0x7bd5c66f instead of 0x0
    Rebooting…
    ets Jul 29 2019 12:21:46

    rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff0030,len:1344
    load:0x40078000,len:13836
    load:0x40080400,len:3608
    entry 0x400805f0

    assert failed: do_core_init startup.c:326 (flash_ret == ESP_OK)

    Backtrace: 0x40083b2d:0x3ffe3aa0 0x40090f99:0x3ffe3ac0 0x40096d79:0x3ffe3ae0 0x400e0d4e:0x3ffe3c10 0x40083232:0x3ffe3c40 0x400792ca:0x3ffe3c90 |<-CORRUPTED

    I googled the exact code and came across someone who had the very same. They maintain that the board being used is a single core device and that the Arduino IDE can only accomodate 2 core devices. Is this true? My board is advertised as a 2 core device.
    Another question. We are told to short IO0 to GND when flashing, does this still have to be done when using the extra MB board? By the way, my MB board has only one button, RST.

    Any help would be very much appreciated, I have spent many hours on this now.

    Reply
    • Hi.
      Is that the first time you’re programming that board? You did you upload a code before?
      You might want to erase the ESP32-CAM flash and try again, just in case.

      You don’t need to do that with the MB board.

      Regards,
      Sara

      Reply
  31. Hi together,
    I have the same CAM like the photo shows,
    but the USB-shield is slightly different
    the most conspicuous is that there is no IO0 Button
    and obviously there is also no need to do anything to enter flash-mode
    the sketch could be uploaded without any problem
    fyi

    Reply
    • Hi.
      That’s great.
      Nowadays there are so many different slightly variations that it is difficult to keep up with all the changes.
      Thanks for sharing.
      Regards,
      Sara

      Reply
  32. Hola, yo estoy usando Visual Studio Code, el código se carga correctamente, pero no se visualiza nada en el serial, cargué el código de ejemplo para poder ver la cámara desde la pagina web oficial del esp32cam, pero nunca me muestra la dirección Ip, y estoy seguro que no entra ni siqueira al void setup, porque en las primeras líneas puse: void setup() {
    Serial.begin(115200);
    Serial.println(“PRUEBASSS”);
    Y también ya cargué un código ejemplo de parpadear el flash y ese si funciona bien.
    Usé la placa AI_THINKER.

    Reply
  33. Hi, I have an ESP32-CAM with the ESP32-CAM-MB module I just bought.
    When trying to upload code to it I received the following error: Invalid head of packet (0x69). I was trying to follow the steps of pressing the I0 and the Reset button on the ESP32-CAM-MB module when the connecting message appears on the output window but never worked, it only flashed the flash on the ESP32-CAM.
    The solution turned up to be quite simple, I had an SD-Card in the slot of the ESP and after removing it, the code uploaded without any problems.
    It is a stupid mistake but I spent a little while looking for it so I hope it helps.

    Reply
  34. Please beware of the following, there are ESP32-Cams with different pinouts!!!
    If you by this programmer as set with an ESP32-Cam chances are high that you get an fitting pinout where one of the GND pins is indeed a RESET pin. All others where this pin, the one nearest to the white LED, is only marked as GND and NOT as GND/R are NOT usable with this programmer!
    That really took me a looooooong time to understand.

    Reply
    • Hi.
      Are you using a good usb cable?
      Depending on the board that you’re using you may need to install the CH340 or CP2101 drivers on your computer.
      Regards,
      Sara

      Reply
  35. No matter what I do, buttons pressed, or stand on my head, my code compiles, as soon as it is time to connect. I get

    “A serial exception error occurred: Cannot configure port, something went wrong. Original message: PermissionError(13, ‘A device attached to the system is not functioning.’, None, 31)
    Note: This error originates from pySerial. It is likely not a problem with esptool, but with the hardware connection or drivers.
    Failed uploading: uploading error: exit status 1

    I have the drivers updated, -a-r&w to /dev/ttyS[12340].
    I have changed the port. Tried a simple sketch, reinstalled Arduino, reinstalled ESPtool. I cannot connect to this ESP32 CAM MB board. using the same hardware other than the board itself, I have no issues. I have six of these and they all have the same outcome.

    Reply
    • @David

      I’m thinking there is a good chance you will be able to find a solution at this post:
      github.com/espressif/esptool/issues/879

      Hope it helps

      Reply
  36. Hi RNT team,
    I am wondering how to use any gpio pins of the esp32 cam while using the board, is there any possibilities? I only want to power it via the usb cable and nothing else.

    Please suggest.

    Regards,
    Shariq

    Reply
  37. Sketch uses 253145 bytes (8%) of program storage space. Maximum is 3145728 bytes.
    Global variables use 21120 bytes (6%) of dynamic memory, leaving 306560 bytes for local variables. Maximum is 327680 bytes.
    esptool.py v4.5.1
    Serial port COM6
    Connecting…

    A serial exception error occurred: Write timeout
    Note: This error originates from pySerial. It is likely not a problem with esptool, but with the hardware connection or drivers.
    For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
    Failed uploading: uploading error: exit status 1

    I have been continuously getting this error. can you please help me fix it.
    I have tried restarting PC, changing port, changing usb wire, pressing rest button on Board , upload using programmer option etc.

    Reply
    • Hi.
      Please read the error: Note: This error originates from pySerial. It is likely not a problem with esptool, but with the hardware connection or drivers.
      Make sure you have the required drivers for your boards installed on your computer, usually the ESP32-CAM uses the CP2101 or CH340 drivers.
      Also make sure that the board is properly connected.
      Regards,
      Sara

      Reply
  38. I can’t believe how many people, including myself have been having issues programming these boards (and operating them – the infamous brownout detector issue still pops up from time to time).
    I ordered 3 ESP32-CAM-MB boards from another vendor as Bitluni’s boards were sold out at the time.
    I have tried 2 of the 3 so far. What I found after lots of struggling is that the reset button on these boards doesn’t seem to work.
    I have to press the IO0 button and then press the reset button on the ESP32-CAM board itself, then everything works.

    Reply
  39. Hi, at all.
    no, no, no …. i can solve all your problems !
    Just few minutes for reading…
    OK, lets start, but first i have to say, that i didn’t read the comments at all. Though…
    I’ve bought the combi esp32cam-module + esp32-cam-mb. not original.
    There are TWO different boards which will sell with the esp32-cam-mb !
    Have an eye on the pin near the flashlight.
    It’s a GND-Pin ?
    Sorry, but you never will get it worked with the esp32-cam-mb, never !
    The good news: you can use it stand-alone and you can flash it via usb-ttl and the bridged gndio0 🙂
    It’s a GND/R-Pin ?
    Congratulation! This works bloddy well with the esp32-cam-mb !
    BUT !
    Not under Win11 (didn’t test it under Win10). That means: if you have win11 installed, you are not able to flash the board over web, arduino, esptool …
    If you have an Home Assistant installed on RPI, you are able to flash this combi via Browser (HomeAssistent) by connecting this modul directly on the RPI.
    If you have Win11 installed, a virtual box with win10 should solve your problems…
    If YOU, out there, find a way, to flash this combi esp32-cam (gnd/r) esp32-cam-mb under Win11, PLEASE let me know.
    Many thanks in advance.
    Stay healthy !

    So long
    perlchamp

    Reply
  40. I also have the ESP32-CAM-MB and an ESP32-CAM module where pin 9 is labeled GND. I tried many things to get it to load. What finally worked was the hold-IO0-pin-on-the-MB-while-pressing-reset-on-the-back-of-ESP32-board dance. But it only worked with the SD card slot EMPTY.

    Hope this helps someone.

    Reply
  41. Sir,
    I face some problem in esp-32s module when I run “Camera server” program, it run successfully and server also work But when I capture Image or video streaming it does not work, please guide me how can I do.
    ThankYou

    Reply

Leave a Reply to marco natali Cancel reply

Download Our Free eBooks and Resources

Get instant access to our FREE eBooks, Resources, and Exclusive Electronics Projects by entering your email address below.