Transmiting RF power on ESP32
Posted: Tue Apr 02, 2024 12:02 am
by djixon
Is there a way to change the strength of RF transmiting power, from code at runtime, regardless if RF module is used for WIFI or BLE?
I found this API function
esp_err_t esp_wifi_set_max_tx_power(int8_t power);
Will that affect RF transmiting power of bluetooth or BLE module too if they are enabled and wifi disabled?
Re: Transmiting RF power on ESP32
Posted: Sat Apr 06, 2024 2:28 pm
by liaifat85
As far as I know, ESP-IDF doesn't provide a built-in function to directly control the strength of RF transmitting power.
Re: Transmiting RF power on ESP32
Posted: Sun Apr 07, 2024 9:35 am
by djixon
I tested that
esp_err_t esp_wifi_set_max_tx_power(int8_t power);
function. It changes RF output power in several decibels only. Function is mainly implemented to meet regulations about maximal wifi strength which differs for each country. It works, but adjustments are really small difference (several decibels) in output strength.
However there is another possible exploit to reduce RF output strength based on brown out (tweak). Internal ESP logic is designed (mainly to protect battery powered applications) in a way that once the brown out is triggered causing chip reset, battery voltage is going to back to "appropriate" level since whole current consumption from battery is cut during chip reset. So if main start routine contains, lets say, wifi init and start calls, then reactivating PHY TX would immediately suck the large current again, retriggering new brown out reset, and so on in loop. To find a work-around against that looping-resets, designers of ESP internal logic, made a switch "Reduce PHY TX power if brownout detected". In that sence, RF output power can be reduced by causing forced brown out (requires some external components: mosfet and few resistors, so brown-out could be "simulated" and triggered by any free pin on ESP) . Sure, it is too far from "controlling RF strength by code". However, if that works (according to documentation) it means there is some internal mechanisms which does that. Possibly "hiden" function, not expossed to the API.