BLE connect between 2 Photon 2 devices

Hello,

I have limited knowledge on this stuff but love to tinker and make things work. I have been making various projects with Particle devices since the original Spark Core in 2014! However, I think my latest project has me in over my head, but its a personal project that I was hoping to get done before Christmas eve.

Essentially, I am looking to use 2 Photon 2 devices to determine a rough distance measurement between the 2 devices. It doesnt need to be super accurate, just looking to calibrate it to determine when the 2 devices are "close (around 15 feet), closer (around 7.5 feet), and closest (anything less than a few feet)" from each other. When it determines these distances, I want to light up LEDs to signal what distance is being detected by the 2 devices. I was looking to pick up some ESP 32 UWB controllers but they will take too long to ship, so since I have 2 Photon 2 devices not in use, I thought maybe I can use the RSSI strength from the BLE to accomplish my goal.

I was able to get the first Photon 2 device to act as a beacon, which I believe is working because I can see the device when I scan for devices with my phone.

But I just cant figure out how to connect to the beacon with my second device. Do I have to scan for available bluetooth devices with the second device or is there a way to automatically connect it to the beacon device, and how can I read the RSSI strength?

Thank you in advance for any help you all can provide!

Have you looked at Device Nearby and RSSI meter?

1 Like

Thank you so much for directing me to those references, this is exactly what I was looking for!

I have 1 device acting as a beacon, and the other acting as a scanner. I was able to set up a adafruit neopixel jewel to the scanner and detect some distances. When the devices are 15 feet or more the leds light up red, when between 5 to 14 feet the leds turn yellow, when I when under 5 feet the leds turn green.

Is there a way for the beacon device to also mirror the led results at the same time as the scanner device? Can the beacon device know the distance from the scanner device at the same time the scanner device determines the distance from the beacon device?

I am assuming a device cannot act as a beacon and scanner at the same time.

1 Like

I'm glad to hear you've gotten it working!

You'll need to send back the measured distance from the scanner.
It's not a trivial operation though, as you'll be breaking the beacon/scanner protocol to get the data back to the beacon.

Role swapping after x seconds might work, but you'll need to co-ordinate this somehow.