I’m encountering an issue with the update-nimble branch of OpenMQTTGateway where Long Range BLE scanning (Coded PHY, S8) does not detect my Xiaomi thermometer flashed with ATC 1441 firmware set in long range.
A test sketch using NimBLE-Arduino 2.3.1 and framework-arduinoespressif32 @ 3.2.0 successfully detects the thermometer in long range, confirmed via nRF Connect to use Coded PHY.
However, OMG fails to detect the device, likely due to missing Coded PHY configuration in gatewayBT.cpp.
If I change the thermometer in normal mode (1M) it is detected and report to Mqtt and home Assistant but has shorter range.
EnvironmentHardware: ESP32-S3-DevKitC-1 Version: update-nimble branch ([commit reference, e.g., latest as of June 27, 2025])
Coded PHY, which requires extended advertising to be enabled in the Nimble stack, is not available currently in OMG as it does not enable it in the stack. This is an enhancement that could be added later but would require different build flags.
I have solved this by using the following flags for NIMBLE in platformio :
build_flags =
${env.build_flags}
‘-DCONFIG_BT_NIMBLE_ROLE_PERIPHERAL_DISABLED’
‘-DCONFIG_BT_NIMBLE_ROLE_BROADCASTER_DISABLED’
‘-DCONFIG_BT_NIMBLE_EXT_ADV=1’
And modifying gatewayBT.cpp adding this line under void Blescan
Here are the signal on a thermometer in long-range coded/ S8) and one in legacy (S1/1m) booth set at +3dB screenshots at 175 meters outside in a city street (probably noisy in 2.4ghz).
That is done with my tablet and nrf connect. I did not made the test with ESP32-s3 yet as my change limit the scan on ble coded only so not great to compare.
Tablet used with NRF connect is Xiaomi pad6 pro (bluetooth5.3).
No significant difference in dB but better range as the signal decoding is more consistent in low levels.
NRF connect stop reporting under - 100dB.
It makes sense, my wife who is hearing impaired always says no need to speak very load, speak slowly and clearly and if I don’t understand repeat using other words.
It is the same idea in S8 protocol slowly 125 kbps and using more bits to keep a better BER. .