I just picked up a nano 33 ble and I am trying to use it to detect if a device is nearby and activate one of the GPIO pins to control whatever I need. This isn't exactly what I am doing but for example, maybe I want the Arduino to unlock something when a certain Bluetooth device is within a specific range.
I was thinking I could just scan for a specific device address continuously and when the address is found I can go from there.
I have been able to successfully scan and look for nearby devices and display the address of each device nearby.
So far so good, however, I have come to find out the MAC address my phone broadcasts is not necessarily the address my nano picks up and displays.
After doing a little digging it turns out the MAC address as of some version of android is randomized due to privacy reasons so tracking is more difficult.
So scanForAddress() from the Arduino BLE library will not work it appears for what I want to do, it appears there is some sort of algorithm that determines the masked address and that uses an IRK key.
That library also has scanForName() which appears to simply scan for the name of the device which would work in my case, I was just hoping for a more secure way to identify a device. I don't want someone to be able to just change their device name to the one I am looking for and gain access.
The other thought I had was possibly creating a custom service to broadcast from the device and the Arduino could look for that specific service. The ble library offers a hasService() function that could possibly make this work.
Now it seems like I would need to make some app to sort of broadcast this as an available service that my phone has which I have zero experience in developing an app so this might be a stretch for me.
So I was hoping I could possibly get some suggestions on the direction I can go with this project. I settled on Bluetooth because I was familiar (just because I use it everyday not because I know how it works at all) but I am open to other methods. I looked into RFID briefly but it seemed I would need to spend more money than I was hoping to achieve a decent range of detection (5 or so feet).
Edit: I also just thought of possibly getting a Bluetooth tag instead of using a phone, maybe the address does not change on those devices.
Thank you in advance for any tips!