Wifi range with Raspberry Pi board (installed an external antenna)

Hi all,

I have a raspberry pi compute module 4 and the wifi range is too weak so I decided to install an external passive antenna using the Hirose U.FL connector. Installing this antenna changed noise signal from -75dBm to -97dBm but the range is still poor.
The output from iw phy is:

iw phy | grep "Available Antennas"
        Available Antennas: TX 0 RX 0

I edited the config.txt file on /boot/config.txt to add the following lines:

# Switch to external antenna.
dtparam=ant2

According to this Raspberry Pi documentation, this should be enough to enable an external antenna.

Am I doing the correct steps to enable this antenna?
Does anyone knows if there's a better way to check if this antenna is being used by OpenWRT?

You could measure the control voltages going to the antenna switch chip. It looks like a standard 6-pin PIN diode switch. The two pins on the sides on the radio side control the diodes inside. One of the control pins will be high and the other low depending on the setting. It's probably from a GPIO port but if the bootloader sets it correctly OpenWrt need not change it later.

Realize that the wifi chip in these was intended for low-end smartphones. It's not going to have great performance.

1 Like

Hi @mk24, thanks for your suggestion.
I have no expertise with electronics so I won't be able to measure voltages on the board/chip.

Is there no easier way to detect if the antenna is being used by OpenWRT?

Hi @maluco,

One simple thing you could try is get a metal biscuit tin, put the the PI inside with the external antenna poking out then switch between antennas, the internal antenna setting should now give a much lower signal.

Kind regards,
Matt

1 Like

You realize that -75 dBm is better than -97 dBm?
Wireless on the RPi ist better best forgoteen.

1 Like

So I did a test using a metal biscuit tin and I got the same readings between the internal antenna and the external antenna from RPI. Clearly this external antenna it's not enable. I tried with a different antenna (to check if the first external antenna is broken) and the results were the same.

Does anyone knows if adding "dtparam=ant2" to boot/config.txt is enough to enable an external antenna on OpenWRT?

I don't have a CM4 so I can't verify, but I believe you can see which antenna is active by simply

cat /sys/kernel/debug/gpio

You should see ant1 and ant2 gpio-hogs. The one with the high output is active.

Could be wrong. Just basing this on a brief look at the dts

1 Like

Hi!
Here's the result when I do cat /sys/kernel/debug/gpio

gpiochip1: GPIOs 504-511, parent: platform/soc:firmware:gpio, raspberrypi-exp-gpio, can sleep:
 gpio-504 (BT_ON               )
 gpio-505 (WL_ON               )
 gpio-506 (PWR_LED_OFF         |led1                ) out lo ACTIVE LOW
 gpio-507 (ANT1                |ant1                ) out lo
 gpio-508 (VDD_SD_IO_SEL       |vdd-sd-io           ) out lo
 gpio-509 (CAM_GPIO            )
 gpio-510 (SD_PWR_ON           |sd_vcc_reg          ) out hi
 gpio-511 (ANT2                |ant2                ) out hi

I have dtparam=ant2 on boot/config.txt so I believe the antenna is enabled right?

Yes, I believe that is the expected output with dtparam=ant2. So the external antenna connector should be active. Better check the connection and cable if it still doesn't work as expected.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.