Introduction: Raspberry Pi PC Streaming
With the ever increasing capabilities and bandwidth of home networks, media streaming from one device to another is becoming a reality. One of the main draws of streaming content from a PC to somewhere else in the house (or over the internet to anywhere in the world, more on that later) is the ability to harness the power of a gaming desktop or laptop and bring it with you anywhere, like to the TV in your family room or basement. A well-built gaming PC can easily outpace the graphical capabilities of any console, and with the ability to stream games and other media the need to purchase a new gaming console becomes obsolete. Commercial products that attempt to simplify the streaming process such as the Steam Link and Nvidia's Shield have just began production, but those who are unwilling to shell out $50-$200 for the newest tech can easily replicate this streaming technology with items from around the house. This Instructable will detail how to set up a streaming system based on a Raspberry Pi over a home network, but read on to the "Going Further" section for other exciting possibilities!
This project makes use of a program called Moonlight, an open source version of the protocols used by Nvidia's GameStream technology. Make sure to give thanks to the awesome developers!
Step 1: Materials and Other Requirements
Before you even begin, realize that you must have a host computer that is already capable of running the games/programs you wish to use, and furthermore realize that for this method of streaming to work the host computer must have a fairly recent Nvidia-brand graphics card. (The full compatibility list is located here, in the third column labeled "ShadowPlay and SHIELD PC Streaming")
With that out of the way, there are a few materials required to set up a Raspberry Pi-based streaming system:
- A Raspberry Pi (the more powerful version are better, but any revision of the board should be able to handle at least 720p@30fps)
- A host computer with Nvidia's GeForce Experience installed (see note from above)
- Some way of controlling games from the Pi, both keyboard/mouse and controller solutions will work
- A fairly strong and stable ethernet connection for both the host PC and the Pi (while wifi may be a possibility, on my personal network the lag and stuttering was horrendous, so try yourself but expect to be disappointed)
Step 2: Raspberry Pi Setup
Note: This ible assumes you already have a Raspberry Pi operational and running Raspbian OS
The very first thing to do is to reconfigure the Pi, the menu for which is presented to the user when first booting up the Pi. If you have already previously configured your Pi and need to get back to the configuration screen, navigate to the LXTerminal and type
to open the configuration utility. Once inside the configuration menu there are two settings which need to be altered:
- Disable the "Boot to Desktop" setting
- Enable "SSH" under advanced settings
After you've changed these settings reboot the Pi using the command
At the end of the startup routine there's no need to login, but the Pi should show its current IP address, which will look something like "192.168.1.1". Write this down somewhere for later.
Step 3: SSH Setup
If you've written down the IP address of your Pi then its time to move over to your host PC (leave the Pi running though).
We are going to create an SSH connection to our Pi, so for Windows users this means downloading a program called PuTTY that will allow us to connect to our Pi.
Once inside PuTTY type in the IP address of your Pi and click "Open" to start an SSH terminal. Inside of this new SSH terminal you will need to login to your Pi. The defaults are:
- login: pi
- password: raspberry
Note that no text will appear when you type your password in, do not worry, this is by design. Simply type your password and hit enter and everything should work.
Step 4: Moonlight Installation
The next step is to download an embedded version of the Moonlight software onto the Pi. The software is not included by default in the available software packages for Raspbian, so we have to add an additional repository as another source. To do this type
sudo nano /etc/apt/sources.list
in the SSH terminal on your host PC. This will open a text editor for sources.list, and within this file you should add the line
deb http://archive.itimmer.nl/raspbian/moonlight wheezy main
Press Ctrl+O then ENTER to save the file, and then press Ctrl+X to go back to the SSH terminal.
Within the SSH terminal write
sudo apt-get update
and wait for the process to finish. After that is done type
sudo apt-get install moonlight-embedded
and answer "Y" to any prompts within the terminal.
Step 5: Moonlight and GameStream Setup
Before jumping in to running Moonlight, you first need to find the IP address of your host computer. This can be accomplished in Windows by clicking the network symbol in the bottom-right toolbar>Network Settings>Advanced Options. Copy down the numbers next to "IPv4 Address" and then go back to your SSH terminal.
In the SSH terminal type
moonlight pair X.X.X.X
where X.X.X.X is the IP address of the host computer that you just found. The Pi should respond with a 4-digit code, while a pop-up should appear on your host PC asking for said code. Enter the code and hit "continue".
Note: I had issues with getting the pop-up to appear, but restarting both the Pi and my host computer fixed the problem.
Finally, you get to start your streaming. The basic command to start a stream is
moonlight stream X.X.X.X
where again X.X.X.X is the IP address of your host computer. This will launch a stream with the default settings, which is 720p@60fps and Steam Big Picture Mode as the default app. All of these options can be changed according to the instructions here.
Congratulations! Your PC streaming machine is now complete. Go on to the next step to see how to go even further with this project.
Step 6: Going Further
While a Raspberry Pi streaming PC games to your couch (or anywhere else) is cool in its own right, there are a number of ways to modify/improve this project.
- Controller Support: I personally added controller functionality so that I could play with a controller from my couch. To do this use another program for Raspbian called xboxdrv.
- Static IP's: IP addresses change every now and then, but it is possible to set up what's known as a static IP address for both the host computer and the Pi so that you never have to re-pair the two devices.
- Port-Forwarding: Currently this streaming solution only works over a local network, to access your host computer from anywhere you would need to dabble in port-forwarding. The advantages of this are enormous however, as the ability to harness the processing power of a desktop from anywhere in the world with the portability of a Pi is amazing.
- Beyond Raspberry Pi: The Raspberry Pi is one way to stream content, but Moonlight has versions of its software for various other devices. With the port-forwarding mentioned above you could turn that cheap laptop that you travel with into a powerful gaming machine by linking it to your desktop at home.
- Beyond Gaming: While games are what this ible is about, nothing is stopping you from adding other processor intensive applications like 3D modeling or rendering software to your Steam account and using the processing power of a desktop to work with these programs remotely.
As you can see, the potential uses for content streaming are nearly limitless, so get building! Enjoy!