Enhancing the readout speed of BLE devices around the PyCom



  • Hello,

    We are currently testing and logging Data for our indoor localization engine. The current problem we are facing are the, oftentimes, long reaction times until the WiPy realizes the BLE Token has moved, aswell as how often it reads values from it. This is the important part of the code:

    try:
    for x in range(0, (self.data.getAnzahlTokens())):

                if str(binascii.hexlify(adv.mac)) == str(self.data.getnextMac()): 
                        print('*********************************************')
                        print("Geraete Mac Adresse = {}".format(binascii.hexlify(adv.mac)))
                        print("Geraete Sendestaerke = {}".format(adv.rssi)) 
                        data_stream= str(adv.data)
                        self.data.setRssi(binascii.hexlify(adv.mac), adv.rssi)
                        self.data.setDaten(binascii.hexlify(adv.mac), data_stream.replace("\\", ";"))
                        break
        except:
            pass 
        self.bluetooth.stop_scan()          
    

    The problem of it not being accurate is something that solely relies on the Math behind it. what we have seen is that when opening a door and getting in, we have reaction times on 1 up to 10s, most of the times in the upper half of the time spectrum.

    Currently our code reads data and then checks to see if we the MAC of the device is on our list, if so the Data gets saved into a storage, and if not it gets dumbed. This goes on and on and on. reducing the amount of MAC addresses to 1 aswell as reducing the amount of BL devices to around 4 in total does not help either.

    Has anyone any idea about how we could decrease the reaction time? Would a connect to MAC work better? Or should we start to 1 Thread/MAC?

    We also had to add in stop_scan and restart scanning as endlessli running ble.scan() would crash the WiPy.



Pycom on Twitter