Serial

Description

Used for communication between the Arduino board and a computer or other devices. All Arduino boards have at least one serial port (also known as a UART or USART), and some have several.

BoardSerial pinsSerial1 pinsSerial2 pinsSerial3 pinsSerial4 pins
UNO R3, UNO R3 SMD Mini0(RX), 1(TX)
Nano (classic)0(RX), 1(TX)
UNO R4 Minima, UNO R4 WiFi0(RX0), 1(TX0)
Leonardo, Micro, Yún Rev20(RX), 1(TX)
UNO WiFi Rev20(RX), 1(TX)
MKR boards13(RX), 14(TX)
Zero0(RX), 1(TX)
GIGA R1 WiFi0(RX), 1(TX)19(RX1), 18(TX1)17(RX2), 16(TX2)15(RX3), 14(TX3)
Due0(RX), 1(TX)19(RX1), 18(TX1)17(RX2), 16(TX2)15(RX3), 14(TX3)
Mega 2560 Rev30(RX), 1(TX)19(RX1), 18(TX1)17(RX2), 16(TX2)15(RX3), 14(TX3)
Nano 33 IoT0(RX0), 1(TX0)
Nano RP2040 Connect0(RX0), 1(TX0)
Nano BLE / BLE Sense0(RX0), 1(TX0)

The Nano ESP32 board is an exception due to being based on the ESP32 core. Here,

Serial0
refers to
RX0
and
TX0
, while
Serial1
and
Serial2
are additional ports that can be assigned to any free GPIO.

BoardSerial0 pinsSerial1 pinsSerial2 pinsSerial3 pinsSerial4 pins
Nano ESP320(RX0), 1(TX0)Any free GPIOAny free GPIO

You can read more about configuring the Nano ESP32’s additional serial ports in this article.

On older boards (Uno, Nano, Mini, and Mega), pins 0 and 1 are used for communication with the computer. Connecting anything to these pins can interfere with that communication, including causing failed uploads to the board.

You can use the Arduino environment’s built-in serial monitor to communicate with an Arduino board. Click the serial monitor button in the toolbar and select the same baud rate used in the call to

begin()
.

Serial communication on pins TX/RX uses TTL logic levels (5V or 3.3V depending on the board). Don’t connect these pins directly to an RS232 serial port; they operate at +/- 12V and can damage your Arduino board.

To use these extra serial ports to communicate with your personal computer, you will need an additional USB-to-serial adaptor, as they are not connected to the Mega’s USB-to-serial adaptor. To use them to communicate with an external TTL serial device, connect the TX pin to your device’s RX pin, the RX to your device’s TX pin, and the ground of your Mega to your device’s ground.

Functions

See also

Suggest changes

The content on docs.arduino.cc is facilitated through a public GitHub repository. If you see anything wrong, you can edit this page here.

License

The Arduino documentation is licensed under the Creative Commons Attribution-Share Alike 4.0 license.