Arduino Nano ESP32: Why digitalWrite(13) Isn't GPIO13, and Serial Isn't the RX/TX Pins
On the official Arduino Nano ESP32 (ABX00083), the number printed on the board is not the ESP32-S3 GPIO: D13/LED_BUILTIN is GPIO48, and raw 13 in GPIO/legacy mode is A6. Serial is native USB; Serial0 is the D0/D1 UART and is shared with the bootloader. RGB LEDs are active-low. Source-verified from Arduino docs and arduino/arduino-esp32 pins_arduino.h; not run on hardware.

Arduino Nano ESP32: Why digitalWrite(13) Isn't GPIO13, and Serial Isn't the RX/TX Pins
The Arduino Nano ESP32 looks like a classic Nano and talks like an ESP32-S3. That combination is the point of the board, and it is also how people get the first sketch wrong. If you copy a Nano 33 pin number and a DevKit-style GPIO number into the same file, or you open the Serial Monitor expecting the D0/D1 UART, the official core will do exactly what you asked — just not what you meant.
This write-up stays with Arduino's own open-source core and docs. I am not adding a third-party pin library, and I did not run these sketches on hardware. Treat it as source-verified.
Sources used in this post:
- Arduino's Nano ESP32 product page and Getting Started guide (install the Arduino ESP32 Boards package by searching "Nano ESP32" in Boards Manager)
- The official User Manual and Selecting Pin Configuration tutorial (docs-content copies fetched for this write-up; the getting-started page still describes the package as the 2.x branch of arduino/arduino-esp32 with ESP-IDF v5.1.4)
- The variant header
variants/arduino_nano_nora/pins_arduino.hin that repo. I compared tags 2.0.13, 2.0.17, and 3.0.0: the Nano-to-GPIO map below did not change
Disclosure: further down I link one eBay listing for an official Nano ESP32 with headers (ABX00083). That link is an eBay affiliate link (customid=blog01); if you buy through it I may earn a commission at no extra cost to you. Check the listing yourself before you pay.
What is actually on the board
Per Arduino's user manual, the MCU is an ESP32-S3 inside a u-blox NORA-W106 module (2.4 GHz Wi-Fi and Bluetooth 5, antenna in the module). The SoC runs at 3.3 V. The board has 384 kB ROM, 512 kB SRAM, 16 MB external flash, and 8 MB PSRAM. USB is USB-C. It is the first Arduino Nano with that connector, and it is also the first Nano that does not have a 5V pin.
That last point is easy to miss if you are coming from a classic Nano, whose I/O is 5 V. The manual is blunt: do not apply voltages higher than 3.3 V to the GPIO pins. The old 5V header is now VBUS, which provides 5 V only when the board is powered from USB and is disabled when you power from VIN. The point, Arduino says, is to keep 5 V off the microcontroller.
Power can come from USB-C (5 V) or the VIN pin. The same manual warns that the MP2322GQH converter can be damaged outside a 5–18 V VIN range, then lists a recommended VIN of 6–21 V a few lines later. I am not going to pick a number for you. If you power from VIN, read the current datasheet.
Install the official package from Boards Manager by searching Nano ESP32. Arduino's getting-started page also notes that the board selector may show both a USB port and a DFU port; pick USB.
Gotcha 1: the number printed on the board is not the ESP32-S3 GPIO
Arduino kept the Nano form-factor pinout so you can move a shield or a breadboard from an older Nano and keep the same wiring. The ESP32-S3 inside the module does not use those numbers. Official examples:
- the pin labelled D2 is GPIO5
- the pin labelled D8 is GPIO17
- D13 (the built-in LED, also SCK) is GPIO48
- D11 (MOSI / COPI) is GPIO38
If you have already used an ESP32-S3-DevKitC-1, GPIO38 and GPIO48 may look familiar — they are the pins the official ESP-IDF blink example argues over on that board. On the Nano ESP32 they are just D11 and D13. Do not paste DevKit GPIO numbers into a Nano sketch and expect the same LED.
The official core supports two numbering schemes, switched in Tools > Pin Numbering:
- By Arduino pin (default) — the numbers printed on the board.
pinMode(2, OUTPUT)is D2. - By GPIO number (legacy) — the ESP32-S3 GPIO. The same physical D2 is
pinMode(5, OUTPUT). This exists because some ESP32 libraries (Arduino names OneWire, FastLED, and ESP32Servo) want GPIO numbers.
The trap is a raw integer. In the default mode, digitalWrite(13, HIGH) is the built-in LED. In GPIO/legacy mode, 13 is GPIO13, which the official pin map assigns to A6, not to D13. The LED does not move; your argument does.
The macros do not have that problem. D2, D13, LED_BUILTIN, A4, and so on are defined in pins_arduino.h for both schemes, and the official pin-setup tutorial uses that as the portable form:
cpp
// Configures the physical D2 pin in either numbering scheme
// (GPIO5 on the ESP32-S3).
pinMode(D2, OUTPUT);
The map in that tutorial, the user-manual pin map, and pins_arduino.h (2.0.13, 2.0.17, and 3.0.0) agree:
| Nano pin | ESP32-S3 GPIO | Notes |
|---|---|---|
| D0 | 44 | UART RX (Serial0) |
| D1 | 43 | UART TX (Serial0) |
| D2 | 5 | official example in the pin-setup tutorial |
| D8 | 17 | another official example |
| D10 | 21 | SS |
| D11 | 38 | MOSI / COPI |
| D12 | 47 | MISO / CIPO |
| D13 | 48 | SCK, LED_BUILTIN |
| A0 | 1 | |
| A4 | 11 | SDA |
| A5 | 12 | SCL |
| A6 | 13 | this is what raw 13 hits in GPIO mode |
| A7 | 14 | |
| BOOT0 | 46 | listed on the official pin map |
| BOOT1 | 0 | listed on the official pin map |
One earlier table in the same user manual labels the UART pins "D1/RX" and "D0/TX". The pin map, the UART section, and the header all say the opposite: D0 is RX, D1 is TX. Trust those three.
Gotcha 2: Serial is the USB port, not the pins labelled RX/TX
The user manual splits this cleanly:
Serialis the native USB portSerial0is the first hardware UART, on D0 (RX) and D1 (TX)Serial1andSerial2have no default pins; you assign them
So this prints to the Arduino Serial Monitor over USB-C, not to a 3.3 V UART adapter on the headers:
cpp
Serial.begin(9600);
Serial.print("hello world");
To use the pins labelled RX and TX, you need Serial0:
cpp
Serial0.begin(9600);
Serial0.write("Hello world!");
Arduino also warns that Serial0 is shared with the bootloader and kernel. The port prints a few messages at boot or reset, and if the firmware crashes, the FreeRTOS crash dump goes there too. If you need a clean UART for your own protocol, the manual tells you to use Serial1 or Serial2 instead, and to pass the pins explicitly:
cpp
Serial1.begin(9600, SERIAL_8N1, D4, D5);
Serial1.write("Hello world!");
SERIAL_8N1 is 8 data bits, no parity, one stop bit — the usual default. The USB side cannot be remapped onto GPIOs; it is the Type-C connector. In pins_arduino.h the USB identifiers are USB_VID 0x2341 and USB_PID 0x0070 (Arduino's vendor ID).
Because this is a native-USB board, a bad HID sketch can grab your keyboard and mouse. Arduino documents a recovery path they call Arduino Bootloader Mode: with the board powered, press reset, then press it again once the RGB LED flashes. Success is a slowly pulsing green LED. In that mode the board starts without running your sketch, so you can upload again. The getting-started page's "double tap RESET" advice for leaving MicroPython is the same gesture.
The RGB LED is active-low, and one early batch swapped green and blue
The board has a built-in RGB LED that is not brought out to the headers. You drive it with LED_RED, LED_GREEN, and LED_BLUE (2.0.16 and later also define LEDR / LEDG / LEDB as aliases). These are active-low: digitalWrite(LED_RED, LOW) turns the red channel on.
That polarity is the opposite of LED_BUILTIN on D13, which the official default sketch drives with HIGH for on. If you write HIGH to all four pins, you will get the white LED on D13 and a dark RGB. Arduino's own default sketch, quoted in the user manual, already does this correctly:
cpp
void setup() {
pinMode(LED_RED, OUTPUT);
pinMode(LED_GREEN, OUTPUT);
pinMode(LED_BLUE, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(LED_RED, LOW);
digitalWrite(LED_GREEN, HIGH);
digitalWrite(LED_BLUE, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
digitalWrite(LED_RED, HIGH);
digitalWrite(LED_GREEN, LOW);
digitalWrite(LED_BLUE, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(LED_RED, HIGH);
digitalWrite(LED_GREEN, HIGH);
digitalWrite(LED_BLUE, LOW);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
}
Use the macros, not raw GPIO numbers, for the RGB channels. Arduino documents that a first limited production batch shipped with the green and blue LED pins inverted. The macros in the official core are the supported way to target the later (and typical) boards; if your RGB colours look swapped, that Help Center article is the one to read, not a random pin table.
In GPIO numbering, LED_RED is 46 and LED_GREEN is 0 — the same numbers the official pin map lists for BOOT0 and BOOT1. I am only pointing out the coincidence in the header and the pin map. I have not traced the schematic for this post, and I am not going to invent a boot-strapping warning that Arduino does not print next to those macros.
A small first sketch that uses the macros
This is the official default RGB walk plus a USB Serial line, still using only names that survive both pin-numbering modes. I have not compiled or flashed it here.
cpp
void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
pinMode(LED_RED, OUTPUT);
pinMode(LED_GREEN, OUTPUT);
pinMode(LED_BLUE, OUTPUT);
}
void loop() {
Serial.println("USB Serial, not the D0/D1 UART");
digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(LED_RED, LOW); // RGB on (active-low)
digitalWrite(LED_GREEN, HIGH);
digitalWrite(LED_BLUE, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
digitalWrite(LED_RED, HIGH); // RGB off
delay(500);
}
If the Serial Monitor stays quiet, you are probably watching Serial0 or a USB-UART adapter on D0/D1. If the "13" LED never blinks, check Tools > Pin Numbering and switch the raw 13 to LED_BUILTIN or D13.
Where I looked for a board
I wanted an official ABX00083 (Nano ESP32 with headers), not a generic ESP32-S3 module in a Nano-shaped PCB. On 17 November 2026 (Asia/Shanghai) this US listing was a reasonable match: new, price in the usual official retail range, and a US seller with a long feedback history.
- Listing: eBay item 198629447311 (affiliate link,
customid=blog01) - Title: Arduino Nano ESP32 with Headers [ABX00083]; item specifics also had manufacturer Arduino S.r.l., MPN ABX00083, and GTIN 07630049203969
- Snapshot: US $19.07, free 2–4 day delivery to ZIP 10001, New, 2 available (2 sold)
- Seller: elegansinternational, 6,694 feedback, 99.8% positive, West Palm Beach, Florida, 30-day free returns
The listing also had some noisy item specifics (for example a "16 GB" memory field that does not match the official 16 MB flash / 8 MB PSRAM). I am going by the official MPN and the product title, not by those extra fields. Check the photos and the current price before you pay; eBay listings change.
What I did not do
I did not install the board package in this write-up, compile the sketches, or power a Nano ESP32. The pin map and the Serial / Serial0 split are from Arduino's current docs and from pins_arduino.h. If a later Boards Manager release changes a default, the official pin-setup page and that header are the first things to re-read.