Maximum PC

Build Your Own Streaming Stick

-

YOU’LL NEED THIS

RASPBERRY PI Any of the main Raspberry Pi models will work.

ANDROID DEVICE

This needs to have the Raspicast app installed.

GOOGLE CHROMECAST is a great way to get media from your smartphone to your TV [ Image A]. Unfortunat­ely, it’s not ideal in some cases. For example, certain routers don’t work out of the box with a first-generation Chromecast. Meanwhile, the Chromecast itself is low spec and limited in many ways.

Fortunatel­y, the Raspberry Pi is ready to come to the rescue, providing a Chromecast-like experience when paired with a dedicated mobile app. With a just few terminal commands, you can configure the Raspberry Pi to accept video, music, and audio content streamed from your Android phone or tablet, and dress it up with a slick home screen.

While this should work with any of the main Pi models, we used a Raspberry Pi 3 B+, which delivers fast, stable streaming of HD video from the Android handset. –CHRISTIAN CAWLEY 1 STREAMING VIDEO, NOT APPS It’s important to emphasize that the Raspberry Pi plus Raspicast setup isn’t a complete replacemen­t for the Chromecast. For example, there’s no VR support, or Google Home; there’s no ambient mode, although it’s easy enough to configure a similar home screen, which we’ll also look at below.

>> In short, media streaming is replicated. Everything else you’ll need to add yourself, rely on existing streaming options, or quietly overlook. 2 ENABLE SSH Start by ensuring the Raspberry Pi is connected to a display, and you have a mouse and keyboard attached. If this isn’t possible, you’ll need to set this up remotely, controllin­g your Raspberry Pi over SSH.

>> To do this, you need to activate SSH on the Raspberry Pi. If this isn’t already enabled, you have two options. The first is to connect a keyboard, open the Raspberry Pi Configurat­ion tool in the “Preference­s” submenu on the desktop, click “Interfaces,” select “SSH,” and click “OK.” A reboot may be required.

>> The second option is to insert your powered-down Raspberry Pi’s microSD card into your computer, browse to the “/boot/” directory, and create an empty text file called “ssh,” with no file extension. Eject the card, replace in the Raspberry Pi, and reboot; SSH will be enabled, ready for remote access. Note that you need to know your Raspberry Pi’s hostname or IP address for SSH access. You’ll find the hostname by entering that word as a command. To see the IP address, either check your router’s admin screen or enter ifconfig . Look for an entry for “eth0” (Ethernet) or “wifi0” (wireless), and you’ll find the IP address labeled “inet.” 3

FRUIT UPGRADE It’s time to update your Raspberry Pi. We’re assuming you’re using the latest version of Raspbian Stretch for this, although other Pi distros should work fine. Open the terminal (or connect via SSH) and enter: sudo apt-get update sudo apt-get upgrade

>> With your Pi’s repositori­es refreshed and any upgrades downloaded, it’s time to install some prerequisi­te packages:

sudo apt-get install libjpeg9-dev libpng12-dev

>> Two graphics-based packages are installed here: libjpeg9-dev and libpng12-dev. These enable JPEG and PNG images to be streamed from your Android device to your Raspberry Pi, and displayed on your TV. 4 STREAMING TO THE (OPEN)MAX Also required is OpenMax, described by its developer as “a GPU accelerate­d image viewer for the Raspberry Pi.” It also includes graphics libraries for GIF and BMP images. Get OpenMax by cloning the GitHub directory:

git clone https://github.com/HaarigerHa­rald/omxiv

>> Once downloaded, change directory:

cd omxiv

>> Now use the “make” command to build the software: make ilclient make

>> You need to wait a while for this to complete. This is a good time to install the Raspicast mobile app, as per the boxout (above-right).

>> Once the tool is ready to install, use:

sudo make install

>> Wait while this completes before proceeding. With everything ready to roll on your computer, and the Raspicast app installed on your phone or tablet, it’s almost time to start casting. First, open the app and tap the menu to find the SSH settings. Here, input the

hostname or IP address of your Raspberry Pi. You also need to add the username and password. Click “OK” and prepare to start streaming media from your phone.

>> Two options are available: streaming content stored on your phone or tablet from within the app, or by sharing the content from another app. To stream from Raspicast, tap the “Cast” button, and browse the media on your phone. Select the one you want to view, tap the “Play” button, and your Raspberry Pi displays the content on your TV.

>> For sharing (perhaps from YouTube), simply cue a video or song, tap the “Share” button, and select “Raspicast.” You’ll spot two options: one to play immediatel­y, and one to queue the clip to play later.

>> As versatile as ever, the Raspberry Pi makes a great Chromecast replacemen­t. Raspicast isn’t the only method to achieve this, however. If you have Kodi installed on your Raspberry Pi, several remote apps for the media center— including the official option, Kore—offer casting from your mobile device. This is useful, because Raspicast doesn’t work on Raspberry Pi-based Kodi systems. 5 TAKE ME HOME You might have a Raspberry Pi that receives media, Chromecast-style, from your Android device, but it doesn’t quite look the part. Chromecast has a slideshow of curated images for you to enjoy, for example, along with weather, and date and time informatio­n. If you want to make your Pi more like Chromecast, you need a kiosk app—one that enables custom images to be displayed as a slideshow. Many of these are available, but the simplest to set up is Andrew Delph’s Python slideshow with time and weather, which is on GitHub.

>> Get started by adjusting the Raspberry Pi’s video memory. Open the configurat­ion tool with:

sudo raspi-config

>> Next, browse to “Advanced Options > Memory Split.” Here, change the value to 256. This ensures that the Pi’s GPU has enough memory available to handle the slideshow images.

>> Click “OK” to continue, then follow the instructio­n to reboot. Upon restarting, open a new terminal window, and clone the slideshow files from GitHub: git clone https://github.com/andrewdelp­h/pythonslid­eshow-with-time-and-weather.git

>> Once this is downloaded, rename the directory to a snappier title, such as “pyss,” with the mv command: sudo mv python-slideshow-with-time-and-weather pyss

>> You also need the “pyowm” tool. This is a wrapper for the OpenWeathe­rMap, which brings the necessary weather data on to your Raspberry Pi’s desktop:

pip install pyowm

>> Some additional configurat­ion is required to get this to work. First, you need to remove some images. Open the “pyss” directory first, and remove the four JPEG files starting “WIN_20160220.”

>> Next, edit the “ss.py” file:

sudo nano ss.py

>> Here, look for the line that reads:

observatio­n = owm.weather_at_place(‘Ottawa,CA’)

>> Change the city and country to match your own location. For example, a New Yorker might use:

observatio­n = owm.weather_at_place(‘New York,US’)

>> Press Ctrl-X to save and exit. In the terminal, launch the slideshow:

python ss.py

>> A gallery of stunning images, the date and time, and current weather [ Image B] are now displayed on your Raspberry Pi Chromecast replacemen­t!

 ??  ??
 ??  ??

Newspapers in English

Newspapers from United States