DIY with the Raspberry Pi

Abhijeet Chavan
9 min readJan 22, 2018

Published on Monday, September 9, 2013 at 9:00am

The Raspberry Pi (RPi) is a credit-card-sized computer that costs $35 and can run Linux. It is designed by a non-profit as a low-cost and developer-friendly computing device that can be used by children to learn programming or by do-it-yourself (DIY) enthusiasts to develop interesting projects. People have used the RPi to build web, file or media servers, home automation systems, robots, digital signage, environmental data recorders and in efforts to bridge the digital divide.

Source: Wikipedia

Recently, I had the opportunity to demonstrate the RPi to a few middle-school students. I wanted to show them how to get started with a RPi and do a few quick fun projects. In under 90 minutes we installed GNU/Linux on the RPi, installed and played a custom game on Minecraft, and transformed the RPi into surprisingly functional media center.

Equipment

The RPi is a computer on a board. It does not have a hard drive. You have to add a SD card on to which you will have to install an operating system. It has one HDMI port which means you can connect it to a TV. It also has analog video and audio ports so you hook it up to an older TV. It comes with an ethernet port, a GPIO port for connecting to external sensors, and two USB ports. All this runs on low power; you can probably power it using a phone charger you already have. It does not have a power button; just plug in the power source and it starts up. ( The RPi Quick Start guide provides a good overview of the components.)

We collected the following equipment before starting our DIY session:

  1. Raspberry Pi Model B: I ordered the RPii ModelB from Element14 and it arrived in 2 weeks. (The Model B has an Ethernet port while Model A does not. )
  2. SB Raspberry Pi Case: A case is not necessary but helps protect the RPi. You can also make your own case out of Lego blocks or even cardboard. Be creative!
  3. My Samsung phone’s charger: Most Micro-USB chargers providing minimum 700mA should work. (See list of power chargers known to work with RPi.)
  4. HDMI cable: To connect to a TV. You could also use an HDMI to DVI connector and connect to a computer monitor.
  5. 16GB Class 6 SD Card: Minimum Class 4 SD cards are recommended. (See list of SD Cards known to work with RPi.)
  6. Edimax EW-7811Un Wireless USB Adapter : Not necessary but useful if you want to connect the RPi to the internet via WiFi. (See list of WiFi USB adapters known to work with RPi.)
  7. Keyboard & mouse: Since we were going to use one USB port for the WiFi adapter, we used an Apple keyboard with a USB port on it so we could connect the mouse to it. (If you need more than 2 USB ports, RPi users recommend using a powered USB hub.)

(See list of peripherals known to work with RPi.)

Prepare SD Card

Several operating system choices are available for RPi. We used BerryBoot which is a bootloader and operating system (OS) installer that makes it easy to install and try out different OSes on a single SD card. We downloaded Berryboot, uncompressed the downloaded zip file and copied the contents of the file (just the files, not the folder) to the SD card.

Install operating system

As directed in the BerryBoot instructions, we inserted the SD card into the SD card slot and connected the power supply. The RPi booted up with BerryBoot with the Welcome screen. We selected the following options:

  • Disable Overscan: Yes (because we could see green lines)
  • Network Connection: WiFi

Next BerryBoot asked for WiFi information and connected to our wireless network.

The RPi lights up when it is powered on and the Edimax Wifi adapter displays a blue light when it is working.

BerryBoot asked where to install the OS and we selected the SD Card itself.

BerryBoot started formatting the partition.

Then BerryBoot asked us which OS we wanted to install. We selected Debian Wheezy Raspbian which is the official RPi GNU/Linux distribution. (For some reason, my fellow young DIYers thought it was funny to yell out loudly: “De-bian! Wheeeeeeezy! Rrrrasp-bian!”)

Berryboot downloaded the Raspbian distribution and installed it.

The newly downloaded OS was listed in the menu editor. You have to click on Exit to leave the menu editor and go back to the boot screen.

The BerryBoot boot menu appeared and automatically booted into the newly installed OS.

The Raspbian configuration panel showed up. We just clicked on Finish.

And we were running Linux on RPi!

To start the graphical environment we typed in:

And we were running the graphical desktop.

(If you need assistance with the installation process YouTube has several video tutorials.)

In keeping with RPi’s educational goals, a educational programming language and multimedia authoring tool developed by MIT named Scratch is pre-installed. The default web browser is Midori.

Since this is Debian, you can install a lot of other software using a simple command. For example, we installed the Chromium web browser:

sudo apt-get install chromium

Minecraft on the RPi

So far, the installation process was mildly interesting to my young DIYers but I got their attention when I said I could install Minecraft on the RPi. The Minecraft Pi Edition is specially designed to run on the RPi and is free to download. We downloaded and followed the instructions to unpack and run Minecraft.

tar -zxvf minecraft-pi-0.1.1.tar.gz
cd mcpi
./minecraft-pi

Impressing middle-schoolers is not an easy job. While they were eager to see Minecraft running on this tiny computer, once it was running, it wasn’t such a big deal anymore. But I regained their interest when I told them that Minecraft Pi is different because you can create your own games to run inside it. To demonstrate, I downloaded a game written in the Python programming language called “Hide & Seek”.

sudo apt-get install git-core
cd ~
git clone https://github.com/martinohanlon/minecraft-hs.git
[/codefilter_code]

With Minecraft already running, we opened up another terminal and ran the Python code:

cd minecraft-hs
python minecraft-hs.py

The Python script connected to the running Minecraft session and displayed:

Hi, Minecraft Hide & Seek
A diamond has been hidden - go find!

The script creates a diamond inside Minecraft at a random location and you have to find it. The script tells you if you are getting closer by displaying:

Warmer 25 blocks away

We all took turns at finding the randomly placed diamond. I showed them the code and then we discussed ideas for making the game even more fun. How about moving the diamond randomly again after every 30 seconds? Maybe we could make the diamond invisible. Or make it move every time you got within 5 blocks of it so you could never catch it!

You could do all of the above, I told them, if you learn Python.

RPI as Media Server

XBMC is a free and open source (GPL) media player that can be installed on Linux, OSX, Windows, iOS, and Android. It’s user interface is designed for televisions and remote controls. It allows users to play videos, music, and other digital media files from local and network storage media and the internet.

Open Embedded Linux Entertainment Center (OpenELEC) is a niche Linux distribution that can turn your computer into an XBMC media center. Berryboot provides an option to install OpenELEC.

Reboot the RPi and click on Add OS in the Berryboot boot menu.

Select OpenElec

Berryboot will download and install OpenELEC and show it as an option on the boot menu editor. Exit the menu editor.

OpenELEC will now be an option on the boot menu.

We selected OpenELEC and clicked Boot. OpenELEC booted into the XBMC interface.

We had to configure WiFi. We had some trouble finding out where to
do this in the interface.

  1. Click on System
  2. Then click on OpenELEC
  3. Then select Network
  4. Set the following settings:
  • Network Technology WLAN
  • Network Interface wlan0
  • WLAN SSID
  • WLAN Security
  • WLAN Passphrase

OpenELEC connected to the network and it was ready to use.

We checked the settings.

Many add-ons are available for XBMC. We decided to try out the YouTube add-on.

Go to Videos then select Add-ons

Scroll down and find YouTube.

Click Install.

We also installed the TED Talks add-on.

Once installed, the TED Talks add-on displays a list of TED video available. Just click and watch. You can do the same thing with the YouTube add-on.

Controlling at TV-connected RPi running XBMC with a keyboard and mouse is not convenient. Wouldn’t it be nice to have a remote? Well, there is an Android app for that. We installed Yatse on an Android tablet and were able to use it as a remote to control the RPi running XBMC.

One of the cool features of XBMC is that it is possible to enable XBMC to receive and play content sent over AirPlay from another device. Set this under Services.

Once the RPi is set to receive Airplay, while viewing a YouTube video on my iPad, the RPi running XBMC became available as an option.

This is my favorite use for the RPi now. I use the iPad to browse YouTube videos and then send them via AirPlay to my TV.

We had just scratched the surface of what is possible with this inexpensive little computer. There is so many more fun things to do with the RPi. I hoped that this short session would get my young audience interested in programming and coming up with their own DIY projects.

--

--