Ivan Oe Valentini
Ivan Oe Valentini

Reputation: 63

Communication between Hololens v2 and Android smartphone

Good afternoon, I'm developing a system with a pair of Hololensv2 and an android smartphone using Unity.

In my system the smartphone should send some data to the hololens, more precisely I'm trying to send the location data (GPS) cause in the hololens there's not that specific sensor. I developed a full functioning UDP solution already, but now I need to build a network free one to be able to use everything outdoor.

The first possibility that came to my mind was to use Bluetooth, connect the 2 devices a send from the smartphone a message to the hololens.

Following this project on GitHub: https://github.com/FlipWebApps/HololensGPS i managed to build a theoretically working Bluetooth receiver on the headset, the problem is that it is a beacon receiver and not all the smartphone can be set as beacons.

Moreover, on Unity, I can't use directly Bluetooth directives but I need to pass through a plugin. I tried 2 already without good results: https://assetstore.unity.com/packages/tools/integration/ibeacon-15260 https://assetstore.unity.com/packages/tools/network/bluetooth-networking-for-ios-tvos-and-android-124274

While with the first one I didn't get anywhere, with the second one I managed to find, without being able to connect to it, the hololens Bluetooth.

I really feel like I'm missing something...

I don't even know which option would be better between trying to connect the 2 devices directly or to keep trying to set the smartphone as a beacon and the hololens as a receiver...

Any idea/suggestion would be highly appreciated... Thank you all.

Upvotes: 4

Views: 1281

Answers (2)

Thomas
Thomas

Reputation: 56

I was in the same situation as you, and I solved it using UDP. You need to have two phones, however, since Android phones (and I imagine iOS devices as well) do not make themselves a part of their own WiFi hotspot for security reasons. You have one phone acting as the switch, with its WiFi hotspot enabled. Your second phone connects to that hotspot, and broadcasts its GPS location over UDP. Your Hololens also connects to the same hotspot, and can then receive the UDP messages. All using Unity code, without the need for native Bluetooth plugins.

Upvotes: 0

Matt E.
Matt E.

Reputation: 1030

It really depends on the type of communication needed across devices, but since your networked version is UDP a one-way broadcast should work. If the Android device is broadcasting a value then the Hololens can just listen, and it should not matter if you have 2 or 200 of them. The trick is that none are 'connected' to the broadcaster, they are just observing.

You would only need to connect the two Hololenses to each other if they provide dependent services. In that case you might consider setting the Android as a WiFi host which would have greater range and is already coded ;)

If there is no need for that level of range or complexity, the Beacon protocol can act like UDP. As Beacons are Bluetooth Low Energy (BLE) you would need to set the Hololens to Observer mode so that it will listen but not connect. A very good explanation on how to do that with BLE on a Pi is here.

Upvotes: 1

Related Questions