Flashing the ESP32-CAM
What you'll learn
- How a board without USB is programmed through a USB-TTL adapter
- How to put an ESP32 into download mode by hand
- Why the first upload should erase the whole flash
The ESP32-CAM has no USB port, so you program it through the USB-TTL adapter. In the tested setup the adapter stays connected afterwards: it powers the camera board and gives you its debug console.
Wire the adapter
Section titled “Wire the adapter”Unplug the adapter from the computer first.
Hover over, focus or tap a wire to see where it goes.
Schematic only: each board shows just the pins in use, not in their physical order. Always match the labels printed on your board. Dashed wires are not yet tested.
| From | To | Signal | Notes |
|---|---|---|---|
| USB-TTL adapter5V | ESP32-CAM5V | Power (5V) | In the tested setup this is the CAM's only power supply. The DevKit's 5V is not connected to the CAM. |
| USB-TTL adapterGND | ESP32-CAMGND | Ground | |
| USB-TTL adapterTX | ESP32-CAMU0R (GPIO3) | Data to the CAM (uploads and console commands) | With the adapter set to 5V, this line carries 5V logic, above the ESP32's rating. A 1 kΩ / 2 kΩ divider is recommended; not fitted on the tested build. |
| ESP32-CAMU0T (GPIO1) | USB-TTL adapterRX | Data from the CAM (debug console) |
The adapter’s TX goes to the camera board’s U0R (receive), and its RX to U0T (transmit): each side’s transmit feeds the other’s receive.
Open the sketch and pick the board and port
Section titled “Open the sketch and pick the board and port”- In the Arduino IDE, open
airgap_qrcamwith File → Open…. - Select Tools → Board → esp32 → AI Thinker ESP32-CAM.
- Open Tools → Port before and after plugging the adapter into the computer. The entry that appears is the adapter’s port: select it. On Windows it is a
COMport, and on Linux usually something like/dev/ttyUSB0.
Upload the firmware
Section titled “Upload the firmware”The camera board enters download mode (ready to receive new firmware) only if its GPIO0 pin is connected to ground when it starts.
- Bridge
GPIO0toGNDwith a jumper wire. Use a realGNDpin, never the one labelledGND/R. - Press the camera board’s RESET button.
- Click Upload (the arrow button). The IDE compiles the sketch, then sends it to the board. Watch the Output panel until the upload has finished.
- Remove the bridge when the upload has finished.
- Press RESET again to start the new firmware.
What the build includes
Section titled “What the build includes”You don’t need to set anything else:
- The AI Thinker ESP32-CAM board settings enable the board’s PSRAM and give the firmware a large app partition.
- The sketch folder contains its own
partitions.csv, which the ESP32 core uses automatically. It has no area for crash dumps, so a crash can never write memory contents to flash.
If the upload fails
Section titled “If the upload fails”The IDE shows the error in the Output panel.
Invalid head of packet (0xF9): the board wasn’t in download mode, usually because the GPIO0 bridge wasn’t making contact at reset. Reseat the bridge, press RESET and try again.- “Access is denied” or “port busy”: another program, such as a serial terminal, has the port open. Close it first. Only one program can use a port at a time.
Check it’s alive
Section titled “Check it’s alive”After the reset, the camera board starts scanning for QR codes. The full check comes later, once the DevKit is flashed too: its Scan test screen shows what the camera reads.
If the camera board keeps rebooting with Detected camera not supported in its console, unplug the power, reseat the camera’s ribbon cable, and power it up again. That fixed it in testing.
Before you continue
Section titled “Before you continue”- The camera firmware uploaded without errors, and the GPIO0 bridge is removed.
- Erase All Flash Before Sketch Upload is back to Disabled.
- The adapter stays connected and powers the camera board.
- The DevKit’s 5V is not connected to the camera board.