Detect if iPhone is Close to Raspberry Pi

I'm looking for a convenient way to detect whenever the iPhone is close, almost touching, from a raspberry Pi. Detection should be made from raspberries. I donโ€™t have to exchange data, all I need to know is when the devices are very close or touching.

I was brainstorming some ideas, but I need your hand, here are my thoughts:

  • WIFI : Signal Strength? Broadcast and delayed verification? Is it possible to do something from WIFI without being on the same network? Is it possible if on the same network?
  • Bluetooth The same thing happens here. Is it possible to obtain signal strength or in some way to obtain proximity? Ideal without mating.
  • NFC Can NFC be used for this? From what I read, it seemed to be limited to Apple Pay.

These were my thoughts, I am sure that you have the best ideas, and I would be glad to hear them! Any input is valuable :)

+5
source share
2 answers

You can definitely use BLE via CoreBluetooth and configure Raspberry Pi as the Bluetooth peripheral with which you connect the application. You can configure Raspberry Pi to broadcast the unique GATT service so that you can automatically connect to it by finding this service in CoreBluetooth.

Once you connect to the peripherals, you can use the readRSSI() method to extract the power of the Bluetooth signal and the frame will call the peripheral(_:didReadRSSI:error:) delegation method peripheral(_:didReadRSSI:error:) with the information you requested. You can then use this to detect (approximately) the distance of the iPhone from the Raspberry Pi.

Depending on the actual distance, the RSSI โ†’ distance relationship will vary between the iOS devices, chipsets and Bluetooth dongles that you use ( more info here ), so you may have to play with the data as soon as you have the application to find what suits you.

Sorry for the large number of links. This question was quite broad, and I just offer my perspective, since I worked a lot with CoreBluetooth and BLE. As far as I know, WiFi will not be a very good reusable solution, and I have not worked with NFC in my applications. Let me know if you have any other questions!

Edit: I missed where you said you want to make the detection on the Raspberry Pi itself, and not on the phone. My apologies. I will save my answer above as a link, but you still have options via Bluetooth LE and possibly through NFC (and I still exclude Wi-Fi due to too many changes in network strength and detection).

For BLE, you can use a very similar approach to the one I highlighted above, except for creating your iPhone application where your iOS device is a peripheral device and it broadcasts its services to the Raspberry Pi. For NFC, if you check this thread , both answers seem to contain some good start-up information on how you could get the Apple Pay token account number if you plug in the NFC reader on the Pi. Hope this helps.

+5
source

To indicate BLE RSSI on a Pi 3 (not sure about other versions / using a BT key) with or without a beacon, there are several indirect methods - see Bluetooth LE Signal Strength and Can RaspberryPi Detect iBeacons with a BLE Dongle?

0
source

Source: https://habr.com/ru/post/1260674/


All Articles