ESP-32 Cam flashing (upload code) with just an ESP-01 USB adapter

Hello everybody! As many of you, I started to use ESPHome to create my own domotic devices. First I got a couple ESP-01 relays as a DIY cheap Sonoff solution. One day I discovered the ESP-32 and the possibility to make my own DIY camera:


so I ordered some ESP-32 cam and some mini cameras, but I didn’t know I needed one thing called “FTDI” to upload code.

So I got the code on ESPHome (you can see it at the end of the page) and I tried to use my old ESP-01 WiFi module adapter with USB, using DuPont wires like they do with the TFDI:
U0R -Tx
U0T - Rx
GND -GND
VCC- 3.3V

and I got the same mistake over and over again:

Unexpected error: ESP Chip Auto-Detection failed: Failed to connect to Espressif device: Timed out waiting for packet header

Then I realized I should connect Tx with Tx and Rx with Rx, something like this:
U0R - Rx
U0T - Tx
GND - GND
VCC - 3.3V

And it worked!

Note that unlike using a FTDI programmer where we swap RX and TX, here we connect the ESP8266 TX to the ESP32-CAM TX (as denoted by the blue DuPont) and the ESP8266 RX to the ESP32-CAM RX (as denoted by the yellow DuPont).

Right after that when I connected the ESP-32 CAM to 5V from a phone charger, I got a New Device notification on Home Assistant so I could configure the camera properly on Home Assistant.

I leave the code I use in the ESP-32 cam to make it work:

substitutions:
  hostname: 'camera'
  ssid: 'xxxxxxxxxxxxxxxx'
  password: 'xxxxxxxxxxxxxxxx'
esphome:
  name: $hostname
  platform: ESP32
  board: esp32dev
wifi:
  ssid: $ssid
  password: $password
  fast_connect: True
api:
  reboot_timeout: 0s
ota:
logger:

# ESP32-CAM
esp32_camera:
  external_clock:
    pin: GPIO0
    frequency: 20MHz
  i2c_pins:
    sda: GPIO26
    scl: GPIO27
  data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
  vsync_pin: GPIO25
  href_pin: GPIO23
  pixel_clock_pin: GPIO22
  power_down_pin: GPIO32
  jpeg_quality: 10
  resolution: 640X480
  idle_framerate: 1 fps
  max_framerate: 30 fps
  saturation: 0
  brightness: 1
  contrast: 0
  vertical_flip: true
  horizontal_mirror: true

  name: $hostname

# Flashlight
output:
  - platform: ledc
    pin: GPIO4
    id: gpio_4
    channel: 7
#statuslight
  - platform: gpio
    pin:
      number: GPIO33
      inverted: True
    id: gpio_33   
    
light:
  - platform: binary
    output: gpio_4
    name: $hostname light
#statuslight
  - platform: binary   
    output: gpio_33
    name: $hostname status
    
switch:
  - platform: restart
    name: "${hostname} Restart"    
sensor:
  - platform: uptime
    name: "${hostname} Uptime"
  - platform: wifi_signal
    name: "${hostname} WiFi"
    update_interval: 60s
4 Likes

Update: As many tutorials, I added one fake camera case (about 1€) and 2 DuPont cables for 5V 1A.
Now I have a real camera where everybody thinks it’s a fake one :wink:

You can see the pictures at the top.

Thanks for sharing this. I was stuck with the very same issue. Swapping the Tx and Rx solved the issue.

1 Like