Hello,
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'
GET_LOCATION_DATA_CHARACTERISTIC = '003BBDF2-C634-4B3D-AB56-7EC889B89A37'
async def run(address, loop):
async with BleakClient(address, loop=loop) as client:
await client.is_connected()
print("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))
print(value)
time.sleep(1)
addr = (
TAG_MAC if platform.system() != "Darwin"
else TAG_UUID
)
loop = asyncio.get_event_loop()
loop.run_until_complete(run(addr, loop))
Kind regards,
Max