Bluetooth disconnects after certain amount of time

for my RTLS project I bought 5 DWM1001 DEV boards. 4 of them shall be configured as anchors (whereas one is the initiator) and the remaining one is supposed to be the tag.
I’ve already set up every node appropriately and by using the les command in shell mode on the tag I am able to see its position.
Now, I wrote a simple python snippet that connects to the tag and continuously requests the location data characteristic 003bbdf2-c634-4b3d-ab56-7ec889b89a37. I also receive the location data in hexadecimals but after 10-20 seconds the connection just shuts down and I have to reconnect.
I tried the nRF Connect App, too but it also loses the connection after that time. By using the BLE Scanner app, the connection stays stable until I wish to quit.
I read that I have to subscribe to a characteristic in order to keep the connection alive, but by continuously requesting the location data I thought that’s what my python code is doing…
My project’s goal is to have a custom Android application running that receives the tag’s position continuously. For that it has to keep a stable connection with the tag. Any suggestions?

My python code uses the bleak module and looks like the following:

TAG_MAC = 'F0:74:2F:98:DE:90'
TAG_UUID = 'D660605A-EAD1-4DC2-BA43-2922FF204725'

async def run(address, loop):
    async with BleakClient(address, loop=loop) as client:
        await client.is_connected()
        while True:
            # After a certain amount of time / a certain amount of iterations, the connection just drops and I no longer receive any data.
            value = bytes(await client.read_gatt_char(GET_LOCATION_DATA_CHARACTERISTIC))

addr = (
    TAG_MAC if platform.system() != "Darwin"
    else TAG_UUID
loop = asyncio.get_event_loop()
loop.run_until_complete(run(addr, loop))

Kind regards,

1 Like

Hey there,
I figured out what the problem is. As I learned reading repeatedly a device’s characteristic is not the same as enabling notifications via a descriptor.

I order to maintain a Bluetooth connection with the DWM1001 (maybe even in general with every BLE device, dunno) one has to subscribe to a characteristic. That is, one has to establish a connection to the device and then write a specific notification enable value to the characteristic’s descriptor in order to receive automatic updates from the device once the value of that characteristic has changed.

That’s why my connection each time was shut down because my DWM1001 has not received any request about enabling the notification of that particular location characteristic.

Currently, I am writing my own Android app and will post updates on whether or not I was able to maintain my connection.


1 Like

Hey once again,
I finished my little test app and the issue was exactly what I was describing above.
To anyone who’s interested here’s the link to the github repository: Location App

Thank you for sharing this information. I really appreciate it. It helped stay sane for a little longer!

Did you run into a problem with write permission? I am getting error message “Write Not Permitted”.

Where exactly do you get the error message? Can you provide me your stacktrace?

Hello, I have encountered the similar problem: keep lost connection with DWM1001. May I know how you to connect to DWM1001 via BLE? is a python library?

I am using pygatt but don’t know how to main the bluetooth connection.

As I said you have to enable notifications on a characteristic so that the connection is maintained. If you simply read a characteristic from the module it will disconnect after a certain amount of time. By enbaling notifications you avoid that behaviour and the conneciton is established as long as you disconnect once again.