How to Create a DIY Chromecast Using Raspberry Pi and Raspicast

Create Diy Chromecast Raspberry Pi Raspicast

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.

You can enter commands, by launching the Raspbian Terminal.

Type the following into the Terminal window, then hit Enter.

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:

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:

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:

Next, download libjpeg8-dev and libpng12-dev, which are development libraries for images in PNG and JPEG format:

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:

Once Make has finished compiling the OpenMax code, you’re ready to install it: 

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.”

We need to enable SSH, by launching the Raspberry Pi Configuration menu

3. Select the “Interfaces” tab. 

4. Find “SSH” and then select its accompanying “Enabled” radio button. 

If you're going to connect to your Raspberry Pi remotely, then you'll need to enable SSH.

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. 

Head over to the Google Play store, and install the Raspicast application.

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: hostname -I

Enter your Raspberry Pi's IP address. If you don't have access to this information, then you can retrieve it from the Terminal.

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.” 

You can now cast any compatible video, image or audio file to your Raspberry Pi.

7. This file will now be cast to your Raspberry Pi.

Simply cast a file from the Raspicast mobile app, and it'll appear on 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.

Related:

5 comments

  1. Google have recently stopped allowing laptops to connect to Chromecast, so I was
    interested in the protocol from the Android app that talks to the OMX player,
    so it could be re-implemented for a laptop (LXLE, as I have given up with windoze)
    but I am sure any language would do really.

    Thank you for an interesting article.

    1. Hi, I haven’t tested this myself but according to the Raspicast website the app does support subtitle (srt-format) streams.

  2. There’s an Android app called AirScreen that lets you use the actual Chromecast protocol. It works on Fire TV, so could you install Android on the Pi and use that?

    1. Thanks for the suggestion! I wasn’t aware of AirScreen so I’ll take a look into it. We also have a guide to installing Android on Raspberry Pi, which might come in useful if you decide to use AirScreen: https://www.maketecheasier.com/install-android-on-raspberry-pi/

Leave a Comment

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.