Configuring WiFi Channel Bandwidth in Arduino

noamaiz
Posts: 1
Joined: Thu May 26, 2022 4:57 pm

Configuring WiFi Channel Bandwidth in Arduino

Postby noamaiz » Thu May 26, 2022 5:01 pm

I know that with esp-idf you can change the bandwidth (20 or 40MHz) in the config. Is there any way to currently do this in Arduino IDE? I want to be able to set bandwidth to 40MHz for FTM.

Sprite
Espressif staff
Espressif staff
Posts: 10596
Joined: Thu Nov 26, 2015 4:08 am

Re: Configuring WiFi Channel Bandwidth in Arduino

Postby Sprite » Fri May 27, 2022 1:02 am

The Arduino IDE is built on top of ESP-IDF; as long as what you want isn't decided compile-time, you should be able to use the ESP-IDF functions after including the proper headers.

fanatmeta
Posts: 4
Joined: Thu Jun 23, 2022 10:45 pm

Re: Configuring WiFi Channel Bandwidth in Arduino

Postby fanatmeta » Thu Jun 23, 2022 10:49 pm

Hi, I have the same problem: there is no way to specify a 40MHz BW in FTM initiation. Because FTM works in unassociated state, the esp_wifi_set_bandwidth API does not work.

ESP32_kid
Posts: 16
Joined: Tue Oct 28, 2025 10:02 pm

Re: Configuring WiFi Channel Bandwidth in Arduino

Postby ESP32_kid » Wed Nov 12, 2025 6:19 pm

#include <esp_wifi.h>

The default for ESP32's appears to be wideband on wifi.

Set HT20 after softAP setting

WiFi.softAP(ssid, password, channel);
esp_wifi_set_bandwidth(WIFI_IF_AP, WIFI_BW_HT20);
esp_wifi_set_max_tx_power(8);


Btw, be careful running ESP32's at full 20dbm power, most boards have crappy antenna with bad VSWR, the reflected power can hurt the LNA or cause other problems with the wifi.

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], PerplexityBot and 2 guests