ESP32 Cam programming without Adapters!


How to program ESP32cam with an Arduino UNO?


I recently bought an ESP32cam model from Banggood for a very low price at just $4. Well, that was an exiting deal and I knew it was certainly calling me to buy it. I have always wanted a portable streaming module with fewer wires and compact. Using OV7650 module is a mess with Arduino and damn! those wires look like they are inviting a spider within its mesh.

Here, have a gaze at the beautiful ESP32cam with Wifi and a low-quality camera.

Now run to your hobby store and grab an Arduino Uno. Yes, I didn't want to spend extra bucks for FTDI programmer. Better buy the Uno version with swappable IC as we have to remove the Atmel IC from it or else our programming will be a mess.

Open Arduino IDE. Click File and go to Preferences option. Then in the text are on the lower side of dialogue box where it says> Additional Board Managers URL, paste the following: 
https://dl.espressif.com/dl/package_esp32_index.json

Here is a screenshot of that.


Once done, click Tools> Boards> Board Manager and search for "esp32". Click on the latest version to install and wait for an eternity if your connection is poor. My version of ESP32 for this post was 1.0.2. 



Once completed with the above installation, we can move ahead with the circuit section. Follow the below circuit "strictly". I'll explain the reason of being strict here. Remember to remove your Atmel IC from Arduino UNO.




After completing the circuit, head to Files> Examples> ESP32> Camera> CameraWebServer. Everybody's ESP32 can be different. I chose the model of AI Thinker. To know your model, check back on the metal casing of ESP32 to know your model. 

In the code, add the SSID of the wifi you use with its password. ESP will connect with this wifi to stream video. Now connect your Arduino with the cable and check for the following settings.


  • Board: ESP32 Wrover Module
  • Flash Mode: QIO
  • Flash Frequency: 40MHz
  • Partition Scheme: Huge App (3MB No OTA)
  • Upload Speed: 115200
  • Core Debug Level: None
  • Port: <Select the port connected to Arduino>
  • Programmer: AVR ISP


Now HIT it!!! and upload the program. The window will show the program burning onto ESP as per below screenshot


Keep scrolling until you see 100%. A message will get printed on the console saying "Leaving Hard Resetting via RTS pin...". (In the circle in the above image). At this moment, remove the IO-0 pin from the ESP32cam and then open the serial monitor with baud rate at 115200. After opening the serial monitor click on the RESET button of your ESP32cam.  A message will appear as per below image.


You will get the IP address of your WebStream. Copy the IP address and paste it on the address bar of any browser.

Possible Error:
After resetting, you are getting a series of dots and the message "Wifi connected" is not getting displayed. In this case, change your wifi router with which ESP wants to connect. This is majorly because of the security issue. I use my mobiles HotSpot. Avoid iPhones here.

Possible Error:
Brownout detector issue.
In the setup of your code, paste the following:

void setup(){
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);

At the top include the below code:

#include "soc/soc.h"
#include "soc/rtc_cntl_reg.h"

If successful, you would get a window with the IP address like this below.


Enjoy your stream !!.

Comments

  1. I'll try as per steps given

    ReplyDelete
  2. esp 32 is work by 3.3v. Don't RX and TX from arduino crash my esp??

    ReplyDelete
    Replies
    1. Nope, It's because the board has onboard regulator which manages this. I have myself tried it and it has been working till date as my security camera in my room.

      Delete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Hi, Can we use ESP32-Cam without camera module? I mean for motor controlling?

    ReplyDelete
    Replies
    1. The latest board definitions have the AI thinker ESP32cam modile listed in the boards manager.

      I got mine working using that and selecting the appropriate camera at the top of the sketch:

      ```

      // Select camera model
      //#define CAMERA_MODEL_WROVER_KIT
      //#define CAMERA_MODEL_ESP_EYE
      //#define CAMERA_MODEL_M5STACK_PSRAM
      //#define CAMERA_MODEL_M5STACK_WIDE
      #define CAMERA_MODEL_AI_THINKER
      ```

      Delete
    2. Yes, it's an ESP32 microcontroller, with extras.
      Any regular ESP32 code should work.

      (depending on the motor setup, you're likely to need additional control/power management circuits, but that's the same with pretty much any microcontroller.)

      You can (of course) buy ESP32 development boards that don't have the Camera or SD card interface built in - some are a bit cheaper than the ESP32cam module.

      Delete
  5. please help me its urgent while pressing reset button it says

    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:2
    load:0x3fff0018,len:4
    load:0x3fff001c,len:1100
    load:0x40078000,len:9232
    load:0x40080400,len:6412
    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

    ReplyDelete
    Replies
    1. Try to plug out the cable and replug it and restart.

      Delete
    2. Could you help me, because I have the same problem

      Delete
    3. The latest board definitions have the AI thinker ESP32cam module listed in the boards manager.

      I got mine working using that and selecting the appropriate camera at the top of the sketch:

      ```

      // Select camera model
      //#define CAMERA_MODEL_WROVER_KIT
      //#define CAMERA_MODEL_ESP_EYE
      //#define CAMERA_MODEL_M5STACK_PSRAM
      //#define CAMERA_MODEL_M5STACK_WIDE
      #define CAMERA_MODEL_AI_THINKER
      ```

      Delete
  6. Can it be done without removing the Atmel IC?

    ReplyDelete
    Replies
    1. Ahh a curious question.
      Well I haven’t tried it. But I guess it won’t work. It will try to program Atmel first instead of ESP

      Delete
  7. [E][camera.c:1049] camera_probe(): Detected camera not supported.
    [E][camera.c:1249] esp_camera_init(): Camera probe failed with error 0x20004
    Can you help me ? I have this error and don't know how to rectify it. All the connetions are according to the pic in the site.

    ReplyDelete

Post a Comment