Learn

Arduino Nano ESP32 pinout: the Nano’s names, the ESP32-S3’s numbers

Beginner

Or see every lesson.

  • 455parts on the bench
  • 43boards running now
  • 1.00xreal time, on every board
Nano ESP32: the LEDslive0.000 s 0.00x
Click to open it in the editor
The orange LED on D13 lights on HIGH; the RGB LED’s red, green and blue each light when their pin goes LOW.

The Nano ESP32 puts an ESP32-S3 on the classic Nano outline and keeps the Nano’s pin names: D0 to D13 and A0 to A7. Behind each name is a GPIO number that has nothing to do with it, D13 is GPIO 48, and which of the two a bare number means depends on a setting. This page lists every pin with its GPIO, then power, the two LEDs, I2C, SPI, PWM and the analog pins, and which pin to use for what.

The circuit above is a Nano ESP32 in Mokxi blinking its orange LED on D13 and walking its RGB LED through red, green and blue. The board runs at 3.3 V. The table is read from the same board model the simulator runs, and where Mokxi does less than the chip, the row says so.

Every pin, with its GPIO

With the USB-C socket at the top, one row reads TX1, RX0, RST, GND, then D2 to D12, and the other reads VIN, GND, B1, VBUS, A7 down to A0, B0, 3V3 and D13. The table goes up each row from the end away from the socket, which is the order Mokxi’s board model uses.

B0 and B1 are two pads the classic Nano does not have, used for the RGB LED and the BOOT button. GPIO 19 and 20, the ESP32-S3’s USB pins, are wired to the socket and are on no pin.

Arduino Nano ESP32: each row from the end away from the USB socket, the D12 row first
PinGPIOWhat it can doWatch out for
D1247Digital. PWM. SPI MISO (default).-
D1138Digital. PWM. SPI MOSI (default).-
D1021Digital. PWM. SPI SS (default).-
D918Digital. PWM.-
D817Digital. PWM.-
D710Digital. PWM.-
D69Digital. PWM.-
D58Digital. PWM.-
D47Digital. PWM.-
D36Digital. PWM.-
D25Digital. PWM.-
GND-Ground. Two pins.-
RST-Reset: low restarts the board.Not a GPIO.
RX044UART0 RX. D0 in a sketch.Serial is the USB-C socket; this is the UART.
TX143UART0 TX. D1 in a sketch.Serial is the USB-C socket; this is the UART.
D1348The orange LED, lit when HIGH: LED_BUILTIN. PWM. SPI SCK (default).An SPI module’s clock flickers the LED.
3V3-The 3.3 V rail, from the board’s converter.Not a GPIO.
B046The RGB LED’s red, lit when LOW. PWM.Strapping pin: leave it unloaded at power-on.
A01Analog in, ADC1_CH0. PWM.-
A12Analog in, ADC1_CH1. PWM.-
A23Analog in, ADC1_CH2. PWM.Strapping pin: leave it unloaded at power-on.
A34Analog in, ADC1_CH3. PWM.-
A411ADC2_CH0 on the chip (not modeled: reads 0 here). I2C SDA (default). PWM.ADC2 stops working while WiFi is on.
A512ADC2_CH1 on the chip (not modeled: reads 0 here). I2C SCL (default). PWM.ADC2 stops working while WiFi is on.
A613ADC2_CH2 on the chip (not modeled: reads 0 here). PWM.A bare 13 in a sketch is this pin, not D13.
A714ADC2_CH3 on the chip (not modeled: reads 0 here). PWM.ADC2 stops working while WiFi is on.
VBUS-USB 5 V out, only while USB is plugged in.Not a GPIO, and dead when the board runs from VIN.
B10The RGB LED’s green, lit when LOW. The BOOT button. PWM.Strapping pin: low at reset starts the upload mode.
VIN-Power in, 6 to 21 V by Arduino’s spec.Not modeled: Mokxi leaves it open.

D13 or 13: the pin numbering setting

Arduino’s core for this board has two numberings, under Tools, Pin Numbering. By Arduino pin, the default in the IDE, 13 means D13. By GPIO number, a bare number is the GPIO, so 13 is GPIO 13, which is A6. Mokxi builds by GPIO number, and the names D13, A0 and LED_BUILTIN mean the right pin under either setting. Write the names, never bare numbers, and a sketch works both ways.

The sketch below printed "LED_BUILTIN 48, D13 48, SDA 11, SCL 12, A4 11, LED_RED 46, LED_GREEN 0, LED_BLUE 45" in Mokxi: the GPIO behind each name.

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

void setup() {
  Serial.begin(115200);
  show("LED_BUILTIN", LED_BUILTIN);
  show("D13", D13);
  show("SDA", SDA);
  show("SCL", SCL);
  show("A4", A4);
  show("LED_RED", LED_RED);
  show("LED_GREEN", LED_GREEN);
  show("LED_BLUE", LED_BLUE);
}

void loop() {
}

Power: 3.3 V logic, VBUS and VIN

Every pin is 3.3 V, and Arduino warns against wiring higher-voltage devices to any of them: a 5 V sensor output needs a divider or a level shifter. VIN takes 6 to 21 V, which a converter on the board steps down to 3.3 V. VBUS is the USB socket’s 5 V, and it is live only while the board runs from USB, not from VIN. 3V3 is the board’s rail for a sensor or a display.

In Mokxi the board is always on USB. VIN is left open, because the converter is not modeled, and 3V3 is an ideal rail.

The orange LED and the RGB LED

LED_BUILTIN is the orange LED on D13, which lights when the pin is HIGH. The RGB LED is common anode, so each color lights when its pin is LOW: red on GPIO 46 (B0), green on GPIO 0 (B1) and blue on GPIO 45, which no pin reaches. digitalWrite(LED_RED, LOW) turns red on. D13 is also SPI’s clock, so an SPI display flickers the orange LED.

I2C, SPI, PWM and analog

Wire.begin() puts I2C on A4 for SDA and A5 for SCL, as on every Nano. SPI is D13, D12, D11 and D10 for SCK, MISO, MOSI and SS, the Nano’s holes. PWM is LEDC, and any GPIO can have it: analogWrite attaches a channel the first time.

A0 to A3 are on ADC1, and Mokxi reads them in twelve bits: wired to 3V3, A0 read 4095. A4 to A7 are on ADC2, which Mokxi does not model, and wired to 3V3 they read 0. On a real board ADC2 works too, but not while WiFi is on, because the radio uses it, so an analog sensor in a WiFi project goes on A0 to A3.

Strapping pins, Serial and the USB

The ESP32-S3 reads GPIO 0, 3, 45 and 46 as it comes out of reset. Three are on this board’s pins: B1, A2 and B0. GPIO 0 low at reset starts the download mode instead of your sketch, which is what the BOOT button does. Do not let a module pull B1 low or hold A2 or B0 at power-on. Mokxi does not model strapping.

Serial is the USB-C socket itself and reaches no pin. RX0 and TX1 are UART0, a separate port for a GPS or another board; in Mokxi it reaches the serial monitor too.

Which pin should I use for what?

Nano tutorials carry over pin for pin as long as they use the names: a sketch for a classic Nano that says A4, D13 or LED_BUILTIN lands on the same hole here, while one that says a bare 13 reaches A6 when the board is built by GPIO number, as Mokxi builds it. An analog sensor: A0 to A3. An LED or a button: D2 to D9. An I2C module: A4 and A5. An SPI module: D10 to D13. A servo: D9 or any D pin. Leave B0, B1 and A2 alone at power-on, and use names, not numbers.

Questions

What GPIO is D13 on the Nano ESP32?

GPIO 48. A bare 13 is GPIO 13 when the board is built by GPIO number, which is A6, so write `D13` or `LED_BUILTIN`.

What are the Nano ESP32 I2C pins?

A4 is SDA and A5 is SCL, which are GPIO 11 and 12. `Wire.begin(sda, scl)` moves the bus to other pins.

Which Nano ESP32 pins are PWM?

All of the D and A pins. PWM comes from the LEDC hardware through the GPIO matrix, so there is no fixed set of tilde pins.

Is the Arduino Nano ESP32 5 V tolerant?

No. Its pins are 3.3 V. Power it with 5 V on USB or 6 to 21 V on VIN, but keep every signal at 3.3 V.

Why does analogRead(A4) read 0 in the simulator?

A4 to A7 are on ADC2, which Mokxi does not model. A0 to A3 are on ADC1 and read the real voltage.

How do I light the RGB LED on a Nano ESP32?

Drive `LED_RED`, `LED_GREEN` or `LED_BLUE` LOW. They are common anode, so HIGH is off.

Build this for real

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