To connect to WiFi from the terminal on a Raspberry Pi without a monitor or keyboard, you need a headless serial console. The direct answer is to wire a 3.3V USB-to-UART adapter (like a CP2102 or FT232RL) to GPIO pins 6 (GND), 8 (TX), and 10 (RX), open a serial terminal at 115200 baud, and use the nmcli command-line tool to authenticate with your router.

This guide walks through the physical wiring diagram required to establish that terminal link, followed by the exact software commands to provision the WiFi connection on modern Raspberry Pi OS (which uses NetworkManager).

The UART Wiring Diagram and Pin Mapping

Before touching any wires, we must map the physical terminals. The Raspberry Pi uses a 3.3V logic level on its primary UART (UART0). Sending 5V logic from a standard Arduino or an unconfigured USB adapter into the Pi’s RX pin will permanently damage the BCM2711/2712 SoC.

Below is the terminal mapping table for wiring a standard 3.3V USB-to-UART bridge to the Raspberry Pi 4 or 5 GPIO header.

Table 1: UART Serial Console Pin Mapping and Wire Specifications
Pi GPIO Header Pin BCM GPIO Number Function (Pi Perspective) Adapter Terminal Wire Color (Std) Voltage Level
Pin 6 N/A (Ground) Ground (GND) GND Black 0V Reference
Pin 8 GPIO 14 Transmit (TXD) RX / RXD Yellow 3.3V Logic High
Pin 10 GPIO 15 Receive (RXD) TX / TXD Orange 3.3V Logic High
Pin 1 (Optional) 3V3 Power 3.3V Power Out VCC / 3V3 Red 3.3V (Max 50mA draw)

Decoding the Diagram Symbols

If you are looking at a standard UART schematic, you will see specific symbols that dictate how to wire this physical connection:

  • TX/RX Crossed Arrows: In serial diagrams, data flow is unidirectional per wire. The arrow pointing away from the Pi (TX) must point toward the adapter's receiving terminal (RX). Transmit always connects to Receive.
  • Chassis Earth / Ground Symbol (⏚): This indicates the common reference plane. It is not merely a safety shield; it is the 0V baseline the UART receiver uses to distinguish a 3.3V logic '1' from a 0V logic '0'.
  • Logic Level Indicators (3V3 vs 5V): A small label near the adapter's VCC jumper. Ensure the jumper on your CP2102/FT232RL module bridges the 3.3V pads, not the 5V pads, before connecting to the Pi.

Node-by-Node Signal and Ground Trace

Let’s trace the physical path from the source (your host PC) to the load (the Pi's SoC UART controller), paying strict attention to polarity and the ground return path.

  1. Source (Host PC USB Port): The PC supplies 5V VBUS and USB D+/D- differential data lines. The PC's internal power supply ties the USB ground to the motherboard ground plane.
  2. Node 1 (USB-to-UART Bridge IC): The D+/D- lines enter the CP2102N or FT232RL IC. The IC's internal voltage regulator steps the 5V VBUS down to a 3.3V logic rail. The IC converts the USB packets into asynchronous serial TTL signals.
  3. Node 2 (The Crossover): The adapter's TX pin outputs a 3.3V square wave (idle high at 3.3V, pulling to 0V for logic '0'). This travels through the orange jumper wire and enters the Pi at Pin 10 (GPIO 15 / RXD). Simultaneously, the Pi's Pin 8 (GPIO 14 / TXD) sends its 3.3V idle-high signal back through the yellow wire to the adapter's RX pin.
  4. Node 3 (Load - Pi SoC): The signals pass through the Pi's GPIO protection resistors and enter the BCM SoC's primary UART peripheral, which is mapped to the Linux serial console (/dev/serial0).
⚠ Ground Path and Polarity Warning:
The ground path is critical. The black wire connects the adapter's GND pin to the Pi's Pin 6. This creates an equipotential bonding link between the PC's USB ground and the Pi's ground plane. Never hot-plug the data wires (TX/RX) before the ground wire is secured. If TX/RX make contact before GND, the voltage differential between the two floating ground planes can exceed the 3.3V absolute maximum rating, instantly destroying the Pi's GPIO input diodes.

Verifying the Physical Layer with a Multimeter

Before powering up the Pi and opening your terminal software, verify the physical wiring with a digital multimeter (DMM). This prevents catastrophic logic-level mismatches.

Step 1: Verify Adapter Logic Level (Crucial)

  1. Plug the USB-to-UART adapter into your PC. Do not connect it to the Pi yet.
  2. Set your DMM to DC Voltage (20V range).
  3. Place the black probe on the adapter's GND pin.
  4. Place the red probe on the adapter's TX pin.
  5. Expected Reading: You must read between 3.2V and 3.4V (idle high). If you read ~5.0V, your adapter is configured for 5V logic. Unplug it immediately and move the physical jumper on the adapter board to the 3.3V position.

Step 2: Verify Ground Continuity

  1. With the Pi powered off and unplugged, set your DMM to Continuity (the diode/beep symbol).
  2. Place one probe on the adapter's GND pin and the other on the metal shield of the Pi's USB-C power port or Ethernet jack.
  3. Expected Reading: Less than 1 ohm (or a continuous beep). This confirms Pin 6 is properly bonded to the Pi's ground plane.

Step 3: Verify TX/RX Idle Voltages

  1. Power up the Raspberry Pi via its official USB-C power supply.
  2. Set DMM to DC Voltage. Black probe on Pin 6 (GND).
  3. Red probe on Pin 8 (Pi TX). Expected: ~3.3V (Idle high).
  4. Red probe on Pin 10 (Pi RX). Expected: ~3.3V (Pulled high by the adapter's TX line).

Executing the WiFi Connection via Terminal

Once the physical layer is verified, open your serial terminal software (PuTTY on Windows, or screen /dev/tty.usbserial-XXXX 115200 on macOS/Linux). Press Enter a few times to trigger the login prompt, and log in with your Pi credentials.

Modern Raspberry Pi OS (Bookworm and newer) has deprecated wpa_supplicant in favor of NetworkManager. You will use the nmcli (NetworkManager Command Line Interface) tool to connect to WiFi. For deeper reference on NetworkManager's architecture, consult the official nmcli documentation.

1. Enable the WiFi Radio

By default, the WiFi radio might be soft-blocked on a fresh headless boot. Turn it on:

nmcli radio wifi on

2. Scan for Available Networks

Query the local 2.4GHz and 5GHz spectrum for visible SSIDs:

nmcli device wifi list

Note: If your list is empty, wait 10 seconds and run it again. The Raspberry Pi UART configuration sometimes delays network interface initialization on headless boots.

3. Connect to the Target SSID

Pass the exact SSID (case-sensitive) and your WPA2/WPA3 pre-shared key. NetworkManager will automatically handle the 4-way handshake and DHCP request.

nmcli device wifi connect "YourNetworkSSID" password "YourSecurePassword"

4. Verify the IP Assignment

Confirm that the wlan0 interface has pulled an IP address from your router's DHCP pool:

nmcli connection show --active

You should see your SSID listed alongside an IPv4 address (e.g., 192.168.1.45/24). You can now safely disconnect the UART serial wiring, plug the Pi into its final installation location, and SSH into it over the network.