Categories
raspberrypi technology virtualreality

Adventures with Immersed VR on the Pi 5

Raspberry Pis are cool. Virtual Reality, also cool.

Let’s make a Raspberry Pi Virtual Reality coolness sandwich!

To be clear, this tutorial is about getting an Immersed VR virtual monitor working with the Pi 5. It is NOT about running a VR simulator with the Pi 5 – if you want that you can get some guides with a Google search on “DIY VR on raspberry pi.”

Disclaimer:

This tutorial makes use of a prototype build compatible with the Raspberry Pi which the Immersed VR team made available to me through Discord. It is not yet available on their downloads page and may not be compatible with all headset/raspberry pi combinations. YMMV.

Shout-Out:
This tutorial would not have been possible without the inspiring work done by Augusto Ícaro . Check out https://github.com/augustoicaro/Immersed-Linux-Virtual-Monitors and be prepared to go ooooh-ahhhhh 🙂

Prerequisites:

  • An Immersed VR account – their free starter mode should work, although you can also earn Pro by using Immersed in starter mode minimum 3 out of 7 days. More on that at https://immersed.com/faq#how_to_unlock_pro_mode
  • Access to the Immersed VR Discord – invite available at https://discord.com/invite/zy6KMbJ – in order to request and download the prototype build. Check out the #linux-help channel for the download and any assistance you might need
  • Headset compatible with Immersed VR – you can see their compatibility statement at https://immersed.com/faq under the “Compatibility” heading
  • Raspberry Pi 5 with appropriate accessories
    • an SD card with the Raspberry Pi OS and enough space for this exercise – 50 GB or more should be plenty
    • a power supply that outputs 27W that connects via USB-C
    • a micro HDMI cable with an output compatible with a monitor of your choice
    • a mouse and keyboard that can connect via USB type A (the standard big type) or Bluetooth
  • Wifi connectivity – Immersed VR works over your wifi network. Both the Pi and the headset should be connected to the same wifi network.
    ** Note that it is advisable to use a private wifi network rather than a public one, since public ones are vulnerable to hacking and could result in your session being compromised

If you are brand new to the Raspberry Pi, there is a great “Getting Started” tutorial at https://www.raspberrypi.com/documentation/computers/getting-started.html . This tutorial assumes you have already gone through these steps and have your Pi powered, booted up, configured with your login details, and connected to Wifi .

All the following steps should be executed on the Pi itself, except for the scp command which would be from a separate computer.

Steps:

  1. Download the app image from the Discord #linux-help Immersed VR channel to your Pi. If you don’t want to install Discord on your Pi, you can also download it on a separate computer that has Discord and use secure copy (scp) to transfer it to the Pi
    To use this second method, first copy your main computer’s public ssh key to the Pi as ~/.ssh/authorized_keys. A sample scp command to do this would be:
scp -i mylaptop_private_ssh_key /Users/mylaptopuser/Downloads/Immersed-aarch64.AppImage mypiuser@192.168.1.165:/home/mypiuser/Downloads

2. Once the App Image is on the Pi, grab the Linux setup script

wget https://raw.githubusercontent.com/augustoicaro/Immersed-Linux-Virtual-Monitors/main/scripts/immersed-setup/immersed-setup.sh

3. This script assumes your app image is in /home/mypiuser/Applications. Either create that directory and move both the setup script and the app image into that directory, or modify the setup script to find these resources wherever you want them to live.

4. Modify the setup script to use the App Image you downloaded. I had to replace “x86_” with “aarch”. A sample command to do this is:

sed -i -e 's/x86_/aarch/g' ~/Applications/immersed-setup.sh

5. Make the setup script executable

chmod a+x ~/Applications/immersed-setup.sh

6. Put your Applications directory on your PATH by adding this export line to your .bashrc file and then sourcing it to load it in your terminal.

echo -n "export PATH=$PATH:$HOME/Applications" >> ~/.bashrc
source ~/.bashrc

7. Install additional packages and make a symbolic link for libwlroots. Note that these versions are specific to the 10.3.2 version of the App Image and may change when this is updated.

sudo apt install -y libfuse2 libwebkit2gtk-4.0 libva2 libva-drm2
sudo ln -s /usr/lib/aarch64-linux-gnu/libwlroots.so.11 /usr/lib/aarch64-linux-gnu/libwlroots.so.5

8. Adjust the ~/.ImmersedConf file to setup your v4l2 camera device (to enable the virtual webcam feature). Use the Text Editor to find the line that starts with “CameraDevice” and adjust it to read like so:

CameraDevice=/dev/video7

8. Run the immersed-setup.sh script from the Applications directory.

cd ~/Applications
./immersed-setup.sh


This script may end with an error similar to this:

modprobe fatal module card_label=Immersed not found in directory /lib/modules/6.6.31+rpt-rpi-2712

If so not to worry, it means the v4l2loopback module hasn’t loaded into your current session. The v4l2loopback module relates to the webcam functionality.

To load the module, restart your Pi with shutdown now -r or by hitting the power button, letting it power off, and hitting the power button again.

9. At this point you should be able to run the setup script and not get any errors. Now it’s time to run the app image!

cd ~/Applications
./Immersed-aarch64.AppImage

Depending on what happened with the v4l2loopback module, the app image may generate a pop-up prompting you to install a few more dependencies. If so not to worry, we already installed these in step 7, so you can click “Do not display again” on these.

At this point you should be able to sign in with your Immersed VR account and pair the VR app with the Pi. The pop-up should say “Agent Ready” when it is available for the VR app.

10. In the VR app, select “Computers” and click the “raspberry pi” option. It should connect after a few moments. If it does not connect right away, try stopping the AppImage with Ctrl + C and re-run it.

11. View your fancy new monitor in VR!

OCULUS_ATTRIBUTION_ID:9279578942068913–

Congratulations! You now have the ability to connect to your Raspberry Pi 5 in virtual reality!

If you have any questions or get stuck, feel free to ping in the #linux-help channel of the Immersed VR Discord and we’ll see what we can do!