Exploring the Raspberry Pi through real-world projects

Pi Are Squared

© Evgeniya Uvarova, 123RF.com

© Evgeniya Uvarova, 123RF.com

Article from Issue 146/2013
Author(s):

The single-circuit-board Raspberry Pi computer, only as big as a credit card, makes it easy to gain experience with embedded Linux systems. We'll show you some hands-on examples of how to use the Raspberry Pi in an everyday environment.

British engineer Eben Upton and a team of like-minded hardware hackers started the Raspberry Pi project as a means for providing affordable computer technology for interested young people [1]. The objective was to develop and market a single-board, credit-card-sized computer compatible with the often-narrow budget of the target group (see the "History" box).

History

In 2006, Eben Upton and his team developed the first concepts for the Raspberry Pi based on the Atmel ATmega. The idea of getting young people interested in the mini-computer was already part of the program. In 2009, the members officially established the Raspberry Pi Foundation.

In August 2011, the alpha series of around 50 boards left production. They served primarily as a platform for developers, for debugging and for demonstration purposes. In December 2011, the beta series of 25 boards followed, which were already based on the production layout. The developers eliminated the last flaws. In an online auction in January 2012, 10 boards from this beta series were sold for a total of UK£ 16,336.

On February 29, 2012, at 7:00am Central European Time, the web servers of the foundation and of the two distributors were overloaded within a few minutes by the storm of requests. Many customers waited for hours to submit a pre-order.

If you find yourself reminded of the first home computers, you are not completely off-target: The explicit goal of the founders was to recolonize basements, garages, and classrooms with the spirit of the generation that had grown up with the Atari 400/800, ZX80/81, or VC20/C64.

Almost one year after the Raspberry Pi appeared, it is appropriate to look back over what has happened between the first series of approximately 10,000 pieces and the present status approaching 1,000,000 pieces delivered: How successful has the project been? What capabilities does the hardware offer? What is possible, and what is not (yet) possible? This article explores the Raspberry Pi system through three real-world projects:

  • a multimedia, video playback system,
  • a wireless access point, and
  • an embedded temperature controller unit.

The first project is an example of the Raspberry Pi system serving as a replacement for a standard desktop computer. The latter two examples showcase the Raspberry Pi as an embedded system, which will require a little programming knowledge but, also, will give you a glimpse into the versatility of this mighty little mini-computer. Perhaps all three examples will help you imagine other do-it-yourself projects you could create with your own Raspberry Pi.

Shopping List

Originally, the designers had planned an A and B model, which were to differ mainly in the number of USB ports (one or two), the availability of an Ethernet port, and, of course, price (US$ 25/35). At this time, only model B is available. See Table 1 for a summary of Raspberry Pi components.

Table 1

Raspberry Pi Technical Data

Component

Type

SoC

Broadcom BCM2835 (system on chip)

CPU

ARM1176JZF-S, 700 MHz

GPU

Broadcom VideoCore IV (OpenGL ES 2.0, OpenVG, 1080p30, H.264 high-profile encode/decode)

RAM

512MB of RAM

Ports

USB

2 x USB 2.0

Ethernet

1 x 10/100 Mbps

SD/MMC

1 x slot

Audio

1 x stereo analog out

Video

1 x composite out, 1 x HDMI out

To get the Raspberry Pi (or RasPi for short) up and running, you need to make a list of the basic components. The Internet has more for tips on advanced operations [2] [3]. Currently, only two global distributors have the board in their catalog [4] [5]. Although delivery times of a few months were not unusual in the spring of 2012, you now generally only have to wait a few weeks.

Besides the board itself, you will need the following components:

  • A USB power supply with no less than 700mA. If you want to power additional hardware through USB, you should plan at least 1 amp.
  • An SD(HC) card with at least 2GB capacity; however, 4GB would be better. Depending on what you intend to do, that still might not be enough. Because the system is also housed on the SD card, it is advisable to choose a card with a high read and write speed.
  • For wireless access, a WLAN adapter in the form of a USB stick would be practical. But in practice, a USB WLAN adapter is often a significant factor in power consumption. If you are considering using a USB adapter, be sure the driver is supported and choose a slim design that does not block the second USB port.
  • In view of the low number of USB ports, a wireless keyboard and mouse would be a worthwhile investment that would also save unnecessary load on the limited resources of the USB power adapter.

In addition to these items, you will also need various cables, such as HDMI or Ethernet, depending on the planned use. As far as the HDMI cable is concerned, the shorter the better. You do have the option of increasing the output of the driver, but that also increases power usage. If you plan on listening to music or watching videos, you will also need headphones or speakers.

The third project (an embedded temperature controller) uses an expansion board that requires some additional hardware [6].

Getting Started

A Debian-based Linux distribution known as Raspbian is tailored for duty as an on-board operating system for Raspberry Pi. The Raspberry Pi foundation recommends the Raspbian "Wheezy" [7] release, which is used in this workshop.

Start by downloading the Raspbian "Wheezy" image file, which is a complete system image consisting of a 60MB boot partition and a root filesystem of around 2GB. Unpack the file and move it to an SD card with the following command:

$ sudo dd bs=1M if=2012-08-16-wheezy-raspbian.imgof=SD_card_device_filename

Now, plug the SD card, keyboard, mouse, and monitor into the Raspberry Pi system and boot by connecting the USB power supply. The configuration menu then appears, and if you are not using a standard English keyboard, it would be best first to change the settings under the menu items configure-keyboard and change_locale to the keyboard and language of your choice; otherwise, you will encounter problems as soon as the login is required. The default username is pi; the password is raspberry.

Other useful menu items include change_timezone, to set the correct time zone; ssh to enable safe access to the terminal via network; and expand_rootfs, to change the size of the root filesystem from 2GB to the actual size of the SD card. Finally, you should update the system in the typical Debian manner:

$ sudo apt-get update
$ sudo apt-get upgrade

You can start the configuration tool anytime using sudo raspi-config.

Project 1: Playing Video

Entering startx will take you to the LXDE graphical desktop, which is optimized for lean systems. Playing an HD video is certainly the ultimate test for the hardware. The usual video players, however, are of no help because the GPU on the board is optimized for decoding audio and video data. Accordingly, you need a player that uses Broadcom's own program library (found under /opt/vc). Currently, the only one that does that is the pre-installed command-line program omxplayer [8].

If possible, simply mount the directory containing the files over your network. NFS offers faster access to your video collection, but SSHFS is less complicated. The appropriate packages are installed, as shown in Listing 1. You then start playback with the omxplayer command.

Listing 1

Setting Up a Video Player

$ sudo apt-get sshfs
$ sudo adduser pi fuse
$ mkdir myVideos
$ sshfs username@host_name:/directory_name myVideos

After a short hiccup in picture and sound, the software played the test HD video in 720p format with a 5.1 Dolby Digital audio track – of course, mixed down to two channels – without any jerkiness. And that's all as far as the spartan Omxplayer is concerned. The program does demonstrate impressive capabilities for decoding audio and video, but nothing more. There are also two more drawbacks: The video library mentioned above is not open source software, and you must purchase licenses for the MPEG-2 and VC-1 formats.

Energy use, on the other hand, is surprisingly low: The average load while rendering the HD video was only 3.8 watts, despite the demanding task of transmitting via the network. The programs Omxplayer, SSH, and SSHFS create the biggest load for the CPU and memory, whereas the player claims the larger share for itself. However, if you want to play HD video with 1080i or 1080p, it is worth connecting the network drive via NFS.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • WiFi Thermo-Hygrometer

    A WiFi sensor monitors indoor humidity and temperature and a Node-RED dashboard reports the results, helping you to maintain a pleasant environment.

  • Onion Pi

    Extend protection to all of your Internet traffic with a Raspberry Pi minicomputer set up as a cost-effective external proxy server.

  • Pigpio

    The wiringPi library, which many Raspberry Pi fans have grown attached to over the years, is no longer under maintenance by its developer. An alternative, in the form of Pigpio, has arrived just in time.

  • How to Quickly Configure Wireless WPA Connection on Raspberry Pi
  • Kitchen Timer

    A simple kitchen helper with two timers assists budding chefs in coping with dishes that are unlikely to be ready at the same time.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News