# XRP robot and how to scan for bluetooth devices?

**URL:** <https://xrp.discourse.group/t/xrp-robot-and-how-to-scan-for-bluetooth-devices/99>\
**Category:** General\
**Created:** [October 20, 2023, 9:17pm UTC](https://xrp.discourse.group/t/xrp-robot-and-how-to-scan-for-bluetooth-devices/99 "2023-10-20T21:17:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sfong21](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@sfong21](https://xrp.discourse.group/u/sfong21)\
**Post date:** [October 20, 2023, 9:17pm UTC](https://xrp.discourse.group/t/xrp-robot-and-how-to-scan-for-bluetooth-devices/99/1 "2023-10-20T21:17:14Z")

</div>

I have installed the latest MicroPython (v1.21.0) on the XRP robot. It provides a new bluetooth library.

> **[MicroPython - Python for microcontrollers](https://micropython.org/download/)**
>
> MicroPython is a lean and efficient
> implementation of the Python 3 programming language
> that includes a small subset of the Python standard library and is
> optimised to run on microcontrollers and in constrained environments.

[https://docs.micropython.org/en/latest/library/index.html#micropython-lib-micropython](https://docs.micropython.org/en/latest/library/index.html#micropython-lib-micropython)  
[https://docs.micropython.org/en/latest/library/bluetooth.html](https://docs.micropython.org/en/latest/library/bluetooth.html)

I would like to search for nearby bluetooth devices (name, UUID, RSSI strength, etc.) and determine its distance from the XRP robot. Look forward to your suggestions.

Note: There are many articles for using pybluez or upyble; however, I do not know how to install them on a Raspberrry PI Pico W with MicroPython?

> **[GitHub - pybluez/pybluez: Bluetooth Python extension module](https://github.com/pybluez/pybluez)**
>
> Bluetooth Python extension module. Contribute to pybluez/pybluez development by creating an account on GitHub.

> **[upyble](https://pypi.org/project/upyble/)**
>
> Command line tool for Bluetooth Low Energy MicroPython devices

Steven

---

<div class="post-metadata">

**Author:** ![jrw4561](https://yyz1.discourse-cdn.com/flex011/user_avatar/xrp.discourse.group/jrw4561/32/66_2.png) [@jrw4561](https://xrp.discourse.group/u/jrw4561)\
**Post date:** [October 30, 2023, 8:16pm UTC](https://xrp.discourse.group/t/xrp-robot-and-how-to-scan-for-bluetooth-devices/99/2 "2023-10-30T20:16:53Z")

</div>

Hi, I haven’t used pybluez or upyble, but I was able to have my robot act as a peripheral by using example code in this repo:

> <https://github.com/micropython/micropython/tree/master/examples/bluetooth>
>
> //github.com/micropython/micropython/tree/master/examples/bluetooth

You might be able to modify the ble\_simple\_central.py example to show you any nearby BLE service.
