Is there anyway to activate the external antenna on the XIAO ESP32C6 in ESPHome?
I know i have to set GPIO03 to low and GPIO14 to high, but can’t get it to work.
I have tried to make some output and run them on boot, but don’t work.
output:
platform: gpio
id: “GPIO14”
pin: GPIO14
platform: gpio
id: “GPIO03”
pin: GPIO03
and
on_boot:
priority: 1000
then:
- output.turn_off: GPIO03
- output.turn_on: GPIO14
Also tried switch, but also don’t work.
Then i found someone that wort you should do this, but i get a error when trying it, so not sure what to do.
on_boot:
priority: 1000
then:
- lambda: |-
pinMode(02, OUTPUT);
digitalWrite(02, HIGH);
And can’t find it anywhere on google how to do it, so is there anyone here that know?
Karosm
(Karosm)
July 12, 2025, 9:11pm
2
Can be tricky with esphome.
Try with that 100ms delay between outputs.
C6 is still on experimental state here.
How do i add delay?
Can find the right command for that.
Karosm
(Karosm)
July 13, 2025, 5:13pm
4
- output.turn_on:: output03
- delay: 100ms
- output.turn_off: output14
Don’t give id like “GPIO14”, it’s too confusing (if it even work).
That don’t work
i will keep trying other stuff.
I got it working.
I added a output and a switch to switch from internal to external wifi antenna
output:
platform: gpio
id: “GPIO03”
pin: GPIO03
switch:
platform: gpio
pin: GPIO14
restore_mode: ALWAYS_OFF
name: “Internal Wifi Antenna On/Off”
id: “GPIO14”
And added this to the start
on_boot:
priority: 800
then:
- output.turn_off: GPIO03
So now i have a switch that work and i can turn on or off the internal antenna.
Off is the external antenna.
What worked for me:
esphome:
esphome:
name: esp32-c6
on_boot:
priority: 800
then:
- wifi.disable:
- output.turn_off: pin3 # activate RF Switch control
- delay: 100ms
- switch.turn_on: pin14
- wifi.enable:
output:
platform: gpio
id: pin3
pin: GPIO03
switch:
platform: gpio
pin: GPIO14
restore_mode: ALWAYS_OFF
name: "External Wifi Antenna On/Off"
id: pin14
But the signal only got around 5-8 dB better. Might depend on the antenna-design.
2 Likes
Try playing around with the output power under the wifi section:
wifi:
...
output_power: 20.4 dB
Why is that “only”?
If I was offered a salary increase of 5-8 dB I would be ecstatic Text
vinz155
(Alex)
August 6, 2025, 6:04pm
10
How do you measure it?
Im currently experiencing issueds with zigbee range of esp32c6 and used antena also, no luck at all.
snoack
(Sebastian Noack)
November 29, 2025, 11:11pm
11
I’m a little bit late to the party but this is what I’m using:
esphome:
...
on_boot:
then:
- output.turn_off: rf_switch_enable
- delay: 100ms
- output.turn_on: antenna_select
output:
- platform: gpio
id: rf_switch_enable
pin: GPIO3
- platform: gpio
id: antenna_select
pin: GPIO14
The node has been running reliably and has decent WiFi reception but I’m also curious if there is a reliable way to actually confirm which antenna it is using?
jamdz
December 6, 2025, 6:16pm
12
Code (posted by michapixel ) is working for me, confirmed both with wifi signal from Ubiquiti AP and Bluetooth device.