Skip to main content
New Participant
October 15, 2019

How to send data(0,1,2,3) to an Arduino or Raspberry via Bluetooth or Wifi.

Hello readers!.
i am working on a medical project that uses VR for rehabilitation of people with certain kinds of traumas, physical and emotional (cant reveal more info about it).

I would like to know if there is a way to pair an Arduino or Raspberry with a Bluetooth module, so when i hit an object or do something in VR, the raspberry or arduino can read a 1,2,3,4 or a couple of chars.

My guess is 
1) Pair the oculus quest android to the arduino (can this be done?, or is it only for gamepads)
2) Use a wifi server and send messages over HTTP or OSC.
3) connecting directly to USB if possible, a long usb cable wouldn't bother that much.
To me, bluetooth would be the best one because it wouldnt require to use an external wifi , router, and extra program.

Any ideas? someone tried this already?.

Im working with Unity and Oculus SDK, but this is a platform agnostic solution, and there are many people already asking about this.

Also, can the arduino be seen as a "gamepad" somehow? so i send and receive input , like cheating the quest.

16 replies

Inspiring
October 15, 2019
There are quite a few assets on UE4's Marketplace for this, but that UE4, not Unity.
October 15, 2019
You should investigate BLE (Bluetooth Low Energy). There are BLE modules that will work with Arduino, and there are several plugins in the Unity Asset Store that can communicate with BLE devices.
(Here's one, I haven't used it, so can't endorse:
https://assetstore.unity.com/packages/tools/network/bluetooth-le-for-ios-tvos-and-android-26661 )

The main advantage of BLE is also it's disadvantage: You don't have to pair the BLE device with the Android device (Oculus Quest should behave the same as an Android device). The BLE device advertises a service and the Android devices requests a connection with a device advertising a particular service. Once the devices are connected you can send low bandwidth data over a serial connection (that should be handled by the Unity plugin).

Since you don't have to pair the two devices it saves you the hassle of figuring out how to do that with Oculus' UI, but you will have to find and connect to the BLE device each session. That can be simplified by having your app remember the GUID of the last device it connected to and always try to reconnect to that one if it's available.

(Of course this is assuming that since BLE (Bluetooth 4.0) is part of standard Android and Oculus Quest is an Android device it "should just work.")
October 15, 2019
If Bluetooth won't work another way this could be done is with a Raspberry PI running a websocket server over WiFi. The Unity app could connect to that server either manually by entering an IP address, or automatically using Bonjour/ZeroConf. I did a prototype Android TV app that did this, it should work the same on a Quest.
November 11, 2019
@DarkTable Are you saying that the Quest doesn't need to connect with the BLE to send a signal? I am struggling to try to get my HC-05 to connect over Bluetooth. I can't input a PIN code to connect because no keyboard is available on the screen. 


New Participant
March 23, 2021

1. Find a keyboard with wire.

2. Plug it in Quest headset with USB type C adapter.

3. Key in the PIN code.

 

I've tried that and it worked.

New Participant
November 11, 2019
Adafruit makes bluetooth modules for Arduino that you can connect to from Unity. We used one for a home run derby game that had an Arduino and BT module housed in a plastic bat. But the app ran on a laptop - not on a Quest. I would think it should be doable though but I have no proof of this. :)
New Participant
December 24, 2020
@leagamedev did you manage to find a solution on this? I am searching for the same solution.
Thanks
New Participant
January 29, 2021

PXdevteam said:

@leagamedev did you manage to find a solution on this? I am searching for the same solution.
Thanks


You can use the Arduino Bluetooth Plugin from the asset store , I have worked on it and it works well on quest2 but doesn't work well on Quest but I have no idea why .
November 20, 2021

Hi Nitin Tiwari,

I bought the Arduino Bluetooth Plugin from the Asset Store and am trying in vain to get it to work with the Quest 2. My goal is to receive GSR and pulse sensor information via BLE and visualize them within the VR simulation I've created via Unity3D. I've tried to get it to get it to connect from within my VR simulation to an ESP32, an HC-05, even a Bluno, but with no luck. Out of those, only the ESP32 can actually pair with the Quest 2, but no luck after that. I use the callbacks that Tony (Arduino Bluetooth Plugin's author) tells me to use but I keep getting "Connection Failed" as a result from the plugin.

 

What exactly are you using for an Arduino sketch, if you don't mind my asking? I've tried changing some aspects of the sketch only to find that the ESP32 can no longer even pair with the Quest 2. I revert to the former sketch to get it to pair again but with no connection, so I try to change some other things. It does seem like the problem is in the sketch I'm using since I've heard from at least several people that the Arduino Bluetooth plugin should work with the Quest 2.

 

Is there any advice you could give me on how to construct my Arduino sketch so it could pair the board (ESP32 or one of the others mentioned) with the Quest 2 AND connect from within my simulation via the Arduino Bluetooth Plugin?  Any help would be greatly appreciated. 

New Participant
January 21, 2022

Any luck figuring out this issue? I'm trying to connect to quest 2 with a Arduino feather MO to send analog data, but the quest 2 "forgets" the Arduino after about 30 seconds. 

Any help would be much appreciated!  

New Participant
March 23, 2021

I have built something like this using an arduino to emulate a keyboard. You can pair it to the headset just like a keyboard, and read the inputs in Unity as if a normal keyboard were attached. You can then wire up whatever hardware you want for the inputs.  Something along the lines of this:

https://hackaday.com/2020/02/13/emulating-a-bluetooth-keyboard-with-the-esp32/

I remember I specifically used this, and found a tutorial somewhere for how to turn it into a bluetooth keyboard
https://www.adafruit.com/product/4481

 

New Participant
March 23, 2021

Someone else mentioned a concern with bluetooth in a previous response, but you won't have to worry about re-paring. When you turn the "keyboard" on and off, it will auto connect with whatever device it was previously paired with.

May 19, 2022

hello,

i am very new in the domain and I'm trying to build a device with a button (foot pedal) that can commute with Oculus (preferably wireless). I did a lot of research and found out that ESP32 can be connected to Oculus via Blutooth but there are always problems that can be due to the sketch. do you think it will works or are there perhaps better solutions for it ?

thank you!