Enable the external antenna connector on the Raspberry Pi Compute Module 4

Raspberry Pi Compute Module 4 external U.FL antenna

The internal WiFi module on the Compute Module 4 (that's the bit under the metal shield in the picture above) routes its antenna signal via software. You can route the signal to either:

  1. The built-in PCB triangle antenna (this is the default).
  2. The external U.FL connector (which has an external antenna plugged into it in the picture above)

To switch the signal to the U.FL connector (for example, if you're installing your CM4 in a metal box where the PCB antenna would be useless), you need to edit the boot config file (sudo nano /boot/config.txt, and add the following at the bottom:

# Switch to external antenna.

Then reboot the Pi.

To switch back, comment out or delete the dtparam line above. Note that you can actually disable the WiFi antenna route entirely (even without disabling the WiFi chip); here are the docs straight from the firmware repository:

        ant1                    Select antenna 1 (default). CM4 only.

        ant2                    Select antenna 2. CM4 only.

        noant                   Disable both antennas. CM4 only.

See my original review of the Compute Module 4 for more information about antenna performance, and a recommendation of an external antenna to buy (though you can't go wrong with the one from Raspberry Pi themselves!).


Awesome, thanks for sharing- I’ve a CM4 on order from Seeed Studio, so will look at this when it arrives.

Sorry to be a grammar Nazi, but "it's" in the first sentence is incorrectly used.

The presence of this comment indicates this site is running on the Turing Pi 2 server. That's all.

Jeff thank you for writing this up. Certain tips are surprisingly un-prominent in the RPi boards. I needed this.

FWIW, the file is found in /boot/firmware/config.txt on Ubuntu if you work from their raspi image. They recommend you edit usercfg.txt, in the same directory, instead. It is pulled into config.txt at boot time.

I'm quite intresting in build WIFI router with this CM4-DUAL-ETH-4G/5G-BASE board, looking forward to more videos

Hi Jeff,

I tried to disable the antenna alltogether with the noant option but it seems this has no effect and that the Wifi Connection is still there

Thoughts ?