Learn

ESP32 DevKitC pinout: all 38 pins, and six never to use

Beginner

Or see every lesson.

  • 455parts on the bench
  • 43boards running now
  • 1.00xreal time, on every board
ESP32 DevKitC: blink on GPIO 2live0.000 s 0.00x
Click to open it in the editor
An LED and a 220 ohm resistor on GPIO 2, the board having no user LED of its own.

The ESP32-DevKitC V4 is Espressif’s own board for the classic ESP32: a WROOM-32 module on two nineteen-pin headers a full inch apart, a micro-USB socket, and BOOT and EN buttons. Its silkscreen prints the GPIO number on most holes, so it is the 38-pin board that tutorials call "ESP32 38 pin". This page lists every pin in Espressif’s order with its GPIO, then power, the strapping and input-only pins, the six flash pins, the buses and which pin to use for what.

The circuit above is a DevKitC in Mokxi blinking an LED on GPIO 2, because the board has no LED of its own to blink. The table is read from the same board model the simulator runs, which has Espressif’s headers hole for hole, and where Mokxi does less than the chip, the row says so.

Every pin, in Espressif’s order

With the USB socket at the bottom, the left header, J2, reads 3V3, EN, VP, VN, 34, 35, 32, 33, 25, 26, 27, 14, 12, GND, 13, D2, D3, CMD and 5V from the top. The right header, J3, reads GND, 23, 22, TX, RX, 21, GND, 19, 18, 5, 17, 16, 4, 0, 2, 15, D1, D0 and CLK. A number on the silkscreen is the GPIO, so digitalWrite(23, HIGH) drives the hole marked 23.

The holes named for a job are VP and VN, which are GPIO 36 and 39, TX and RX, which are GPIO 1 and 3, and the six flash pins at the USB end. Touch, the DAC and ADC2 are in the table because tutorials use them; Mokxi models none of the three.

ESP32-DevKitC V4: J2 from the top, then J3, USB at the bottom
PinGPIOWhat it can doWatch out for
3V3-The regulator’s 3.3 V output.Not a GPIO.
EN-Chip enable, which is the reset. The EN button pulls it low.Not a GPIO.
VP36ADC1_CH0. Input only.No output driver and no internal pull-up or pull-down.
VN39ADC1_CH3. Input only.No output driver and no internal pull-up or pull-down.
3434ADC1_CH6. Input only.No output driver and no internal pull-up or pull-down.
3535ADC1_CH7. Input only.No output driver and no internal pull-up or pull-down.
3232ADC1_CH4. PWM. Touch T9 (not modeled).A safe all-rounder.
3333ADC1_CH5. PWM. Touch T8 (not modeled).A safe all-rounder.
2525PWM. DAC1 and ADC2_CH8 on the chip (not modeled).ADC2 stops working while WiFi is on.
2626PWM. DAC2 and ADC2_CH9 on the chip (not modeled).ADC2 stops working while WiFi is on.
2727PWM. ADC2_CH7 and touch T7 on the chip (not modeled).ADC2 stops working while WiFi is on.
1414PWM. ADC2_CH6 and touch T6 on the chip (not modeled). JTAG MTMS.ADC2 stops working while WiFi is on.
1212PWM. ADC2_CH5 and touch T5 on the chip (not modeled). JTAG MTDI.Strapping pin: high at reset and the board does not boot.
GND-Ground. Three pins.-
1313PWM. ADC2_CH4 and touch T4 on the chip (not modeled). JTAG MTCK.ADC2 stops working while WiFi is on.
D29The module’s SPI flash.Never use: the chip runs its program from this flash.
D310The module’s SPI flash.Never use: the chip runs its program from this flash.
CMD11The module’s SPI flash.Never use: the chip runs its program from this flash.
5V-The 5 V rail from USB. Put 5 V here to run the board without a cable.Not a GPIO.
2323PWM. SPI MOSI (default).-
2222PWM. I2C SCL (default).-
TX1UART0 TX: Serial, and the USB-to-serial chip.Leave free, or uploads and the serial monitor break.
RX3UART0 RX: Serial, and the USB-to-serial chip.Leave free, or uploads and the serial monitor break.
2121PWM. I2C SDA (default).-
1919PWM. SPI MISO (default).-
1818PWM. SPI SCK (default).-
55PWM. SPI SS (default).Strapping pin: leave it unloaded at power-on.
1717PWM. UART2 TX in most tutorials.Reserved inside WROVER modules; free on a WROOM.
1616PWM. UART2 RX in most tutorials.Reserved inside WROVER modules; free on a WROOM.
44PWM. ADC2_CH0 and touch T0 on the chip (not modeled).A safe output.
00PWM. ADC2_CH1 and touch T1 on the chip (not modeled). The BOOT button.Strapping pin: low at reset waits for an upload.
22PWM. ADC2_CH2 and touch T2 on the chip (not modeled).Strapping pin: must be low or floating to upload.
1515PWM. ADC2_CH3 and touch T3 on the chip (not modeled). JTAG MTDO.Strapping pin: low at reset silences the boot messages.
D18The module’s SPI flash.Never use: the chip runs its program from this flash.
D07The module’s SPI flash.Never use: the chip runs its program from this flash.
CLK6The module’s SPI flash.Never use: the chip runs its program from this flash.

Power pins and their limits

5V is the USB rail, and without a cable you can run the board from 5 V on that pin. 3V3 is the regulator’s output, which powers the module and whatever you hang on it: a sensor or a display, not a servo or a motor. Espressif’s guide says to use only one supply at a time, USB, 5V or 3V3, or the board can be damaged. Every GPIO is 3.3 V and none takes 5 V. In Mokxi the rails are ideal and cannot sag.

The six flash pins

D0 to D3, CMD and CLK, at the USB end of both headers, are GPIO 6 to 11, the wires between the ESP32 and the module’s flash chip. The chip reads its program over them all the time, so touching one crashes the board, and Espressif’s guide says to leave them alone. The 30-pin DevKit V1 leaves them off its header, which is the main difference between the two boards. In Mokxi they are open holes that no sketch can reach.

Strapping pins and input-only pins

GPIO 0, 2, 5, 12 and 15 are read as the chip comes out of reset. GPIO 0 is the BOOT button: low at reset, the chip waits for an upload instead of running your sketch. GPIO 2 must be low or floating to upload. GPIO 12 high at reset sets the flash to 1.8 V and the board will not boot. A module that pulls one of these the wrong way makes a board that will not start. Mokxi does not model strapping, so a circuit can run here and still not boot on a desk.

GPIO 34, 35, 36 and 39, which are 34, 35, VP and VN, are inputs only: no output driver and no internal pull-up or pull-down, so a button on one needs a 10 k resistor of its own. Mokxi refuses an output on them as the chip does and marks the board when a sketch tries.

No user LED, and the default buses

The DevKitC has a power LED and nothing else, and there is no LED_BUILTIN, as in the Arduino IDE’s ESP32 Dev Module. A sketch that uses it does not compile: in Mokxi the build stopped with "use of undeclared identifier 'LED_BUILTIN'". Wire an LED to a pin, as above.

The sketch below printed "SDA 21, SCL 22, SCK 18, MISO 19, MOSI 23, SS 5, A0 36, A4 32" on the board in Mokxi. Wire.begin() uses 21 and 22, and SPI uses 18, 19, 23 and 5. Mokxi runs both buses in software on those pins, because the chip’s I2C and SPI controllers are not modeled.

Print the default pins
void show(const char *name, long value) {
  Serial.print(name);
  Serial.print(' ');
  Serial.println(value);
}

void setup() {
  Serial.begin(115200);
  show("SDA", SDA);
  show("SCL", SCL);
  show("SCK", SCK);
  show("MISO", MISO);
  show("MOSI", MOSI);
  show("SS", SS);
  show("A0", A0);
  show("A4", A4);
}

void loop() {
}

Analog, PWM and Serial

Only ADC1 keeps working with WiFi on, because the radio uses ADC2. ADC1 is on six holes: VP, VN, 32, 33, 34 and 35, and A0 is VP. Mokxi models ADC1 in twelve bits and not ADC2. PWM is LEDC, so any pin with an output driver can fade an LED with analogWrite. TX and RX are UART0, wired to the USB-to-serial chip, and carry every upload; leave them free.

Which pin should I use for what?

An LED or a relay: 4, 13, 16 to 19, 21 to 23, 25 to 27, 32 or 33. A button: the same pins with INPUT_PULLUP. An analog sensor: 32, 33, 34, 35, VP or VN. An I2C module: 21 and 22. An SPI module: 18, 19, 23 and 5. Keep things that pull up or down off 0, 2, 5, 12 and 15, and never touch D0 to D3, CMD or CLK.

Questions

Which pins should I never use on an ESP32 DevKitC?

D0, D1, D2, D3, CMD and CLK, which are GPIO 6 to 11 and the module’s flash. TX and RX if you want uploads to work.

What is the difference between the 38-pin and 30-pin ESP32 pinout?

The same chip and GPIO numbers. The 38-pin DevKitC also brings out the six flash pins, and its rows are a full inch apart, so it covers most of a breadboard.

What are the ESP32 DevKitC I2C pins?

GPIO 21 for SDA and GPIO 22 for SCL. `Wire.begin(sda, scl)` moves the bus to any two output pins.

Does the ESP32 DevKitC have a built-in LED?

Only a power LED. There is no `LED_BUILTIN`, so wire an LED and a resistor to a pin such as GPIO 2 or 4.

Which DevKitC pins are input only?

34, 35, VP (GPIO 36) and VN (GPIO 39). They have no output driver and no pull-up.

Build this for real

Open the editor, change a value and watch the number move with it. Nothing to install, and no account needed.