Google's Chromecast is one of the most popular streaming devices on the market - and it's easy to see why! Just plug your Chromecast dongle into an HDMI port on any compatible TV, monitor or projector, and you're ready to start enjoying your content on the big screen.
But what if you don't want to invest in a Chromecast?
You can set up your Raspberry Pi to act as an inexpensive Chromecast-style streaming device. Although you can't implement the same protocols as Chromecast, you can get very similar end-results.
You'll learn in this tutorial how to turn your Raspberry Pi into a Chromecast alternative, using the free Raspicast software and the Raspicast for Android mobile app.
What you'll need
To complete this tutorial, you'll need:
- Raspberry Pi running Raspbian. If you don't have it, grab the latest version and flash it to an SD card using Etcher
- Raspberry Pi-compatible power cable
- External keyboard and a way to attach it to your Raspberry Pi
- HDMI or micro HDMI cable, depending on your model of Raspberry Pi
- External monitor
- Ethernet cable or Wi-Fi connection
- Android smartphone or tablet. Currently, the Raspicast mobile app isn't available for iOS.
After completing this tutorial, you can attach your Raspberry Pi to a TV, projector, or any screen that has a compatible port, but this step is optional.
Raspbian: check for the latest version
Before starting, make sure you're running the latest version of Raspbian.
Connect your Raspberry Pi to a power supply to boot it up. Once it's booted, click the “Terminal” icon in the toolbar.
Type the following into the Terminal window, then hit Enter.
sudo apt update && sudo apt -y upgrade
If Raspbian installs any updates, then you'll need to reboot your Raspberry Pi using the following Terminal command:
Once your Raspberry Pi has rebooted, you're ready to move on to the next stage.
Install Git, Make, OMXPlayer and OpenMax
This tutorial uses GIT and Make. These packages should be bundled with Raspbian, but since they're essential for Raspicast, you need to make sure they're installed:
sudo apt-get install git make -y
Next, check that OMXPlayer is installed, as this command line player will be responsible for processing all the audio or video content casted to Raspicast:
sudo apt-get install omxplayer -y
OMXPlayer can only process audio and video content; it cannot process static images. Next, install the OpenMax Image Viewer, which is a GPU-accelerated image viewer designed specifically for Raspberry Pi.
To start, clone OpenMax's GitHub repository:
cd ~ git clone https://github.com/HaarigerHarald/omxiv.git
libpng12-dev, which are development libraries for images in PNG and JPEG format:
sudo apt-get install libjpeg8-dev libpng12-dev
Switch to the folder where the OpenMax GitHub repository was cloned using the “change directory” (cd) command:
Build the OpenMax source code into an executable program:
make ilclient make
Once Make has finished compiling the OpenMax code, you're ready to install it:
sudo make install
The OpenMax Image Viewer is now running on your Raspberry Pi.
Allow remote connections: enabling SSH
You can use Raspicast to project any image, video or audio file from your Android device to your Raspberry Pi. This casting happens wirelessly, so you need to ensure your Raspberry Pi is set up to receive remote connections.
For security purposes, SSH (Secure Shell) is disabled by default on Raspbian. If you're ever going to cast to your Raspberry Pi, then you need to enable SSH:
1. In the toolbar, select the Raspberry Pi icon.
2. Navigate to “Preferences -> Raspberry Pi Configuration.”
3. Select the “Interfaces” tab.
4. Find “SSH” and then select its accompanying “Enabled” radio button.
5. Save your changes by clicking “OK.”
6. Reboot by selecting the Raspberry Pi logo in the toolbar and then navigating to “Shutdown -> Reboot.”
When your Raspberry Pi reboots, SSH will be enabled.
Cast from your Android device to your Raspberry Pi
Next, you need to install the Raspicast mobile app on your Android smartphone or table. After installing this app, you'll be able to cast any compatible image, video or audio file from your Android smartphone or tablet to your Raspberry Pi.
1. Download the free Raspicast app to your Android device.
2. Launch the application.
3. When prompted for a “hostname,” enter your Raspberry Pi's IP address. If you don't already have this information, then you can retrieve it by opening a Terminal on your Raspberry Pi and running the following command:
4. Enter your Raspberry Pi's username and password. Raspbian's default username is “pi,” and the default password is “raspberry.”
5. Tap “ OK.”
6. To cast any video, image or audio file, simply tap “Cast.”
7. This file will now be cast to your Raspberry Pi.
Your chosen content will appear on any monitor or screen that's attached to your Raspberry Pi, so now that you have Raspicast set up, you're free to attach your Raspberry Pi to any compatible screen. Many apps and websites also support Raspicast, so if there's a piece of media that you want to cast, then it's always worth tapping “Share” and checking whether Raspicast is listed as an option.
Hopefully, you can now enjoy your favorite videos and photos on your widescreen TV. You can add more to the fun by installing Kodi and Netflix to Raspberry Pi or even a Plex server. With Raspberry Pi, you are spoilt for choices.
Our latest tutorials delivered straight to your inbox