Is there some code or library that would allow me to scan for nearby Bluetooth devices using a common ESP32 board ? I only found similar code for actual Arduino boards.

  • 1
    a web search reveals some
    – jsotola
    Commented Nov 20, 2021 at 23:26
  • 3
    Well.. now this question is answer #4 in a web search and 2 of the answers above are for BLE only and the other one leads to another unanswered question. It is not that easy to find good example because the Arduino-ESP32 framework added advanced Bluetooth support just recently - and its not that easy to use the receent versions.
    – IanH
    Commented Jan 31, 2022 at 20:40
  • @IanH Almost two years later, there is an actual solution to this. See gbafamily's answer below. Commented Nov 1, 2023 at 16:54

2 Answers 2


The ESP32 Arduino boards support package includes libraries for ESP32 Bluetooth and BLE. Both libraries have examples which you can find in Arduino IDE Examples menu.

  • I looked trough the examples but I didn't see one that lists nearby devices, just various example on how to pair with specific device.
    – adrianTNT
    Commented Feb 2, 2022 at 0:04

https://github.com/esp32beans/ESP32-BT-exp is a Bluetooth Dual Mode (classic and BLE) scanner. ESP32-BT-exp works on the original ESP32. No other ESP32 supports BT classic mode.

  • Worked as promised! How unfortunate that it is *only * ESP32, and not ESP32S2/S3 or ESP32C2/C3. (Cue rant on Espressif's naming conventions...) Commented Nov 1, 2023 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.