Page 1 of 1
Configuring WiFi Channel Bandwidth in Arduino
Posted: Thu May 26, 2022 5:01 pm
by noamaiz
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.
Re: Configuring WiFi Channel Bandwidth in Arduino
Posted: Fri May 27, 2022 1:02 am
by Sprite
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.
Re: Configuring WiFi Channel Bandwidth in Arduino
Posted: Thu Jun 23, 2022 10:49 pm
by fanatmeta
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.
Re: Configuring WiFi Channel Bandwidth in Arduino
Posted: Wed Nov 12, 2025 6:19 pm
by ESP32_kid
#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.