ESP32-CAM AI-Thinker Pinout Guide: GPIOs Usage Explained

The ESP32-CAM is a development board with an ESP32-S chip, an OV2640 camera, microSD card slot and several GPIOs to connect peripherals. In this guide, we’ll take a look at the ESP32-CAM GPIOs and how to use them.

Pinout Diagram

The following image shows the pinout diagram for the ESP32-CAM AI-Thinker.

ESP32-CAM AI Thinker module board Pinout diagram GPIOs name

Schematic Diagram

The following figure shows the schematic diagram for the ESP32-CAM.

Image Source

You can download a PDF file with better resolution on this GitHub repository.

Power Pins

The ESP32-CAM comes with three GND pins (colored in black color) and two power pins (colored with red color): 3.3V and 5V.

You can power the ESP32-CAM through the 3.3V or 5V pins. However, many people reported errors when powering the ESP32-CAM with 3.3V, so we always advise to power the ESP32-CAM through the 5V pin.

Power output pin

There’s also the pin labeled on the silkscreen as VCC (colored with a yellow rectangle). You should not use that pin to power the ESP32-CAM. That is an output power pin. It can either output 5V or 3.3V.

In our case, the ESP32-CAM outputs 3.3V whether it is powered with 5V or 3.3V. Next to the VCC pin, there are two pads. One labeled as 3.3V and other as 5V.

ESP32-CAM Camera AI Think Module VCC Power Pins

If you look closely, you should have a jumper on the 3.3V pads. If you want to have an output of 5V on the VCC pin, you need to unsolder that connection and solder the 5V pads.

Serial Pins

GPIO 1 and GPIO 3 are the serial pins (TX and RX, respectively). Because the ESP32-CAM doesn’t have a built-in programmer, you need to use these pins to communicate with the board and upload code.

The best way to upload code to the ESP32-CAM is using an FTDI programmer.

Learn how to upload code to the ESP32-CAM AI-Thinker.

You can use GPIO 1 and GPIO 3 to connect other peripherals like outputs or sensors after uploading the code. However, you won’t be able to open the Serial Monitor and see if everything is going well with your setup.


GPIO 0 determines whether the ESP32 is in flashing mode or not. This GPIO is internally connected to a pull-up 10k Ohm resistor.

When GPIO 0 is connected to GND, the ESP32 goes into flashing mode and you can upload code to the board.

  • GPIO 0 connected to GND » ESP32-CAM in flashing mode

To make the ESP32 run “normally”, you just need to disconnect GPIO 0 from GND.

MicroSD Card Connections

The following pins are used to interface with the microSD card when it is on operation.

MicroSD cardESP32
DATA1 / flashlightGPIO 4

If you’re not using the microSD card, you can use these pins as regular inputs/outputs. You can take a look at the ESP32 pinout guide to see the features of these pins.

All these GPIOs are RTC and support ADC: GPIOs 2, 4, 12, 13, 14, and 15.

Flashlight (GPIO 4)

The ESP32-CAM has a very bright built-in LED that can work as a flash when taking
photos. That LED is internally connected to GPIO 4.

That GPIO is also connected to the microSD card slot, so you may have troubles when trying to use both at the same time – the flashlight will light up when using the microSD card.

Note: one of our readers shared that if you initialize the microSD card as follows, you won’t have this problem because the microSD card won’t use that data line.*

SD_MMC.begin("/sdcard", true)

* we found that this works and that the LED will not make that flash effect. However, the LED remains on with low brightness – we’re not sure if we are missing something.

GPIO 33 – Built-in Red LED

Next to the RST button, there’s an on-board red LED. That LED is internally connected to GPIO 33. You can use this LED to indicate that something is happening. For example, if the Wi-Fi is connected, the LED is red or vice-versa.

That LED works with inverted logic, so you send a LOW signal to turn it on and a HIGH signal to turn it off.

You can experiment uploading the following snippet and see if you get that LED glowing.

void setup() {
  pinMode(33, OUTPUT);

void loop() {
  digitalWrite(33, LOW);

Camera Connections

The connections between the camera and the ESP32-CAM AI-Thinker are shown in the following table.

OV2640 CAMERAESP32Variable name in code

So, the pin definition for the ESP32-CAM AI-Thinker on the Arduino IDE should be as follows:

#define PWDN_GPIO_NUM  32
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM  0
#define SIOD_GPIO_NUM  26
#define SIOC_GPIO_NUM  27
#define Y9_GPIO_NUM    35
#define Y8_GPIO_NUM    34
#define Y7_GPIO_NUM    39
#define Y6_GPIO_NUM    36
#define Y5_GPIO_NUM    21
#define Y4_GPIO_NUM    19
#define Y3_GPIO_NUM    18
#define Y2_GPIO_NUM    5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM  23
#define PCLK_GPIO_NUM  22

Learn how to program and build 17 projects with the ESP32-CAM using Arduino IDE DOWNLOAD »

Learn how to program and build 17 projects with the ESP32-CAM using Arduino IDE DOWNLOAD »

Wrapping Up

We hope you’ve found this guide for the ESP32-CAM GPIOs useful. If you have any tips or more info about the ESP32-CAM GPIOs, write a comment below.

We have several projects with the ESP32-CAM that you may like:

Thanks for reading.

Build Web Server projects with the ESP32 and ESP8266 boards to control outputs and monitor sensors remotely. Learn HTML, CSS, JavaScript and client-server communication protocols DOWNLOAD »

Build Web Server projects with the ESP32 and ESP8266 boards to control outputs and monitor sensors remotely. Learn HTML, CSS, JavaScript and client-server communication protocols DOWNLOAD »

Recommended Resources

Build a Home Automation System from Scratch » With Raspberry Pi, ESP8266, Arduino, and Node-RED.

Home Automation using ESP8266 eBook and video course » Build IoT and home automation projects.

Arduino Step-by-Step Projects » Build 25 Arduino projects with our course, even with no prior experience!

What to Read Next…

Enjoyed this project? Stay updated by subscribing our newsletter!

89 thoughts on “ESP32-CAM AI-Thinker Pinout Guide: GPIOs Usage Explained”

  1. im really happy that you have started including more and more esp32-cam stuff.. its documentation is really difficult to understand, and you must spend many hours for the simplest things..

  2. 1. Other useful pin would be number 33: it’s internally attached to a little red led placed at the backside of the module. Define it as output [pinMode(33, OUTPUT)] and set it to low to light it up [digitalWrite(33, LOW)]. While it’s not an externally accesible pin, it is very useful to indicate, for instance, that wifi connection is alive, or that ESP is trying to establish it, etc.

    2. In order to free pin12 and pin13 (provided you wouldn’t need them for a very demanding SD card usage) you can modify ESP32-CAM fuses like this:
    (from Terminal window) $ –baud 115200 –port **your_USB_port_name** set_flash_voltage 3.3V
    and then include in your Arduino code:
    SD_MMC.begin(“/sd”, true);
    When you set the second initializer attribute to ‘true’ you’re saying that SD card will run in ‘1-line’ mode. This apparently suggests that SD card would continue to be accessible in a slower or less versatile mode, but I have not tested it.
    Anyway, after that code line, you can use pins 12 and 13 like any other I/O pin. I’ve done it, and it works.

    • Hi Norberto.
      Thank you so much for sharing that.
      I’ll add that information to this article.
      Thanks again.

  3. I cannot figure out how to use RTC pins to wake from deep sleep by applying logic level voltage . I’ve tried all of them and I’ve tried changing the gpio level from low to high without success. Using a simple switch to take an rtc pin to ground will work but if I try that with a PIR or transistor arrangement I get a cycle of wakeup take, photo and sleep about every 10 seconds. The g
    RTC gpio pins seem to float high at logic level (3.3v). I feel like I should be able to pull the pins down in software but cannot figure out how without affecting the SD card or camera.
    I’m using an AI thinker model (or clone) just like in this article. Following your many guides trying to save an image to SD and send it over wifi to email, triggered by a basic Pir. I can get everything to work individually and combine sleep, capture, SD and email fine but can’t get the wake by rtc with logic level to work.

    Any help is greatly appreciated. I’m new to arduino and microcontrollers and I find your blog to be extremely helpful so thank you both for all the time and effort you put in.


    • Hi Dennis.
      If you’re using the microSD card, the only pin that lefts is GPIO 16 and that GPIO is not an RTC pin, which means it can’t be used to wake up the ESP32.
      Do you really need to save your photos to the microSD card?
      If you don’t use the microSD card, you can use the other pins. For example, GPIO 13.

      We have a project that takes a picture when motion is detected and sends it via email. The photo is temporarily saved in SPIFFS. Then, the ESP32-CAM goes to sleep. It is awakened by the PIR motion sensor that is attached to GPIO 13.(the project is not published, it is part of our new eBook:

      We also have other project that uses external wake-up with the PIR, that uses deep sleep and sd card:
      I hope this helps.

  4. Sarah,

    Thank you for the helpful reply and again for the wonderful resource y’all provide. You have been an asset to me as a beginner in arduino/esp devices and coding.

    I’ve solved the problem, rookie mistake on my part. I had checked my wiring several times and thought it was solid but after rebuilding it on a breadboard i got it working without issue. Seems i had a bad transistor that was not switching to allow the current to bring GPIO13 to ground. Fixed that and its working great.

    I have no issue using your code for the PIR motion capture to SD and combining it with your code for sending email (also helped by BnBe’s similar post at Combining all together I can use a PIR on GPIO13 (of an AI Thinker clone ESP32-Cam, which looks identical to the one in the photo at the top of this article, bought on amazon from KeeYees). I am using a different PIR from the one you use in your other article. Mine looks identical to the HC_SR501. I have everything wired exactly as your other post using a 2N222 transistor. The ESP32 and PIR are wired to a regulated 5 volts and everything works great. I did find that I got better performance with the PIRs jumper set to L rather than H.

    I have had no issue waking form deep sleep using GPIO 13 and I have tried pin 12 as well with success. I don’t know if those are RTC for sure (I cannot seem to find much documentation on that) but I thought only RTC pins would allow wake up.

    Your code is very fast and works great compared to a few others that I have tried. So great job and thanks!! I love that I can have this setup as a motion capture that saves to SD no matter what but also will email me if its connected to my WiFi. I will be using these as a wildlife trail camera and the first one is working great just testing around my house. I’ve removed the IR filter from the camera lenses and plan to setup a small IR LED array that will come on when the camera wakes and go off at sleep. Obviously that requires more bits but a quick test with a couple LEDS in my home is promising if I can power them efficiently.

    Sorry this is a little more geared toward a few of your other posts but I appreciate the guidance and encouragement. I also apologize for the long post. I’m still curious of a definitive answer regarding the RTC pins on these modules while using the SD also. This article mentions 16 as UART and not RTC while 2,4,12,13,14,15 are RTC. Regardless, i know 12 and 13 will allow wake from deep sleep.

    Last, if I may make a suggestion here for future tutorials… as a beginner with these modules and their coding I would love to see info regarding the timing of when certain parts of code should be in the setup and loop sections. For example, if I were to have a pin on the ESP trigger a light before the camera captures the image, how would I time that to happen? No need to answer here, just a general idea of what I mean by timing. As a newbie I can often figure out what sections of code are doing (thanks largely to your great tutorials) but they don’t always seem to have a logical order compared to when things happen.

    Thanks again and best!

    • Hi Dennis.
      I’m gad everything is working now.
      To learn more about RTC GPIOs, you can read our ESP32 Pinout guide that also applies to the ESP32-CAM:
      When using the microSD card, you don’t have much options left.
      Thank you for your suggestions. We’ll definitely create more tutorials with the ESP32-CAM.
      Thanks for following our tutorials.

  5. I have one doubt about the GPIO4 (flash pin).

    In my last experiments using the ESP32_CAM, I tryed to turn the flash off, but no matter the configuration I used in setup(), everytime that the ESP32-CAM took a picture it lit the flash.

    In my setup() function, I tryed using ‘pinMode(4, INPUT)’ and ‘pinMode(4, OUTPUT)’, but the result was the same.

    How I disable the Flash?

    • Hi.
      You should initialize your microSD card as follows (if it is used):
      SD_MMC.begin(“/sdcard”, true)

      instead of


  6. Hello.
    Regarding the flashlight GPIO4, the issue there is that you have a voltage divider that drops voltage over the flash LED’s transistor base. Look at R11, R13 and R12. The voltage divider creates an output voltage of ~0.6V, enough to drive some current through the transistor. If you don’t need the SD card, you can remove the R11 resistor to stop this flow.
    I tried this in order to obtain a low power WiFi camera over battery, that wakes from time to time and takes a photo and then it sends it over email. Until now, I didn’t manage to obtain a sub-milli ampere consumption, I get about 2-4 mA, but I suspect that the boards design is not optimal for low power. I also replaced the AMS1117 with ADP3338AKCZ-3.3RL7 which is better for quiescent current, but with no great success. Any ideas on getting the best low power current consumption with this board?
    Thank you for the tutorials.


  7. Hello, Thanks for the awesome article. I need to know about the project PIR+ESP32 CAM + email pic and SD card storage. If I just need that ESP32 CAM takes a pic after motion detection. Means not using deep sleep, just doing by an interrupt. I am asking this because I have to subscribe the ESP32 CAM module by MQTT. And as per my knowledge, if ESP32 CAM goes to sleep mode then it is very much hard to subscribe it by MQTT. SO what changes I have to make in the program?


    • Hi.
      With the ESP32-CAM, if you don’t use the microSD card, I would suggest that you try the following GPIOs: 2, 14, 15, 13, 12 and 16.
      I haven’t tried that sensor with the ESP32-CAM. So, I’m not sure if it will work well on those pins.

  8. Hi
    Thank you so much for all the info and tutorials, they really helped me out a lot. I’m still new to all this and thus am having trouble with setting the shutter speed. I need a lower shutter speed than the one used by default but I’m unable to find the settings in any codes. Is it even possible? based on OV2640 datasheet, it seemed possible but I couldn’t find the pins anywhere. Can you help me with this issue if possible?
    Regardless, I’m still thankful for all those instructions 🙂

  9. Hi there, I tried using GPIO16 for a button and found it almost always crashed my ESP32-CAM board. After a lot of head scratching I looked at the circuit diagram and it’s shown connected to PSRAM.

    I would not continue to recommend using it as an extra input.

    • Hi Nick.
      I don’t think GPIO 16 is connected to PSRAM.
      In the diagram, GPIO 16 is connected to U2RXD. GPIO17 is connected to PSRAM, which is right above the GPIO16.
      I’ve used GPIO 16 with a pushbutton in a project that takes photos when the button is pressed.
      The button worked when I connected it with a 10kOhm pull up resistor.
      This means that when the button is not pressed the GPIO state is HIGH and when you press it, it is LOW.
      I hope this helps.

      • In the diagram, GPIO16 is a CS# of PSRAM. See the schematic above. If it is used as input, you can easily enter a boot loop.

        It is forced to the output mode and high. I was trying to connect PIR module there, and I badly failed.

        Actually, there are no really free pins. Even worse, GPIO4 is shared between SD slot and LED flash, so if you use SD, LED ocasionally flashes.

        If you are not using serial port, you can repurpose serial pins.

        If you are not using SD slot, you can repurpose SD pins.

        If you are not using camera, you can repurpose camera pins.

        • Hi.
          You’re right about the PSRAM. Thanks for your comment.
          However, as I’ve wrote in the previous comment, it worked well to take a photo when pressed a button. But I haven’t tried with an interrupt.

          • Short-circuiting the GPIO 16 to the ground would enforce it to be set to low, however driving it with the output of the PIR doesn’t work.

        • That goes pretty well with my observations. I believe Stanislav’s comment should be added directly into the guide.

          • I agree — it would be very good to have some ink on GPIO16 in the guide! The guide sent me down the rabbit hole of attempting to use GPIO16 for PIR detection. In another tutorial at RNT, the effect of the PIR was inverted using a transistor so that when the PIR output is high, it drives the pin LOW (to ground). Given Sara’s observation, this might work for GPIO16. Also the other guide should be explicit with regard to why the transistor was used. Other guide:

  10. Your work is amazing, thanks a lot.
    I have a trouble using builtin_led until i changed “pinMode” to “digitalWrite”.

    void loop() {
    digitalWrite(33, LOW);
    digitalWrite(33, HIGH);

  11. Hi Sara,

    You say in the tutorial that you can use the MicroSD card pins for GPIO when you’re not using the card. That is incorrect — if you plan to use the CAMERA in anything OTHER than the lowest resolution, you won’t have enough memory (or you’ll cause a guru panic/core dump). There is a small ESP PSRAM64H (or IPUS6406L) 64Mbit (8mb) SPI CMOS ram chip attached to the SPI bus.

    The arduino camera drivers automatically enable it and basically require it — the board itself only has 320k ram and that’s insufficient with Arduino + webserver + anything to move to higher resolution images.

    I literally spent about two weeks of my life discovering this.

    If you look on the esp32-cam, on the pin header (chip side) adjacent to the LMS1117 3.3v regulator, on the other side of the RST button you’ll see an SOT8 IC which is attached to the SPI bus/pins.

    • The microSD card is not the same as PSRam chip. You don’t need an microSD card to use the camera at full resolution. Indeed if you don’t need to use the microSD slot (for example to store image files on a card), you can use two more pins for IO, and the camera will still work at full resolution.

  12. Hi Sara,
    I should have read all the comments before spending two days wondering why the call to frame2bmp() crashed my IA thinker module ! I did connect GPIO 16 to a RS485 serial module and I eventually found that this pin was used by frame2bmp(), probably accessing the PSRAM. I could clearly see the I/O on the serial analyzer.
    I now use GPIO 13, GPIO 14 & GPIO 15, and it works much better, even if I can no longer use the SD Card… As started by Stanislas, could you please warn the user about GPIO 16 & PSRAM ?
    Thanks again for this nice set of articles !

  13. Further to the freeing up of io pins when using an sd card using 1 bit mode.
    i.e. “SD_MMC.begin(“/sdcard”, true)”

    I have found that to use pins 4, 12 and 13 you need to define them as input or output after you have enabled the sd card, otherwise it removes any previous assignment and stops them working.
    e.g. I am successfully using all 3 pins of these pins as well as an sd card in this sketch:

    btw – It may be possible to use extra io pins by soldering direct to the esp32-s module (possibilities 16, 17, 9, 10, 11, 6, 7, 8)

  14. Hi, can I expand more GPIO for TX and RX ? like Ublox GPS module, in the article that you can use the MicroSD card pins for GPIO when you’re not using the card. can you give example or i must remove the SD Card slot?


  15. Thanks for this cuide, Sara.
    I’m testing cheaps esp32 cam (chineses) and for now runs ok. I can active flash, webserver, wifi,led… All works.
    But, im triying to use a device with SPI. Does anyone use SPI with this device? I spend soné days with no luck.
    Thanks again.

    • Hi.
      I have not tested SPI with the ESP32-CAM.
      If you’re using the microSD card, you won’t have pins left to use SPI.
      Nonetheless, I’m not sure because I haven’t tried it.

  16. Hey Sara,

    I have used the WiFIManager previously for the ESP8266 which provides the ability to set the SSID and PASS through APConnect. Do you know if there are any libraries out there that provide the same functionality for the ESP32-CAM?

  17. Hi Sara,
    how high is the max current which can be drawn from the VCC pin? Can I use the 3,3V pin instead of the VCC pin to output power? Can I draw more power from the 3,3V pin than from the VCC pin? Bests Andre

  18. I would like to use 8 Input pins to connect a keypad. Can I use a I2C IO expander like the PCF8574 and still use all the hardware of the ESP CAM board?

  19. I have been consistently using GPIO33 to analogRead an LDR voltage divider after removing LED1 and soldering a wire from the GPIO33 pin.

  20. Hi,

    did anyone tried using, for example MPU6050, with ESP32 CAM connecting it to SCL and SDA of the camera (GPIO27 and GPIO26)? Does ESP32 communicate with camera only during configuration or also when recording?


    • Hello Gabrijel,

      we have used two FPC connectors, cf:
      to make a derivation of sda/scl and it seems to work 🙂

  21. Hi I thought I’ve already posted my comment.

    Quick question, can you extend the ports as you can with other dev boards?
    Also, can you add 2 way audio to it?


    • Hi.
      Yes, I think you can expand the ports using a GPIO expander.
      I haven’t experimented with audio. But, I think you would need the DAC pins (GPIO25 and GPIO 26) that are not available on the ESP32-CAM.

  22. Thank you for the reply Sara. Do you know if other pins can be used for DAC?? Alternatively, if a full esp32 board has the dac pins, do you know if a camera can be added? Or would it be best to have a full esp32 dev board and esp32 cam board working together?

    Thanks a lot!

    • Hi.
      I don’t think other pins can be used for DAC, but I’m not certain.
      I think you can connect a camera to a “normal” ESP32 board, but I haven’t tried it.
      To make things simpler, it would be better to use a normal board and an ESP32-CAM.

  23. Hii….
    Which pins are SDA and SCL?
    Where i can find in ESP32 Cam board?
    I need to connect OLED display and MLX90614 temperature sensor.
    According to the data sheet GPIO 26,GPIO 27 are the I2C pins.
    But, where i can find those pins?
    Your help is appreciated!

  24. Hi… thanks for all of the great articles!
    Just wanted to let you know someone stealing your content and passing if off as their own.
    Here is the URL: (…)

    • Hi.
      Thanks for letting us know.
      We already tried to contact the owner of that website before.
      Unfortunately, there is nothing more that we can do.
      If you find our content in any other place, let us know.

  25. I’m trying to connect a RWLC-1506 so that the ESP32-CAM (AI Thinker) can take a picture when it detects motion. I’ve connected the RWLC to different pins, including 13 and 16, but the ESP32-CAM always crashes in the esp_camera_init function:

    Guru Meditation Error: Core 1 panic’ed (IllegalInstruction). Exception was unhandled.
    Memory dump at 0x400d1664: ffffffef ffffffff ffffffff
    Core 1 register dump:
    PC : 0x400d1668 PS : 0x00060130 A0 : 0x800d202e A1 : 0x3ffb1f80
    A2 : 0x3ffc09a4 A3 : 0x3ffc0962 A4 : 0x00000020 A5 : 0x80000020
    A6 : 0x00000003 A7 : 0x00060823 A8 : 0x800d1464 A9 : 0x3ffb1f60
    A10 : 0x00000006 A11 : 0x40081158 A12 : 0x00000001 A13 : 0x3ffc0b54
    A14 : 0x3ffb1f1c A15 : 0x3ffb1f1c SAR : 0x0000001a EXCCAUSE: 0x00000000
    EXCVADDR: 0x00000000 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xffffffff

    Backtrace: 0x400d1668:0x3ffb1f80 0x400d202b:0x3ffb1fb0 0x4008ce1d:0x3ffb1fd0

    Any suggestions appreciated!

    • You can’t 🙂

      I got the same issue and found the explanation here (with the solution) =>

      Basically, you’ll need to play with:
      esp_err_t err = gpio_isr_handler_add(PIN_MOTIONSENSOR, &detectsMovement, (void*)PIN_MOTIONSENSOR);
      if (err != ESP_OK) {
      Serial.printf(“handler add failed with error 0x%x \r\n”, err);
      err = gpio_set_intr_type(PIN_MOTIONSENSOR, GPIO_INTR_POSEDGE);
      if (err != ESP_OK) {
      Serial.printf(“set intr type failed with error 0x%x \r\n”, err);

  26. Hi! First thank you for creating such an amazing ESP32-Cam product!

    I’ve a question about how you have tied the 3V3 and 5V lines together in parallel to produce your output voltage on header pin 4 (P_OUT). (See the 2 resisters under Header 8 P1 on your schematic)

    Wouldn’t this connection be pulling the lower 3V3 volts up to 5V? How does the 0R resistors prevent this? I am trying to learn and better understand this? Wouldn’t you want a diode to prevent this back-flow?

    Thank you in advance!

    • Hi Randy.
      The ESP32-CAM was not developed by us.
      We’re just trying to compile information so that people can better understand how it works.

  27. Hi…
    Is there any way to add more pins?
    I tried with PCO8574 but it is not good for the servo.
    I need a more general one.
    Basically I would also like it in esp32-cam with more pins.
    …thanks for all lessons!!!


  28. How do I connect a pca9685 board to Esp32-cam? To be specific, I want to know which pins to use and how to write the code. PCA9685 works on I2C bus.

  29. Hii,
    I need to read analog values from esp32 cam, that is analog pH sensor values from it, can u share me a snippet or code.
    Thank you in advance.

  30. Hello! I am new in PCB Design

    I want to ask something, why sd card supplied with 3.3 volt on the data pins? Furthermore when you have in the schematic an input from esp32s to sd card for example HS2 data3 to pin 2 of sd card I should connect it after the resistor?

  31. Hello,
    About this : * we found that this works and that the LED will not make that flash effect. However, the LED remains on with low brightness – we’re not sure if we are missing something.
    I think that things will be ok if you un-solder R11 (47k). This pull-up is unused if SD card is put in SPI mode, but it creates a small current in the base of Q1, which is responsible of the low brightness of FLASH LED.

  32. Hi everyone,
    I want to ask everyone is there anybody who uses gpio interrupt and camera_init() at the same time? I get this error when I write attachInterrupt() and camera_init() respectively at the setup():
    [E][camera.c:1327] camera_init(): gpio_install_isr_service failed (105)
    [E][camera.c:1406] esp_camera_init(): Camera init failed with error 0x105

    As I write these vice versa:
    WiFi connected
    Starting web server on port: ’80’
    Starting stream server on port: ’81’
    Camera Ready! Use ‘’ to connect
    Guru Meditation Error: Core 1 panic’ed (LoadProhibited). Exception was unhandled.
    Core 1 register dump:
    PC : 0x401606b3 PS : 0x00060530 A0 : 0x800d2e86 A1 : 0x3ffb1ea0
    A2 : 0x00000000 A3 : 0x00000000 A4 : 0x4008137c A5 : 0x00000000
    A6 : 0x3ffc2e68 A7 : 0x3ffb0060 A8 : 0x8013db9a A9 : 0x3ffb1e50
    A10 : 0x00000105 A11 : 0x0000040e A12 : 0x00000000 A13 : 0x00000000
    A14 : 0x4008137c A15 : 0x00000000 SAR : 0x00000014 EXCCAUSE: 0x0000001c
    EXCVADDR: 0x00000000 LBEG : 0x4008d6fd LEND : 0x4008d70d LCOUNT : 0xffffffff

    ELF file SHA256: 0000000000000000

    Backtrace: 0x401606b3:0x3ffb1ea0 0x400d2e83:0x3ffb1ec0 0x400d2ee1:0x3ffb1ef0 0x400d114d:0x3ffb1f10 0x400d394e:0x3ffb1fb0 0x4008ff8e:0x3ffb1fd0


    and then rebooting and rebooting again…


    who knows stopping camera_init() or usage of camera_deinit()??

    Thanks in advance,


  33. Hi there,

    Thank you so much for all the amazing tutorials. I’ve learned so much thanks to your hard work.
    As mentioned before on this topic, Pin 16 is indeed connected to #CS of the PSRAM.
    As long as you don’t take a picture this pin can be used for a button pulled to GND.
    After a picture is taken, this pin will more or less random switch from low to high after that.

    I don’t expect anyone to solve this, but it might be interesting for future users.

    Please keep up the great work,
    you really did a spectacular job sofar!

    Kind regards,

  34. I want to use it as a flash when taking pictures using pin 4, but I can’t find the relevant source.
    I’m new to Arduino and I’m referencing the sources of many experts.
    please help

  35. Hi
    I have a problem when I’m using esp32 cam. I upload the sketch but when I open the browser to see the image, the image is corrupted even when I reduce the quality. how can I fix it. I use a power supply that can produce at least 2 amper.

  36. Just to answer my own question – I have the ESP-Prog device, and I can now debug with JTAG, interact across Serial, and upload new FW. So it support debugging via JTAG.

  37. I will use this camera in a place where I can’t reach it easy.
    So, I added some watchdogs:
    * Check if WiFi is still active
    * Check if ping is lower than 400ms
    * Check if ping is higher than 0.1ms
    When they fails I restart : ESP.restart();

    But very often the camera was not found after the restart.
    My first idea was to trigger a reset of the camera, but the ping CAM_RST is just connected to an power on reset circuit.
    But the camera had a second internal power on reset check. The external PWDN (power down) will check if the power supply (CSI_2.8V and CSI1.2V) are high enough.
    This pin is also not reachable from GIOP. But this can be triggered when the power supply (CSI_xx) went down.
    The GIOP32 drives Q2 which powers the CSI voltage regulators.
    To switch off the CSI voltage, just set the GOIP32 to High: digitalWrite(32,HIGH);
    After doing this the ESP.restart(); will done.
    Since using this, the camera module always come back.

    Comments are welcome.
    See below the code.


    float last_time_ms=0;
    float avg_time_ms=0;
    int WifiCount=0;
    bool ret;

    void setup() {
    pinMode(33, OUTPUT); //Rote LED
    pinMode(4, OUTPUT); //Blitzlicht
    pinMode(32, OUTPUT); //Camera Power

    void loop() {

    if (WiFi.status()!= WL_CONNECTED){
    Serial.println(“Reboot because of lost WiFi”);

    ret =;
    avg_time_ms = Ping.averageTime();
    if ((avg_time_ms+last_time_ms)>400) {
    Serial.println(“Reboot because of high Ping”);

    if (avg_time_ms>last_time_ms) {
    last_time_ms = avg_time_ms;

    if (avg_time_ms <=0.10) {
    Serial.println(“Reboot because of low Ping”);

  38. I have been having issues recently with all 3 of my esp32cams in that after a period of time they freeze. I am in timelapse mode taking a pic every 30 secs then uploading to my host server. Between pics deep sleep mode is enabled. The freezing occurs randomly anywhere between 10 minutes and 12 hours. After a board reboot it will start working again. The SD card is not enabled neither is the flash.

  39. Hello Sara,

    I am totally stuck. I have been through all the troubleshooting and I have installed and re-installed Arduino twice. In addition to the esp8266 and ESP32 board definitions. I cannot get my board to accept a sketch upload. I have simplified the code down to the pin33 led blink and nothing. I purchased two cameras with the esp32-cam-mb usb programmer to make it as simple as possible. Or so I thought. The product name is ‘Aideepen ESP32-CAM WiFi Bluetooth Board ESP32-CAM-MB Micro USB to Serial Port CH340G with OV2640 2MP Camera Module Dual Mode’. It looks exactly like the AI Thinker but without the AI Yhinker under the DM ESP32-S.

    Any help or insight is greatly appreciated.

    Thank you very much for your time.

      • Thank you so much for the quick response.

        I get the following error:

        c:/users/tplummer/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: cannot find crt1-sim.o: No such file or directory
        c:/users/tplummer/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: cannot find _vectors.o: No such file or directory
        collect2.exe: error: ld returned 1 exit status
        exit status 1
        Error compiling for board AI Thinker ESP32-CAM.

        • Hi.
          That’s a weird error.
          Try to uninstall arduino ide and delete all installation related files and then install again.

        • This is a problem with your Arduino packages. Uninstall Arduino, and also all the libraries you have installed with it

          Delete this folder


          Then install Arduino IDE again, and add the espressif ESP32 using the board manager. You have the right version of the esp32 installation – its just that your paths are messed up. Did you move the arduino IDE project – or install the package manually before somewhere else ?

          When you do a build for a esp32 example – check the following folder


          make sure you have a load of executables in there.


Leave a Comment

Download our Free eBooks and Resources

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