# ESP32 Serial2: pins for a GPS or sensor on a second UART

> Use the second hardware serial port on an ESP32: Serial2.begin with RX and TX pins, usually GPIO 16 and 17, cross wiring and 3.3 V levels.

Canonical: https://roboticsengineering.in/fix/esp32-serial2-uart-pins-gps-sensor/ | Published: 2026-11-03 | Updated: 2026-11-03

**On many ESP32 boards Serial2 uses GPIO 16 for RX and GPIO 17 for TX by default, and you can set other pins in begin().**

## What the message means

The ESP32 has three hardware UARTs. UART0 is the USB console, so use Serial2 for a GPS, a sensor or another board.

## Fix it in this order

1. Call Serial2.begin(baud, SERIAL_8N1, rxPin, txPin) with the pins you wired.
2. Cross the lines: the device TX goes to your RX pin, and its RX goes to your TX pin.
3. Join the grounds, and use 3.3 V levels. Level-shift a 5 V device TX line.
4. Match the baud rate to the device datasheet.
5. Do not use GPIO 6 to 11 or the strapping pins for this.
6. Print what you receive on the USB Serial to check.

## If you see this, do this

| You see | Do this |
| --- | --- |
| Nothing arrives | TX and RX not crossed, or baud mismatch. |
| Garbage characters | Baud rate. |

## Related

[serial garbage](https://roboticsengineering.in/fix/serial-monitor-shows-garbage-characters/), [ESP32 pinout](https://roboticsengineering.in/esp32-pinout-for-robotics/).

Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.
