Kevin
Kevin

Reputation: 2416

How do you set the ESP32 to maximum BLE Power?

How do you increase the ESP32 BLE to maximum power, for maximum distance? It appears the default is set to index 5, which is only +3dbm. (ESP_PWR_LVL_P3 = index 5, Corresponding to +3dbm) More Details

Upvotes: 2

Views: 5868

Answers (1)

Kevin
Kevin

Reputation: 2416

There used to be a bug, it appears its fixed now. As indicated above, ESP_PWR_LVL_P9 = index 7, which indicates +9dbm.

After "BLEDevice::init("ESP32");", add this to get the maximum output:

esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_DEFAULT, ESP_PWR_LVL_P9); 
esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_ADV, ESP_PWR_LVL_P9);
esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_SCAN ,ESP_PWR_LVL_P9);

Check via this:

int pwrAdv  = esp_ble_tx_power_get(ESP_BLE_PWR_TYPE_ADV);
int pwrScan = esp_ble_tx_power_get(ESP_BLE_PWR_TYPE_SCAN);
int pwrDef  = esp_ble_tx_power_get(ESP_BLE_PWR_TYPE_DEFAULT);
Serial.println("Power Settings: (ADV,SCAN,DEFAULT)");         //all should show index7, aka +9dbm
Serial.println(pwrAdv);
Serial.println(pwrScan);
Serial.println(pwrDef);

Can also confirm via an Android phone app like nRF Connect, that the Tx Power Level is now 9dBm.

Upvotes: 3

Related Questions